首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CKEditor : IE的getSelection().selectElement()

CKEditor : IE的getSelection().selectElement()
EN

Stack Overflow用户
提问于 2012-11-21 13:52:42
回答 2查看 1.5K关注 0票数 0

CKEditor中:根据我的要求,我只想按其Id选择元素并滚动到该位置。

我已经写了代码,这是很好的工作在FF,但我没有得到解决方案的IE。

贝娄是FF的代码:

代码语言:javascript
复制
Ele = EditorInstance.document.getById(Id);
EditorInstance.getSelection().selectElement(Ele);
Ele.scrollIntoView();
EN

回答 2

Stack Overflow用户

发布于 2012-11-22 12:53:43

我试过下面的密码和它的工作..。

代码语言:javascript
复制
        Ele = EditorInstance.document.getById(Id);            

        EditorInstance.focus(); 
        var element = EditorInstance.document.getBody().getLast();
        var selection = EditorInstance.getSelection();
        selection.selectElement(Ele); 
        selection.scrollIntoView();
票数 0
EN

Stack Overflow用户

发布于 2013-05-03 23:09:54

基于http://dev.ckeditor.com/ticket/7561http://dev.ckeditor.com/attachment/ticket/7561/7561.patch

这样的补丁也能用..。

代码语言:javascript
复制
Index: _source/plugins/selection/plugin.js
===================================================================
--- a/public/ckeditor-3.6.4/_source/plugins/selection/plugin.js
+++ b/public/ckeditor-3.6.4/_source/plugins/selection/plugin.js
@@ -710,7 +710,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        }
                        catch ( e )
                        {
-                               this.isInvalid = true;
+                               document.getWindow().focus();
                        }
                }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13494773

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档