Bug #88302
closedCKEditor language plugin not loadable, crash
100%
Description
I use TYPO3 version 8.7.25. My YAML configuration file for CKEditor works fine in general, so there is no problem with not accepting my configuration in general. But:
editor: externalPlugins: language: { resource: "EXT:rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/language/" }
This crashes the RTE.
Browser console says: "TypeError: e.toLowerCase is not a function > ckeditor.js:244:345"
The results of my investigation so far:
sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/ckeditor.js has this method:
load:function(a,e,b){a&&CKEDITOR.lang.languages[a]||(a=this.detect(e,a));
if "a" is not present, the detect method is executed:
detect:function(a,e){var b=this.languages;e=e||navigator.userLanguage||navigator.language||a;var c=e.toLowerCase()...
This variable "a" is "languageCode" in the original code from https://github.com/ckeditor/ckeditor-dev/blob/major/core/lang.js
So, back to sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/ckeditor.js, we find
CKEDITOR.lang.load(a.config.language
But config.language is empty. Setting this in YAML has no effect:
editor: config: language: "de"
The only thing that works is manipulation of ckeditor.js itself, by chaning the line above to (and thus skipping detection):
load:function(a,e,b){a&&CKEDITOR.lang.languages[a]||(a="de");
Files
Updated by Rémy DANIEL over 5 years ago
It is because the name of the external plugin (here "language") overrides the config.language setting.
Renaming the plugin is not possible because CKEditor needs to load it with this hardcoded "language" name.
This problem was introduced by https://forge.typo3.org/issues/81263 and the merging of the externalPlugins config with the main configuration.
Updated by Rémy DANIEL over 5 years ago
So TYPO3 is doing wrong with plugins configuration, because editor's config can be overwritten by the plugin config.
TYPO3 is doing this way for passing config defined in the yaml file to the JS plugins.
I will submit a patch to prevent this.
Updated by Rémy DANIEL over 5 years ago
By the way, the "language" plugin is a core plugin of CKeditor, you do not need to add it manually.
You just need this yaml config:
editor: config: extraPlugins: - language language_list: - fr:Français - en:English
Also, the toolbar "bidi" needs to be present somewhere in "editor.config.toolbarGroups" because the language plugin adds its buttons in this toolbar.
Updated by Rémy DANIEL over 5 years ago
I've attached a working patch for TYPO3 8.7. I will submit a review in gerrit soon.
Updated by Gerrit Code Review over 5 years ago
- Status changed from New to Under Review
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60816
Updated by Gerrit Code Review over 5 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60816
Updated by Gerrit Code Review about 5 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review about 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review about 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review about 5 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review about 5 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review almost 5 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review almost 5 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review almost 5 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63004
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63891
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63892
Updated by Benjamin Kott almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 06188d7fbbed95a9e0c36f88263059f430e7f3bf.
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed