简体   繁体   中英

Ckeditor cursor style

I need to change the style of cursor to "pointer" when editor is on readonly mode I tried two solutions:

  1. Changing text style

     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"); 

First one worked when cursor on the text.

Second one changed the cursor in all page except the Editor.

i just found the answer

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM