Skip to content

Commit

Permalink
IBX-769: Reorder and hide for CKEditor toolbar groups and buttons, Cu…
Browse files Browse the repository at this point in the history
…stomStyleInline button support (#203)

IBX-769: Extensibility for Online Editor

https://issues.ibexa.co/browse/IBX-769
Co-authored-by: Dariusz Szut
  • Loading branch information
damianz5 authored Oct 13, 2021
1 parent 70028bc commit bac7c8e
Show file tree
Hide file tree
Showing 7 changed files with 685 additions and 365 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class RichText extends AbstractFieldTypeParser
private const ATTRIBUTE_TYPE_STRING = 'string';
private const ATTRIBUTE_TYPE_NUMBER = 'number';

private const TOOLBARS_NODE_KEY = 'toolbars';
public const TOOLBARS_SA_SETTINGS_ID = 'fieldtypes.ezrichtext.' . self::TOOLBARS_NODE_KEY;
private const TOOLBAR_NODE_KEY = 'toolbar';
public const TOOLBARS_SA_SETTINGS_ID = 'fieldtypes.ezrichtext.' . self::TOOLBAR_NODE_KEY;

// constants common for OE custom classes and data attributes configuration
private const ELEMENT_NODE_KEY = 'element';
Expand Down Expand Up @@ -193,11 +193,19 @@ public function addFieldTypeSemanticConfig(NodeBuilder $nodeBuilder)

// RichText Toolbars configuration (defines list of Toolbars and Buttons enabled for current SiteAccess scope)
$nodeBuilder
->arrayNode(self::TOOLBARS_NODE_KEY)
->useAttributeAsKey('name')
->info('List of Toolbars and Buttons enabled for current SiteAccess scope.')
->arrayNode(self::TOOLBAR_NODE_KEY)
->useAttributeAsKey('group_name')
->info('List of grouped Toolbars and Buttons enabled for current SiteAccess scope.')
->prototype('array')
->children()
->booleanNode('visible')
->info('Is group visible on toolbar?')
->defaultTrue()
->end()
->integerNode('priority')
->info('Defines order in which group appear (255 .. -255).')
->defaultValue(0)
->end()
->arrayNode('buttons')
->useAttributeAsKey('name')
->prototype('array')
Expand Down Expand Up @@ -265,7 +273,7 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn
$onlineEditorSettingsMap = [
self::CLASSES_NODE_KEY => self::CLASSES_SA_SETTINGS_ID,
self::ATTRIBUTES_NODE_KEY => self::ATTRIBUTES_SA_SETTINGS_ID,
self::TOOLBARS_NODE_KEY => self::TOOLBARS_SA_SETTINGS_ID,
self::TOOLBAR_NODE_KEY => self::TOOLBARS_SA_SETTINGS_ID,
];
foreach ($onlineEditorSettingsMap as $key => $settingsId) {
if (isset($scopeSettings['fieldtypes']['ezrichtext'][$key])) {
Expand Down
4 changes: 4 additions & 0 deletions src/bundle/Resources/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ services:
arguments:
$alloyEditorConfiguration: '%ezplatform.ezrichtext.alloy_editor%'

EzSystems\EzPlatformRichText\Configuration\Provider\CKEditor:
arguments:
$customStylesConfiguration: '%ezplatform.ezrichtext.custom_styles%'

EzSystems\EzPlatformRichText\Configuration\AggregateProvider:
arguments:
$providers: !tagged ezplatform.ezrichtext.configuration.provider
Loading

0 comments on commit bac7c8e

Please sign in to comment.