CKeditor 中的粘贴选项在 Chrome 和 firefox 中似乎不起作用

Oce*_*jai 4 copy-paste paste ckeditor

使用在线 ckeditor http://sdk.ckeditor.com/samples/classic.html 我看到过去的选项(粘贴、粘贴为纯文本和从 word 粘贴)不会从剪贴板复制。我给出了错误“您的浏览器不允许您以这种方式粘贴纯文本。按 Ctrl+Shift+V 粘贴.' 但它似乎在 IE 中工作(它提示允许访问)而不是在 Chrome 或 Firefox 中。

这是一个错误还是一些需要从浏览器或 ckEditor 完成的配置。因为我记得几个月前我使用了相同的行为,它曾经提供一个弹出窗口将您的内容粘贴到编辑器。

谢谢,维杰

小智 7

只需将此代码添加到 config.js:

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)


Juj*_*ngh 2

Chrome 不允许这样做,因为这是一个安全漏洞。有人可能会窃取您复制的数据,因此 Chrome 和大多数其他浏览器不允许您这样做。按 ctrl、shift 和 v 进行粘贴。