有没有办法防止有人使用javascript从CKEDITOR复制文本?



为了防止粘贴到下面的CKEditor中,对我有用。

window.CKEDITOR.instances.PEGACKEDITOR0.on('paste', function(evt){evt.cancel();}) 

同样,有没有办法防止某人使用javascript从CKEditor复制文本?

对于所有文档,您可以尝试以下操作:

<script type="text/javascript"> window.onload = preventing;

function preventing () { 
/* Disable right click on web page  */
document.onclick("contextmenu",function(e){
return false; }); 
/* Disable cut, copy and paste on web page */ 
document.bind('cut copy paste', function (e) {
e.preventDefault(); }); };
</script>

改编自此来源

如果您只需要在 ckedit 区域:

var element = CKEDITOR.document.getById( 'myElement' );
element.on( 'click', function( ev )
{
// The DOM event object is passed by the "data" property.
var domEvent = ev.data;
// Prevent the click to chave any effect in the element.
domEvent.stopPropagation();
})

最新更新