为防止粘贴到下面的CKEditor对我有用。
window.CKEDITOR.instances.PEGACKEDITOR0.on('paste', function(evt){evt.cancel();})
类似地,有什么方法可以防止某人使用JavaScript从CKEditor复制文本?
答案 0 :(得分:0)
对于所有文档,您都可以尝试以下操作:
<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();
})