CKEditor:IE的getSelection()。selectElement()

时间:2012-11-21 13:52:42

标签: javascript asp.net ckeditor

CKEditor 中的

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

我编写的代码在FF中工作正常,但我没有获得IE的解决方案。

bellow是FF的代码:

Ele = EditorInstance.document.getById(Id);
EditorInstance.getSelection().selectElement(Ele);
Ele.scrollIntoView();

2 个答案:

答案 0 :(得分:0)

我已经尝试过波纹管代码及其工作......

        Ele = EditorInstance.document.getById(Id);            

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

答案 1 :(得分:0)

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

像这样的补丁也有效..

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();
                        }
                }