首页 > 解决方案 > 您的浏览器不支持使用工具栏按钮或上下文菜单选项进行粘贴

问题描述

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

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

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

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

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

我的问题的错误图片

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

标签: htmlbootstrap-4ckeditortextarearich-text-editor

解决方案


试试这个代码

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();
        }
    })
});

推荐阅读