Ckeditor光标样式
Ckeditor cursor style
当编辑器处于只读模式时,我需要将光标的样式更改为 "pointer" 我尝试了两种解决方案:
更改文本样式
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"} ) ;}
});
});
CKEDITOR.document.getDocumentElement().setStyle("cursor","pointer");
当光标在文本上时,第一个有效。
第二个更改了除编辑器以外的所有页面中的光标。
我刚找到答案
var node = CKEDITOR.instances.editor1.document.getBody();
var parent = node.getParent();
parent.setStyle("cursor","pointer");
当编辑器处于只读模式时,我需要将光标的样式更改为 "pointer" 我尝试了两种解决方案:
更改文本样式
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"} ) ;} }); });
CKEDITOR.document.getDocumentElement().setStyle("cursor","pointer");
当光标在文本上时,第一个有效。
第二个更改了除编辑器以外的所有页面中的光标。
我刚找到答案
var node = CKEDITOR.instances.editor1.document.getBody();
var parent = node.getParent();
parent.setStyle("cursor","pointer");