ckeditor scrollIntoView to a div element within the editor

点点圈 提交于 2019-12-13 04:44:26

问题


I have a navigation menu out side ckeditor and i want to navigate within the editor as all my element in editor have ids

scrollIntoView

how does this work

any example will be good


回答1:


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



回答2:


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.$;


来源:https://stackoverflow.com/questions/2178449/ckeditor-scrollintoview-to-a-div-element-within-the-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!