Skip to content

Commit

Permalink
[BUGFIX] Make ckeditor config v12 and v13 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Oct 16, 2024
1 parent da3eb44 commit 07015d6
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 229 deletions.
113 changes: 109 additions & 4 deletions Classes/EventListener/RteConfigEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,124 @@

namespace BK2K\Syntax\EventListener;

use TYPO3\CMS\RteCKEditor\Form\Element\Event\BeforeGetExternalPluginsEvent;
use TYPO3\CMS\RteCKEditor\Form\Element\Event\BeforePrepareConfigurationForEditorEvent;

class RteConfigEnhancer
{
public function beforePrepareConfiguration(BeforePrepareConfigurationForEditorEvent $event): void
{
$configuration = $event->getConfiguration();
$configuration['toolbar']['items'][] = 'codeBlock';
$configuration['importModules'][] = [
'module' => '@bk2k/syntax/ckeditor5/plugin/syntax.js',
'module' => '@ckeditor/ckeditor5-code-block',
'exports' => [
'Syntax'
]
'CodeBlock',
],
];

$configuration['codeBlock'] = [
'languages' => [
[
'label' => 'Plain Text',
'language' => 'plaintext',
'class' => '',
],
[
'label' => 'Apache Configuration',
'language' => 'apacheconf',
'class' => 'language-apacheconf',
],
[
'label' => 'C-like',
'language' => 'clike',
'class' => 'language-clike',
],
[
'label' => 'CSS',
'language' => 'css',
'class' => 'language-css',
],
[
'label' => 'Git',
'language' => 'git',
'class' => 'language-git',
],
[
'label' => 'HTML',
'language' => 'html',
'class' => 'language-html',
],
[
'label' => 'JavaScript',
'language' => 'javascript',
'class' => 'language-javascript',
],
[
'label' => 'JSON',
'language' => 'json',
'class' => 'language-json',
],
[
'label' => 'Markup',
'language' => 'markup',
'class' => 'language-markup',
],
[
'label' => 'Less',
'language' => 'less',
'class' => 'language-less',
],
[
'label' => 'Markdown',
'language' => 'markdown',
'class' => 'language-markdown',
],
[
'label' => 'MathML',
'language' => 'mathml',
'class' => 'language-mathml',
],
[
'label' => 'nginx',
'language' => 'nginx',
'class' => 'language-nginx',
],
[
'label' => 'PHP',
'language' => 'php',
'class' => 'language-php',
],
[
'label' => 'Sass',
'language' => 'sass',
'class' => 'language-sass',
],
[
'label' => 'Scss',
'language' => 'scss',
'class' => 'language-scss',
],
[
'label' => 'SVG',
'language' => 'svg',
'class' => 'language-svg',
],
[
'label' => 'TypoScript',
'language' => 'typoscript',
'class' => 'language-typoscript',
],
[
'label' => 'XML',
'language' => 'xml',
'class' => 'language-xml',
],
[
'label' => 'YAML',
'language' => 'yaml',
'class' => 'language-yaml',
],
],
];

$event->setConfiguration($configuration);
Expand Down
20 changes: 0 additions & 20 deletions Configuration/JavaScriptModules.php

This file was deleted.

26 changes: 26 additions & 0 deletions Configuration/Sets/Base/settings.definitions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
categories:
Syntax:
label: 'Syntax'

settings:

plugin.tx_syntax.settings.theme:
label: 'Theme'
category: Syntax
type: string
enum:
'': 'Default'
'-coy': 'Coy'
'-dark': 'Dark'
'-funky': 'Funky'
'-okaidia': 'Okaidia'
'-solarizedlight': 'Solarized Light'
'-tomorrow': 'Tomorrow'
'-twilight': 'Twilight'
default: ''

plugin.tx_syntax.settings.plugins.linenumbers:
label: 'Enable line numbers'
category: Syntax
type: bool
default: true
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/200_content_element_syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
'renderType' => 'selectSingle',
'items' => [
[
'label' => 'None',
'label' => 'Plain Text',
'value' => 'none',
],
[
Expand Down
88 changes: 0 additions & 88 deletions Resources/Public/CKEditor/Plugins/Code/dialogs/code.js

This file was deleted.

Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions Resources/Public/CKEditor/Plugins/Code/lang/de.js

This file was deleted.

3 changes: 0 additions & 3 deletions Resources/Public/CKEditor/Plugins/Code/lang/en.js

This file was deleted.

72 changes: 0 additions & 72 deletions Resources/Public/CKEditor/Plugins/Code/plugin.js

This file was deleted.

6 changes: 0 additions & 6 deletions Resources/Public/CKEditor/Plugins/Code/styles/code.css

This file was deleted.

32 changes: 0 additions & 32 deletions Resources/Public/JavaScript/ckeditor5/plugin/syntax.js

This file was deleted.

0 comments on commit 07015d6

Please sign in to comment.