I'm including the wordcount plugin to CKEditor in D8. I'm including some configuration (maxWordCount
) through the configurable interface. The issue I'm having is that no matter what I return from getConfig
there's no affect on the editor.
class WordCount extends CKEditorPluginBase implements CKEditorPluginContextualInterface {
public function isEnabled(Editor $editor) {
return TRUE;
}
public function isInternal() {
return FALSE;
}
public function getFile() {
return drupal_get_path('module', 'ckeditor_maxlength') . '/wordcount/plugin.js';
}
public function getConfig(Editor $editor) {
// just return a hardcoded maxWordCount.
return [
'maxWordCount' => 10,
];
}
public function getButtons() {
// No buttons needed.
}
}
To be clear the counter works as expected, but I don't seem to be able to override the default configuration.
Inside the core ckeditor module the getConfig
function has this notation:
* @return array
* A keyed array, whose keys will end up as keys under CKEDITOR.config.
When I inspect CKEditor.config
in the console I don't see the configurations, and infact, the wordcount
plugin is buried in CKEditor.plugins.externals
.