1

我有一个包含多个 ckeditor 的页面:

http://i.stack.imgur.com/8l4vB.png

编辑器的包装器是可拖动的。如果我将其中一个编辑器拖到另一个位置并放下它,它就不再可编辑并且内容消失了:

http://i.stack.imgur.com/yvSzs.png

我虽然可以通过销毁该特定编辑器然后重新初始化它来解决这个问题,但是当我这样做时,我收到以下错误:

未捕获的类型错误:无法调用 null ckeditor.js:635 的方法“clearCustomData”

有没有人遇到过这个问题?

这是我正在使用的 javascript:

function initSortable() {
    $('.sortable').sortable({
        handle  : '.sortable-handle'
    }).bind('sortupdate', function(e) {
        updateBlockOrder();
        // Get the dropped content block
        var _el = $(e.delegateTarget).children('.dropped');
        if (_el.find('.rte').length) {
            // Get id of each area and re-initialize
            _el.find('.rte').each(function(){
                var _id = $(this).attr('id');
                console.log(_id);
                var editor = CKEDITOR.instances[_id];
                console.log(editor);
                editor.destroy();
            });
        }
    });

}

输出如下:

form-blocks-2-body app.js:540

b {element: CKEDITOR.dom.element, elementMode: 1, name: "form-blocks-2-body", _: Object, commands: Object…}
_: Object
blockless: false
commands: Object
config: b
container: CKEDITOR.dom.element
dataProcessor: CKEDITOR.htmlDataProcessor
element: CKEDITOR.dom.element
elementMode: 1
filter: CKEDITOR.filter
focusManager: CKEDITOR.focusManager
getClipboardData: function (b,c){function e(a){a.removeListener();a.cancel();c(a.data)}
id: "cke_3"
instanceReady: true
keystrokeHandler: CKEDITOR.keystrokeHandler
lang: b
langCode: "en"
loaded: true
mode: "wysiwyg"
name: "form-blocks-2-body"
plugins: Object
readOnly: false
resetUndo: function (){b.reset();a.fire("saveSnapshot")}
status: "ready"
tabIndex: 0
templates: Object
toolbar: Array[13]
toolbox: t
ui: CKEDITOR.ui
__proto__: Object
 app.js:542

Uncaught TypeError: Cannot call method 'clearCustomData' of null 
4

0 回答 0