0

我的源代码:

var oEditor = CKEDITOR.instances.wiki__text;
var bookmark =     oEditor.getSelection().createBookmarks2(); // first bookmark
var html = '<'+b+' id="id_'+AInc+'">'+AInc+'</'+b+'>';
var newElement = CKEDITOR.dom.element.createFromHtml( html, oEditor.document );
oEditor.insertElement( newElement );
var bookmark2 = oEditor.getSelection().createBookmarks2(); // second bookmark
console.log('bm: ',bookmarks);
oEditor.getSelection().selectBookmarks( bookmark );

如果我使用first bookmark光标跳转到 newElement 之前的位置,但我想拥有 newElement 之后的位置。但是如果我使用second bookmark我会得到这个错误: Uncaught TypeError: Cannot read property 'type' of null在一些 ckeditor.js 文件中

知道如何在 newElement 之后获取光标位置吗?

4

1 回答 1

1

解决方案很小true

var bookmark2 = oEditor.getSelection().createBookmarks2(true); // second bookmark
于 2013-10-12T13:46:01.463 回答