开发者

ckeditor scrollIntoView to a div element within the editor

开发者 https://www.devze.com 2022-12-18 13:01 出处:网络
I have a navigation menu out side ckeditor and i want to navigate within the editor as all my el开发者_运维知识库ement in editor have ids

I have a navigation menu out side ckeditor and i want to navigate within the editor as all my el开发者_运维知识库ement in editor have ids

scrollIntoView

how does this work

any example will be good


The information in this question (asked by myself some months ago) should get you started. The accepted answer outlines how to access elements inside the CKEditor document programmatically from JQUery.

It should be possible to fetch the desired element, and do a ScrollIntoView based on that.

This might already work (untested):

var documentWrapper = editorname.document; // replace by your CKEDitor instance ID
var documentNode = documentWrapper.$; // or documentWrapper['$'] ;
documentNode.getElementById("id").scrollIntoView(); // Insert your element ID there


The problem is that you are not actually putting the scope inside the CKEDITOR instance. In order to get a variable pointing to the document, do this:

var ckeditorDocument = CKEDITOR.instances.[instancename].document.$;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号