Skip to content

Commit 2e2db5b

Browse files
committed
[TASK] Add default presets for RTE
For usage of the `DeepL Write` optimization feature it is required overriding the default RTE presets ensuring direct usage of the feature within RTE editors without changing the defaults. Used Commands: ``` Build/Scripts/runTests.sh -t 12 -p 8.1 -s composer -- --dev require \ "typo3/cms-rte-ckeditor":"^12.4 || ^13.4" Build/Scripts/runTests.sh -t 12 -p 8.1 -s composer -- config \ suggest.typo3/cms-rte-ckeditor "Allows Additional RTE feature \ optimizing text" ```
1 parent 15d42d0 commit 2e2db5b

6 files changed

Lines changed: 139 additions & 4 deletions

File tree

Configuration/RTE/Default.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
editor:
2+
config:
3+
importModules:
4+
- { module: '@web-vision/deepl-write/deeplwrite-plugin.js', exports: [ 'Deeplwrite' ] }
5+
toolbar:
6+
items:
7+
- style
8+
- heading
9+
# grouping separator
10+
- '|'
11+
- bold
12+
- italic
13+
- subscript
14+
- superscript
15+
- softhyphen
16+
- '|'
17+
- bulletedList
18+
- numberedList
19+
- blockQuote
20+
- alignment
21+
- '|'
22+
- findAndReplace
23+
- link
24+
- '|'
25+
- removeFormat
26+
- undo
27+
- redo
28+
- '|'
29+
- insertTable
30+
- '|'
31+
- specialCharacters
32+
- horizontalLine
33+
- sourceEditing
34+
- '|'
35+
- deeplwrite
36+
imports:
37+
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Default.yaml' }

Configuration/RTE/Full.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
imports:
2+
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Full.yaml' }
3+
4+
editor:
5+
config:
6+
importModules:
7+
- { module: '@web-vision/deepl-write/deeplwrite-plugin.js', exports: [ 'Deeplwrite' ] }
8+
toolbar:
9+
items:
10+
- removeFormat
11+
- undo
12+
- redo
13+
# grouping separator
14+
- '|'
15+
- findAndReplace
16+
- link
17+
- '|'
18+
- insertTable
19+
- tableColumn
20+
- tableRow
21+
- mergeTableCells
22+
- TableProperties
23+
- TableCellProperties
24+
- '|'
25+
- selectAll
26+
- '|'
27+
- sourceEditing
28+
- showBlocks
29+
- horizontalLine
30+
# line break
31+
- '-'
32+
- bold
33+
- italic
34+
- underline
35+
- strikethrough
36+
- subscript
37+
- superscript
38+
- softhyphen
39+
- '|'
40+
- bulletedList
41+
- numberedList
42+
- blockQuote
43+
- indent
44+
- outdent
45+
- alignment
46+
- '|'
47+
- specialCharacters
48+
- '-'
49+
- style
50+
- heading
51+
- fontFamily
52+
- fontBackgroundColor
53+
- fontColor
54+
- fontSize
55+
- textPartLanguage
56+
- highlight
57+
- highlight:greenMarker
58+
- '|'
59+
- deeplwrite

Configuration/RTE/Minimal.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
imports:
2+
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Minimal.yaml' }
3+
4+
editor:
5+
config:
6+
importModules:
7+
- { module: '@web-vision/deepl-write/deeplwrite-plugin.js', exports: [ 'Deeplwrite' ] }
8+
toolbar:
9+
items:
10+
- bold
11+
- italic
12+
- '|'
13+
- clipboard
14+
- undo
15+
- redo
16+
- '|'
17+
- deeplwrite

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"phpstan/phpstan": "^1.10",
1717
"phpunit/phpunit": "^10.5",
1818
"saschaegerer/phpstan-typo3": "^1.9",
19+
"typo3/cms-rte-ckeditor": "^12.4 || ^13.4",
1920
"typo3/testing-framework": "^8.2.7"
2021
},
2122
"license": "GPL-2.0-or-later",
@@ -60,6 +61,7 @@
6061
}
6162
},
6263
"suggest": {
63-
"web-vision/deepltranslate-core": "*"
64+
"web-vision/deepltranslate-core": "*",
65+
"typo3/cms-rte-ckeditor": "Allows Additional RTE feature optimizing text"
6466
}
6567
}

ext_emconf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'install' => '*',
2525
'enable_translated_content' => '*',
2626
'deepltranslate_core' => '*',
27+
'rte_ckeditor' => '12.4.0-13.4.99',
2728
],
2829
],
2930
];

ext_localconf.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,28 @@
66
(static function (): void {
77
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['deeplWrite'] =
88
WriteHook::class;
9-
10-
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['deeplwrite']
11-
= 'EXT:deepl_write/Configuration/RTE/DeeplWritePreset.yaml';
9+
// Register the presets
10+
// override default presets from EXT:rte_ckeditor
11+
// by using them as import and add `deeplwrite`
12+
// respect overrides by other extensions beside EXT:rte_ckeditor
13+
if (
14+
empty($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'])
15+
|| $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] === 'EXT:rte_ckeditor/Configuration/RTE/Default.yaml'
16+
) {
17+
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] = 'EXT:deepl_write/Configuration/RTE/Default.yaml';
18+
}
19+
if (
20+
empty($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['minimal'])
21+
|| $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['minimal'] === 'EXT:rte_ckeditor/Configuration/RTE/Minimal.yaml'
22+
) {
23+
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['minimal'] = 'EXT:deepl_write/Configuration/RTE/Minimal.yaml';
24+
}
25+
if (
26+
empty($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['full'])
27+
|| $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['full'] === 'EXT:rte_ckeditor/Configuration/RTE/Full.yaml'
28+
) {
29+
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['full'] = 'EXT:deepl_write/Configuration/RTE/Full.yaml';
30+
}
1231

1332
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][1750182029]
1433
= PageRendererHook::class . '->renderPreProcess';

0 commit comments

Comments
 (0)