Project

General

Profile

Actions

Bug #88302

closed

CKEditor language plugin not loadable, crash

Added by dermueller no-lastname-given about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2019-05-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Actions #1

Updated by Rémy DANIEL about 5 years ago

I confirm the issue on TYPO3 8.7.24

Actions #2

Updated by Rémy DANIEL about 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.

Actions #3

Updated by Rémy DANIEL about 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.

Actions #4

Updated by Rémy DANIEL about 5 years ago

@dermueller no-lastname-given

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.

Actions #5

Updated by Rémy DANIEL about 5 years ago

I've attached a working patch for TYPO3 8.7. I will submit a review in gerrit soon.

Actions #6

Updated by Gerrit Code Review about 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

Actions #7

Updated by Gerrit Code Review almost 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

Actions #8

Updated by Gerrit Code Review over 4 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

Actions #9

Updated by Gerrit Code Review over 4 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

Actions #10

Updated by Gerrit Code Review over 4 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

Actions #11

Updated by Gerrit Code Review over 4 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

Actions #12

Updated by Gerrit Code Review over 4 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

Actions #13

Updated by Gerrit Code Review over 4 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

Actions #14

Updated by Gerrit Code Review over 4 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

Actions #15

Updated by Gerrit Code Review about 4 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

Actions #16

Updated by Gerrit Code Review about 4 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

Actions #17

Updated by Gerrit Code Review about 4 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

Actions #18

Updated by Benjamin Kott about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #19

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF