Skip to content

Commit 07015d6

Browse files
committed
[BUGFIX] Make ckeditor config v12 and v13 compatible
1 parent da3eb44 commit 07015d6

File tree

12 files changed

+136
-229
lines changed

12 files changed

+136
-229
lines changed

Classes/EventListener/RteConfigEnhancer.php

+109-4
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,124 @@
99

1010
namespace BK2K\Syntax\EventListener;
1111

12-
use TYPO3\CMS\RteCKEditor\Form\Element\Event\BeforeGetExternalPluginsEvent;
1312
use TYPO3\CMS\RteCKEditor\Form\Element\Event\BeforePrepareConfigurationForEditorEvent;
1413

1514
class RteConfigEnhancer
1615
{
1716
public function beforePrepareConfiguration(BeforePrepareConfigurationForEditorEvent $event): void
1817
{
1918
$configuration = $event->getConfiguration();
19+
$configuration['toolbar']['items'][] = 'codeBlock';
2020
$configuration['importModules'][] = [
21-
'module' => '@bk2k/syntax/ckeditor5/plugin/syntax.js',
21+
'module' => '@ckeditor/ckeditor5-code-block',
2222
'exports' => [
23-
'Syntax'
24-
]
23+
'CodeBlock',
24+
],
25+
];
26+
27+
$configuration['codeBlock'] = [
28+
'languages' => [
29+
[
30+
'label' => 'Plain Text',
31+
'language' => 'plaintext',
32+
'class' => '',
33+
],
34+
[
35+
'label' => 'Apache Configuration',
36+
'language' => 'apacheconf',
37+
'class' => 'language-apacheconf',
38+
],
39+
[
40+
'label' => 'C-like',
41+
'language' => 'clike',
42+
'class' => 'language-clike',
43+
],
44+
[
45+
'label' => 'CSS',
46+
'language' => 'css',
47+
'class' => 'language-css',
48+
],
49+
[
50+
'label' => 'Git',
51+
'language' => 'git',
52+
'class' => 'language-git',
53+
],
54+
[
55+
'label' => 'HTML',
56+
'language' => 'html',
57+
'class' => 'language-html',
58+
],
59+
[
60+
'label' => 'JavaScript',
61+
'language' => 'javascript',
62+
'class' => 'language-javascript',
63+
],
64+
[
65+
'label' => 'JSON',
66+
'language' => 'json',
67+
'class' => 'language-json',
68+
],
69+
[
70+
'label' => 'Markup',
71+
'language' => 'markup',
72+
'class' => 'language-markup',
73+
],
74+
[
75+
'label' => 'Less',
76+
'language' => 'less',
77+
'class' => 'language-less',
78+
],
79+
[
80+
'label' => 'Markdown',
81+
'language' => 'markdown',
82+
'class' => 'language-markdown',
83+
],
84+
[
85+
'label' => 'MathML',
86+
'language' => 'mathml',
87+
'class' => 'language-mathml',
88+
],
89+
[
90+
'label' => 'nginx',
91+
'language' => 'nginx',
92+
'class' => 'language-nginx',
93+
],
94+
[
95+
'label' => 'PHP',
96+
'language' => 'php',
97+
'class' => 'language-php',
98+
],
99+
[
100+
'label' => 'Sass',
101+
'language' => 'sass',
102+
'class' => 'language-sass',
103+
],
104+
[
105+
'label' => 'Scss',
106+
'language' => 'scss',
107+
'class' => 'language-scss',
108+
],
109+
[
110+
'label' => 'SVG',
111+
'language' => 'svg',
112+
'class' => 'language-svg',
113+
],
114+
[
115+
'label' => 'TypoScript',
116+
'language' => 'typoscript',
117+
'class' => 'language-typoscript',
118+
],
119+
[
120+
'label' => 'XML',
121+
'language' => 'xml',
122+
'class' => 'language-xml',
123+
],
124+
[
125+
'label' => 'YAML',
126+
'language' => 'yaml',
127+
'class' => 'language-yaml',
128+
],
129+
],
25130
];
26131

27132
$event->setConfiguration($configuration);

Configuration/JavaScriptModules.php

-20
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
categories:
2+
Syntax:
3+
label: 'Syntax'
4+
5+
settings:
6+
7+
plugin.tx_syntax.settings.theme:
8+
label: 'Theme'
9+
category: Syntax
10+
type: string
11+
enum:
12+
'': 'Default'
13+
'-coy': 'Coy'
14+
'-dark': 'Dark'
15+
'-funky': 'Funky'
16+
'-okaidia': 'Okaidia'
17+
'-solarizedlight': 'Solarized Light'
18+
'-tomorrow': 'Tomorrow'
19+
'-twilight': 'Twilight'
20+
default: ''
21+
22+
plugin.tx_syntax.settings.plugins.linenumbers:
23+
label: 'Enable line numbers'
24+
category: Syntax
25+
type: bool
26+
default: true

Configuration/TCA/Overrides/200_content_element_syntax.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
'renderType' => 'selectSingle',
7272
'items' => [
7373
[
74-
'label' => 'None',
74+
'label' => 'Plain Text',
7575
'value' => 'none',
7676
],
7777
[

Resources/Public/CKEditor/Plugins/Code/dialogs/code.js

-88
This file was deleted.
Binary file not shown.
Binary file not shown.

Resources/Public/CKEditor/Plugins/Code/lang/de.js

-3
This file was deleted.

Resources/Public/CKEditor/Plugins/Code/lang/en.js

-3
This file was deleted.

Resources/Public/CKEditor/Plugins/Code/plugin.js

-72
This file was deleted.

Resources/Public/CKEditor/Plugins/Code/styles/code.css

-6
This file was deleted.

Resources/Public/JavaScript/ckeditor5/plugin/syntax.js

-32
This file was deleted.

0 commit comments

Comments
 (0)