添加 Ckeditor 的 wordcount 插件后禁用复制和粘贴

Disabled copy and paste after adding wordcount plugin of Ckeditor

我正在使用 ckeditorwordcount 插件进行字数统计。作为这个插件的要求,我添加了插件'notification'。我的问题是在添加通知插件后 禁用按键复制和粘贴。我的控制台出现以下错误: 注意:字数显示正确。

Uncaught TypeError: CKEDITOR.tools.getUniqueId is not a function Notification @ plugin.js?t=E4KA:121 (anonymous function) @ plugin.js?t=E4KA:360 i @ ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire @ ckeditor.js:12 CKEDITOR.editor.CKEDITOR.editor.fire @ ckeditor.js:13 f @ ckeditor.js:594 (anonymous function) @ ckeditor.js:599 (anonymous function) @ ckeditor.js:598

我添加字数统计和其他插件的代码如下:

CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.config.extraPlugins = 'htmlwriter';
CKEDITOR.config.extraPlugins = 'notification';
CKEDITOR.config.extraPlugins = 'wordcount';
CKEDITOR.config.wordcount = {
        showParagraphs: true,
        showWordCount: true,
        countSpacesAsChars: false,
        countHTML: false,
        maxWordCount: 10
};

有什么地方我做错了吗? 请帮帮我。任何帮助将不胜感激。

我遇到了同样的问题。似乎通知插件不适用于低于 4.5 的 CKEditor 版本。所以你需要升级CKEditor。您可以在网站上再次构建 CKEditor 包,并将您现在需要的新插件添加到您之前的构建配置中 - wordcount 和通知。

首先,转换这个`

CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.config.extraPlugins = 'htmlwriter';
CKEDITOR.config.extraPlugins = 'notification';
CKEDITOR.config.extraPlugins = 'wordcount';

到这个`

CKEDITOR.config.extraPlugins = 'toolbar,htmlwriter,notification,wordcount';

因为您正在覆盖变量 CKEDITOR.config.extraPlugins