您的浏览器不支持使用工具栏按钮或上下文菜单选项进行粘贴

Shu*_*ada 5 html textarea rich-text-editor ckeditor bootstrap-4

大家好,你们好吗?我将使用 CKEDITOR 代码添加文本编辑器栏,一切都运行良好,但问题是,当我单击编辑器复制和过去按钮时,它会给我错误,例如

\n
\n

按 Ctrl+V 进行粘贴。您的浏览器不支持使用工具栏按钮或上下文菜单选项进行粘贴。

\n

按 Ctrl+Shift+V 进行粘贴。您的浏览器不支持使用工具栏按钮或上下文菜单选项进行粘贴。

\n

按 Ctrl+V 进行粘贴。您的浏览器不支持使用工具栏按钮或上下文菜单选项进行粘贴。

\n
\n

谁能告诉我我可以做什么来解决这个错误,当我单击文本编辑器按钮时它开始工作,最后我想在图片中向您展示错误,所以下面的图片可能是您的错误看到错误图片就很容易理解

\n

我的问题的错误图片

\n
<!DOCTYPE html>\n<html>\n<head>\n    <meta charset="utf-8">\n    <title>Editor Example</title>\n    <script src="https://cdn.ckeditor.com/4.10.1/standard/ckeditor.js"></script>\n</head>\n<body>\n    <textarea name="text_editor"></textarea>\n    <script>\n        CKEDITOR.replace( \'text_editor\' );\n    </script>\n</body>\n
Run Code Online (Sandbox Code Playgroud)\n\n

小智 10

试试这个代码

CKEDITOR.on("instanceReady", function(event) {
    event.editor.on("beforeCommandExec", function(event) {
        // Show the paste dialog for the paste buttons and right-click paste
        if (event.data.name == "paste") {
            event.editor._.forcePasteDialog = true;
        }
        // Don't show the paste dialog for Ctrl+Shift+V
        if (event.data.name == "pastetext" && event.data.commandData.from == "keystrokeHandler") {
            event.cancel();
        }
    })
});
Run Code Online (Sandbox Code Playgroud)

  • 这个答案需要更多解释。为什么这是必要的?CKEditor 是否有错误? (2认同)