diff --git a/.gitignore b/.gitignore
index ead77b1f..3f1c45dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,7 @@
# Documentation
/docs/_build/*
+
+# IDE
+.idea
+src/Resources/public
diff --git a/composer.json b/composer.json
index 60fb498c..51a0f823 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
}
],
"require": {
- "php": "^8.0",
+ "php": "^7.4|^8.0",
"ext-zip": "*",
"ext-json": "*",
"symfony/asset": "^5.4 || ^6.0 || ^7.0",
diff --git a/docs/usage/ckeditor.rst b/docs/usage/ckeditor.rst
index 3217ba17..9d6ac4bb 100644
--- a/docs/usage/ckeditor.rst
+++ b/docs/usage/ckeditor.rst
@@ -55,18 +55,18 @@ the bundle, you can use a custom path (absolute):
CKEditor Release
~~~~~~~~~~~~~~~~
-You can choose which CKEditor release (full, standard or basic) to download:
+You can choose which CKEditor release (classic, ballon, ballon-block, inline, document) to download:
.. code-block:: bash
- $ php bin/console ckeditor:install --release=basic
+ $ php bin/console ckeditor:install --release=classic
CKEditor Custom Build
~~~~~~~~~~~~~~~~~~~~~
It's also possible to use custom build generated using CKEditor online builder:
-https://ckeditor.com/cke4/builder. Download ZIP archive from CKEditor website
-and use your custom build ID from `build-config.js` file:
+https://ckeditor.com/ckeditor-5/online-builder/. Download ZIP archive from CKEditor website
+and use your custom build ID from zip filename:
.. code-block:: bash
@@ -79,7 +79,7 @@ If your want a specific CKEditor version, you can use:
.. code-block:: bash
- $ php bin/console ckeditor:install --tag=4.6.0
+ $ php bin/console ckeditor:install --tag=41.0.0
Silence Progress bars
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/src/Builder/JsonBuilder.php b/src/Builder/JsonBuilder.php
index 26e22551..6804cbde 100644
--- a/src/Builder/JsonBuilder.php
+++ b/src/Builder/JsonBuilder.php
@@ -83,7 +83,7 @@ public function setValues(array $values, ?string $pathPrefix = null): self
return $this;
}
- public function setValue(string $path, mixed $value, bool $escapeValue = true): self
+ public function setValue(string $path, $value, bool $escapeValue = true): self
{
if (!$escapeValue) {
$placeholder = uniqid('friendsofsymfony', true);
diff --git a/src/Command/CKEditorInstallerCommand.php b/src/Command/CKEditorInstallerCommand.php
index 9863c627..d74d76ca 100644
--- a/src/Command/CKEditorInstallerCommand.php
+++ b/src/Command/CKEditorInstallerCommand.php
@@ -82,15 +82,15 @@ protected function configure(): void
The %command.name% command install CKEditor in your application:
php %command.full_name%
-
+
You can install it at a specific path (absolute):
php %command.full_name% path
-
+
You can install a specific release (basic, standard or full):
php %command.full_name% --release=full
-
+
You can install a specific version:
php %command.full_name% --tag=4.7.0
@@ -99,13 +99,13 @@ protected function configure(): void
php %command.full_name% --release=custom --custom-build-id=574a82a0d3e9226d94b0e91d10eaa372
-If there is a previous CKEditor installation detected,
+If there is a previous CKEditor installation detected,
you can control how it should be handled in non-interactive mode:
php %command.full_name% --clear=drop
php %command.full_name% --clear=keep
php %command.full_name% --clear=skip
-
+
You can exclude path(s) when extracting CKEditor:
php %command.full_name% --exclude=samples --exclude=adapters
diff --git a/src/Config/CKEditorConfiguration.php b/src/Config/CKEditorConfiguration.php
index 52533b71..273614ac 100644
--- a/src/Config/CKEditorConfiguration.php
+++ b/src/Config/CKEditorConfiguration.php
@@ -16,117 +16,11 @@
final class CKEditorConfiguration implements CKEditorConfigurationInterface
{
- private $toolbarItems = [
- 'basic.about' => ['About'],
- 'basic.basic_styles' => ['Bold', 'Italic'],
- 'basic.links' => ['Link', 'Unlink'],
- 'basic.paragraph' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
- 'standard.about' => ['Styles', 'Format', 'About'],
- 'standard.basic_styles' => ['Bold', 'Italic', 'Strike', '-', 'RemoveFormat'],
- 'standard.clipboard' => ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'],
- 'standard.document' => ['Source'],
- 'standard.editing' => ['Scayt'],
- 'standard.links' => ['Link', 'Unlink', 'Anchor'],
- 'standard.insert' => ['Image', 'Table', 'HorizontalRule', 'SpecialChar'],
- 'standard.paragraph' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'],
- 'standard.tools' => ['Maximize'],
- 'full.about' => ['About'],
- 'full.basic_styles' => [
- 'Bold',
- 'Italic',
- 'Underline',
- 'Strike',
- 'Subscript',
- 'Superscript',
- '-',
- 'RemoveFormat',
- ],
- 'full.clipboard' => ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'],
- 'full.colors' => ['TextColor', 'BGColor'],
- 'full.document' => ['Source', '-', 'NewPage', 'Preview', 'Print', '-', 'Templates'],
- 'full.editing' => ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'],
- 'full.forms' => [
- 'Form',
- 'Checkbox',
- 'Radio',
- 'TextField',
- 'Textarea',
- 'SelectField',
- 'Button',
- 'ImageButton',
- 'HiddenField',
- ],
- 'full.insert' => ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Smiley', 'PageBreak', 'Iframe'],
- 'full.links' => ['Link', 'Unlink', 'Anchor'],
- 'full.paragraph' => [
- 'NumberedList',
- 'BulletedList',
- '-',
- 'Outdent',
- 'Indent',
- '-',
- 'Blockquote',
- 'CreateDiv',
- '-',
- 'JustifyLeft',
- 'JustifyCenter',
- 'JustifyRight',
- 'JustifyBlock',
- '-',
- 'BidiLtr',
- 'BidiRtl',
- ],
- 'full.styles' => ['Styles', 'Format', 'Font', 'FontSize', 'TextColor', 'BGColor'],
- 'full.tools' => ['Maximize', 'ShowBlocks'],
- ];
-
- private $toolbarConfigs = [
- 'basic' => [
- '@basic.basic_styles',
- '@basic.paragraph',
- '@basic.links',
- '@basic.about',
- ],
- 'standard' => [
- '@standard.clipboard',
- '@standard.editing',
- '@standard.links',
- '@standard.insert',
- '@standard.tools',
- '@standard.document',
- '/',
- '@standard.basic_styles',
- '@standard.paragraph',
- '@standard.about',
- ],
- 'full' => [
- '@full.document',
- '@full.clipboard',
- '@full.editing',
- '@full.forms',
- '/',
- '@full.basic_styles',
- '@full.paragraph',
- '@full.links',
- '@full.insert',
- '/',
- '@full.styles',
- '@full.colors',
- '@full.tools',
- '@full.about',
- ],
- ];
-
/**
* @var bool
*/
private $enable;
- /**
- * @var bool
- */
- private $async;
-
/**
* @var bool
*/
@@ -135,32 +29,12 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface
/**
* @var bool
*/
- private $autoInline;
-
- /**
- * @var bool
- */
- private $inline;
-
- /**
- * @var bool
- */
- private $jquery;
-
- /**
- * @var bool
- */
- private $requireJs;
+ private $poweredBy;
/**
* @var bool
*/
- private $inputSync;
-
- /**
- * @var array
- */
- private $filebrowsers;
+ private $resize;
/**
* @var string
@@ -172,11 +46,6 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface
*/
private $jsPath;
- /**
- * @var string
- */
- private $jqueryPath;
-
/**
* @var string|null
*/
@@ -187,10 +56,10 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface
*/
private $configs;
- /**
- * @var array
- */
- private $templates;
+// /**
+// * @var array
+// */
+// private $template;
/**
* @var array
@@ -206,28 +75,19 @@ public function __construct(array $config)
{
if ($config['enable']) {
$config = $this->resolveConfigs($config);
- $config = $this->resolveStylesSet($config);
}
$this->enable = $config['enable'];
- $this->async = $config['async'];
$this->autoload = $config['autoload'];
- $this->autoInline = $config['auto_inline'];
- $this->inline = $config['inline'];
- $this->jquery = $config['jquery'];
- $this->requireJs = $config['require_js'];
- $this->inputSync = $config['input_sync'];
- $this->filebrowsers = $config['filebrowsers'];
+ $this->poweredBy = $config['powered_by'];
+ $this->resize = $config['resize'];
$this->basePath = $config['base_path'];
$this->jsPath = $config['js_path'];
- $this->jqueryPath = $config['jquery_path'];
$this->defaultConfig = $config['default_config'];
$this->plugins = $config['plugins'];
$this->styles = $config['styles'];
- $this->templates = $config['templates'];
+ // $this->templates = $config['templates'];
$this->configs = $config['configs'];
- $this->toolbarConfigs = array_merge($this->toolbarConfigs, $config['toolbars']['configs']);
- $this->toolbarItems = array_merge($this->toolbarItems, $config['toolbars']['items']);
}
/**
@@ -251,94 +111,39 @@ private function resolveConfigs(array $config): array
return $config;
}
- private function resolveStylesSet(array $config): array
+ public function getPlugins(): array
{
- if (empty($config['styles'])) {
- return $config;
- }
-
- $stylesSets = $config['styles'];
-
- foreach ($stylesSets as &$stylesSet) {
- foreach ($stylesSet as &$value) {
- $value = array_filter($value);
- }
- }
-
- return $config;
+ return $this->plugins;
}
- public function getToolbar(string $name): array
- {
- $items = [];
-
- foreach ($this->toolbarConfigs[$name] as $name => $item) {
- $items[] = is_string($item) && '@' === substr($item, 0, 1)
- ? $this->toolbarItems[substr($item, 1)]
- : $item;
- }
-
- return $items;
- }
+// public function getTemplate(): array
+// {
+// return $this->template;
+// }
public function getStyles(): array
{
return $this->styles;
}
- public function getPlugins(): array
- {
- return $this->plugins;
- }
-
- public function getTemplates(): array
- {
- return $this->templates;
- }
-
public function isEnable(): bool
{
return $this->enable;
}
- public function isAsync(): bool
- {
- return $this->async;
- }
-
public function isAutoload(): bool
{
return $this->autoload;
}
- public function isAutoInline(): bool
- {
- return $this->autoInline;
- }
-
- public function isInline(): bool
+ public function isPoweredBy(): bool
{
- return $this->inline;
+ return $this->poweredBy;
}
- public function isJquery(): bool
+ public function isResize(): bool
{
- return $this->jquery;
- }
-
- public function isRequireJs(): bool
- {
- return $this->requireJs;
- }
-
- public function isInputSync(): bool
- {
- return $this->inputSync;
- }
-
- public function getFilebrowsers(): array
- {
- return $this->filebrowsers;
+ return $this->resize;
}
public function getBasePath(): string
@@ -351,11 +156,6 @@ public function getJsPath(): string
return $this->jsPath;
}
- public function getJqueryPath(): string
- {
- return $this->jqueryPath;
- }
-
public function getDefaultConfig(): ?string
{
return $this->defaultConfig;
diff --git a/src/Config/CKEditorConfigurationInterface.php b/src/Config/CKEditorConfigurationInterface.php
index 30ae790e..67b11336 100644
--- a/src/Config/CKEditorConfigurationInterface.php
+++ b/src/Config/CKEditorConfigurationInterface.php
@@ -16,42 +16,26 @@
interface CKEditorConfigurationInterface
{
- public function getToolbar(string $name): array;
-
- public function getStyles(): array;
-
- public function getPlugins(): array;
-
- public function getTemplates(): array;
-
public function isEnable(): bool;
- public function isAsync(): bool;
-
public function isAutoload(): bool;
- public function isAutoInline(): bool;
-
- public function isInline(): bool;
+ public function isPoweredBy(): bool;
- public function isJquery(): bool;
-
- public function isRequireJs(): bool;
-
- public function isInputSync(): bool;
-
- public function getFilebrowsers(): array;
+ public function isResize(): bool;
public function getBasePath(): string;
public function getJsPath(): string;
- public function getJqueryPath(): string;
-
public function getDefaultConfig(): ?string;
public function getConfigs(): array;
+ public function getPlugins(): array;
+
+ public function getStyles(): array;
+
/**
* @throws ConfigException
*/
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index 47afaeb7..73f0ecff 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -35,23 +35,16 @@ public function getConfigTreeBuilder(): TreeBuilder
$rootNode
->children()
->booleanNode('enable')->defaultTrue()->end()
- ->booleanNode('async')->defaultFalse()->end()
- ->booleanNode('auto_inline')->defaultTrue()->end()
- ->booleanNode('inline')->defaultFalse()->end()
->booleanNode('autoload')->defaultTrue()->end()
- ->booleanNode('jquery')->defaultFalse()->end()
- ->booleanNode('require_js')->defaultFalse()->end()
- ->booleanNode('input_sync')->defaultFalse()->end()
+ ->booleanNode('powered_by')->defaultTrue()->end()
+ ->booleanNode('resize')->defaultTrue()->end()
->scalarNode('base_path')->defaultValue('bundles/fosckeditor/')->end()
->scalarNode('js_path')->defaultValue('bundles/fosckeditor/ckeditor.js')->end()
- ->scalarNode('jquery_path')->defaultValue('bundles/fosckeditor/adapters/jquery.js')->end()
->scalarNode('default_config')->defaultValue(null)->end()
->append($this->createConfigsNode())
->append($this->createPluginsNode())
+// ->append($this->createTemplateNode())
->append($this->createStylesNode())
- ->append($this->createTemplatesNode())
- ->append($this->createFilebrowsersNode())
- ->append($this->createToolbarsNode())
->end();
return $treeBuilder;
@@ -78,75 +71,32 @@ private function createPluginsNode(): ArrayNodeDefinition
->end();
}
+// private function createTemplateNode(): ArrayNodeDefinition
+// {
+// return $this->createPrototypeNode('template')
+// ->arrayPrototype()
+// ->children()
+// ->scalarNode('imagesPath')->end()
+// ->arrayNode('templates')
+// ->arrayPrototype()
+// ->children()
+// ->scalarNode('title')->end()
+// ->scalarNode('image')->end()
+// ->scalarNode('description')->end()
+// ->scalarNode('html')->end()
+// ->scalarNode('template')->end()
+// ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end())
+// ->end()
+// ->end()
+// ->end()
+// ->end()
+// ->end();
+// }
+
private function createStylesNode(): ArrayNodeDefinition
{
return $this->createPrototypeNode('styles')
- ->arrayPrototype()
- ->arrayPrototype()
- ->children()
- ->scalarNode('name')->end()
- ->scalarNode('type')->end()
- ->scalarNode('widget')->end()
- ->variableNode('element')->end()
- ->append($this->createPrototypeNode('styles')->prototype('scalar')->end())
- ->append($this->createPrototypeNode('attributes')->prototype('scalar')->end())
- ->end()
- ->end()
- ->end();
- }
-
- private function createTemplatesNode(): ArrayNodeDefinition
- {
- return $this->createPrototypeNode('templates')
- ->arrayPrototype()
- ->children()
- ->scalarNode('imagesPath')->end()
- ->arrayNode('templates')
- ->arrayPrototype()
- ->children()
- ->scalarNode('title')->end()
- ->scalarNode('image')->end()
- ->scalarNode('description')->end()
- ->scalarNode('html')->end()
- ->scalarNode('template')->end()
- ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end())
- ->end()
- ->end()
- ->end()
- ->end()
- ->end();
- }
-
- private function createFilebrowsersNode(): ArrayNodeDefinition
- {
- $node = $this->createNode('filebrowsers')
- ->useAttributeAsKey('name')
- ->scalarPrototype()
- ->end();
-
- \assert($node instanceof ArrayNodeDefinition);
-
- return $node;
- }
-
- private function createToolbarsNode(): ArrayNodeDefinition
- {
- return $this->createNode('toolbars')
- ->addDefaultsIfNotSet()
- ->children()
- ->arrayNode('configs')
- ->useAttributeAsKey('name')
- ->arrayPrototype()
- ->variablePrototype()->end()
- ->end()
- ->end()
- ->arrayNode('items')
- ->useAttributeAsKey('name')
- ->arrayPrototype()
- ->variablePrototype()->end()
- ->end()
- ->end()
- ->end();
+ ->variablePrototype()->end();
}
private function createPrototypeNode(string $name): ArrayNodeDefinition
diff --git a/src/Form/Type/CKEditorType.php b/src/Form/Type/CKEditorType.php
index d06799b5..5d5d93e7 100644
--- a/src/Form/Type/CKEditorType.php
+++ b/src/Form/Type/CKEditorType.php
@@ -18,7 +18,6 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
-use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@@ -44,22 +43,16 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
return;
}
- $builder->setAttribute('async', $options['async']);
$builder->setAttribute('autoload', $options['autoload']);
- $builder->setAttribute('auto_inline', $options['auto_inline']);
- $builder->setAttribute('inline', $options['inline']);
- $builder->setAttribute('jquery', $options['jquery']);
- $builder->setAttribute('require_js', $options['require_js']);
- $builder->setAttribute('input_sync', $options['input_sync']);
- $builder->setAttribute('filebrowsers', $options['filebrowsers']);
+ $builder->setAttribute('powered_by', $options['powered_by']);
+ $builder->setAttribute('resize', $options['resize']);
$builder->setAttribute('base_path', $options['base_path']);
$builder->setAttribute('js_path', $options['js_path']);
- $builder->setAttribute('jquery_path', $options['jquery_path']);
$builder->setAttribute('config', $this->resolveConfig($options));
$builder->setAttribute('config_name', $options['config_name']);
$builder->setAttribute('plugins', array_merge($this->configuration->getPlugins(), $options['plugins']));
$builder->setAttribute('styles', array_merge($this->configuration->getStyles(), $options['styles']));
- $builder->setAttribute('templates', array_merge($this->configuration->getTemplates(), $options['templates']));
+// $builder->setAttribute('template', array_merge($this->configuration->getTemplate(), $options['template']));
}
private function resolveConfig(array $options): array
@@ -88,22 +81,16 @@ public function buildView(FormView $view, FormInterface $form, array $options):
return;
}
- $view->vars['async'] = $config->getAttribute('async');
$view->vars['autoload'] = $config->getAttribute('autoload');
- $view->vars['auto_inline'] = $config->getAttribute('auto_inline');
- $view->vars['inline'] = $config->getAttribute('inline');
- $view->vars['jquery'] = $config->getAttribute('jquery');
- $view->vars['require_js'] = $config->getAttribute('require_js');
- $view->vars['input_sync'] = $config->getAttribute('input_sync');
- $view->vars['filebrowsers'] = $config->getAttribute('filebrowsers');
+ $view->vars['powered_by'] = $config->getAttribute('powered_by');
+ $view->vars['resize'] = $config->getAttribute('resize');
$view->vars['base_path'] = $config->getAttribute('base_path');
$view->vars['js_path'] = $config->getAttribute('js_path');
- $view->vars['jquery_path'] = $config->getAttribute('jquery_path');
$view->vars['config'] = $config->getAttribute('config');
$view->vars['config_name'] = $config->getAttribute('config_name');
$view->vars['plugins'] = $config->getAttribute('plugins');
$view->vars['styles'] = $config->getAttribute('styles');
- $view->vars['templates'] = $config->getAttribute('templates');
+// $view->vars['template'] = $config->getAttribute('template');
}
public function configureOptions(OptionsResolver $resolver): void
@@ -111,51 +98,37 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver
->setDefaults([
'enable' => $this->configuration->isEnable(),
- 'async' => $this->configuration->isAsync(),
'autoload' => $this->configuration->isAutoload(),
- 'auto_inline' => $this->configuration->isAutoInline(),
- 'inline' => $this->configuration->isInline(),
- 'jquery' => $this->configuration->isJquery(),
- 'require_js' => $this->configuration->isRequireJs(),
- 'input_sync' => $this->configuration->isInputSync(),
- 'filebrowsers' => $this->configuration->getFilebrowsers(),
+ 'powered_by' => $this->configuration->isPoweredBy(),
+ 'resize' => $this->configuration->isResize(),
'base_path' => $this->configuration->getBasePath(),
'js_path' => $this->configuration->getJsPath(),
- 'jquery_path' => $this->configuration->getJqueryPath(),
'config_name' => $this->configuration->getDefaultConfig(),
'config' => [],
'plugins' => [],
'styles' => [],
- 'templates' => [],
+// 'template' => [],
])
->addAllowedTypes('enable', 'bool')
- ->addAllowedTypes('async', 'bool')
->addAllowedTypes('autoload', 'bool')
- ->addAllowedTypes('auto_inline', 'bool')
- ->addAllowedTypes('inline', 'bool')
- ->addAllowedTypes('jquery', 'bool')
- ->addAllowedTypes('require_js', 'bool')
- ->addAllowedTypes('input_sync', 'bool')
- ->addAllowedTypes('filebrowsers', 'array')
+ ->addAllowedTypes('powered_by', 'bool')
+ ->addAllowedTypes('resize', 'bool')
->addAllowedTypes('config_name', ['string', 'null'])
->addAllowedTypes('base_path', 'string')
->addAllowedTypes('js_path', 'string')
- ->addAllowedTypes('jquery_path', 'string')
->addAllowedTypes('config', 'array')
+ ->addAllowedTypes('config_name', ['string', 'null'])
->addAllowedTypes('plugins', 'array')
->addAllowedTypes('styles', 'array')
- ->addAllowedTypes('templates', 'array')
- ->setNormalizer('base_path', function (Options $options, $value) {
- if ('/' !== substr($value, -1)) {
- $value .= '/';
- }
-
- return $value;
- });
+// ->addAllowedTypes('template', 'array')
+ ;
}
public function getParent(): string
{
+ // The only editor type which can be initialized on