Skip to content

Commit 6656b4d

Browse files
committed
fixed #1 rewrite the configuration to neos frontend configuration BREAKING
1 parent 822eb62 commit 6656b4d

File tree

8 files changed

+34156
-2734
lines changed

8 files changed

+34156
-2734
lines changed

Classes/Controller/CkeditorConfigurationController.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

Configuration/Policy.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

Configuration/Routes.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Configuration/Settings.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,3 @@ Neos:
55
javascript:
66
'Breadlesscode.SimpleEditorExtend:UiPlugin':
77
resource: resource://Breadlesscode.SimpleEditorExtend/Public/UiPlugin/Plugin.js
8-
Flow:
9-
mvc:
10-
routes:
11-
'Breadlesscode.SimpleEditorExtend':
12-
position: 'start'

README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,31 @@ The --no-update command prevent the automatic update of the dependencies. After
1818
## Example configuration
1919

2020
```yaml
21-
Breadlesscode:
22-
SimpleEditorExtend:
23-
buttons:
24-
'Test.Test:MyCustomSpan':
25-
extensionName: 'exampleExtension'
26-
icon: 'plus-square'
27-
tooltip: 'Mark the text in color green'
28-
position: 'before strong'
29-
formatting:
30-
tag: 'span'
31-
classes: 'test-class'
32-
styles:
33-
background-color: 'green'
34-
'Test.Test:MyCustomSpan2':
35-
extensionName: 'exampleExtension2'
36-
icon: 'rocket'
37-
tooltip: 'Mark the text in color red'
38-
position: 'before exampleExtension'
39-
formatting:
40-
tag: 'span'
41-
classes: 'test-class-2'
42-
styles:
43-
background-color: 'red'
21+
Neos:
22+
Neos:
23+
Ui:
24+
frontendConfiguration:
25+
'Breadlesscode.SimpleEditorExtend:Buttons':
26+
'Test.Test:MyCustomSpan':
27+
extensionName: 'exampleExtension'
28+
icon: 'plus-square'
29+
tooltip: 'Mark the text in color green'
30+
position: 'before strong'
31+
formatting:
32+
tag: 'span'
33+
classes: 'test-class'
34+
styles:
35+
background-color: 'green'
36+
'Test.Test:MyCustomSpan2':
37+
extensionName: 'exampleExtension2'
38+
icon: 'rocket'
39+
tooltip: 'Mark the text in color red'
40+
position: 'before exampleExtension'
41+
formatting:
42+
tag: 'span'
43+
classes: 'test-class-2'
44+
styles:
45+
background-color: 'red'
4446
```
4547
4648
Now you can use your new formattings like this:

Resources/Private/UiPlugin/src/manifest.js

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,27 @@ import manifest from '@neos-project/neos-ui-extensibility';
22
import {getCkeditorPlugin, getCkeditorPluginConfig, getRichtextToolbarConfig} from './CkeditorPluginUtils';
33
import backend from '@neos-project/neos-ui-backend-connector';
44

5-
manifest('Breadlesscode.SimpleEditorExtend:UiPlugin', {}, globalRegistry => {
5+
manifest('Breadlesscode.SimpleEditorExtend:UiPlugin', {}, (globalRegistry, { frontendConfiguration }) => {
66
const richtextToolbar = globalRegistry.get('ckEditor5').get('richtextToolbar');
7-
const config = globalRegistry.get('ckEditor5').get('config');
8-
const { getJsonResource } = backend.get().endpoints;
9-
const configUri = '/breadlesscode/editor-config';
7+
const ckEditorConfig = globalRegistry.get('ckEditor5').get('config');
8+
const buttonConfig = frontendConfiguration['Breadlesscode.SimpleEditorExtend:Buttons'];
109

11-
getJsonResource(configUri).then((buttonConfig) => {
12-
Object.keys(buttonConfig).forEach((formattingName) => {
13-
const options = buttonConfig[formattingName];
14-
const commandName = options.extensionName + 'Command';
10+
Object.keys(buttonConfig).forEach((formattingName) => {
11+
const options = buttonConfig[formattingName];
12+
const commandName = options.extensionName + 'Command';
1513

16-
richtextToolbar.set(
17-
options.extensionName,
18-
getRichtextToolbarConfig(commandName, formattingName, options.icon, options.tooltip),
19-
options.position
20-
);
21-
22-
config.set(
23-
options.extensionName,
24-
getCkeditorPluginConfig(
25-
formattingName,
26-
getCkeditorPlugin(options.extensionName, commandName, options.formatting)
27-
)
28-
);
29-
});
14+
richtextToolbar.set(
15+
options.extensionName,
16+
getRichtextToolbarConfig(commandName, formattingName, options.icon, options.tooltip),
17+
options.position
18+
);
19+
20+
ckEditorConfig.set(
21+
options.extensionName,
22+
getCkeditorPluginConfig(
23+
formattingName,
24+
getCkeditorPlugin(options.extensionName, commandName, options.formatting)
25+
)
26+
);
3027
});
3128
});

0 commit comments

Comments
 (0)