2017-07-11 71 views
0

我需要光標的樣式改變爲「指針」時,編輯器是隻讀模式我嘗試了兩種解決方案:CKEDITOR光標樣式

  1. 更改文本樣式

    CKEDITOR.instances.editor1.on('contentDom', function() { 
    CKEDITOR.instances.editor1.editable().attachListener( 
    CKEDITOR.instances.editor1.editable(), 'mouseover', function(evt) { 
        if (evt.data.getTarget().is('p')) 
    {evt.data.getTarget().setAttributes ({'style':"cursor:pointer "}) 
    ;}//cursor:pointer 
    
    }); 
    CKEDITOR.instances.editor1.editable().attachListener( 
    CKEDITOR.instances.editor1.editable(), 'mouseout', function(evt) { 
         if (evt.data.getTarget().is('p')) 
    {evt.data.getTarget().setAttributes ({'style':"cursor:pointer"}) ;}   
    }); 
    }); 
    
  2. CKEDITOR.document.getDocumentElement().setStyle("cursor","pointer"); 
    

第一個光標在文本上工作。

第二個改變了除編輯器以外的所有頁面中的光標。

回答

0

我只是找到了答案

var node = CKEDITOR.instances.editor1.document.getBody(); 
var parent = node.getParent(); 
parent.setStyle("cursor","pointer");