我正在为我的angular 4应用程序实现ckeditor。一切正常,但是当我使用浏览器后退按钮从另一个页面返回时,编辑器挂起时出现以下错误
ckeditor.js:445 Uncaught TypeError: Cannot read property 'getSelection' of undefined
at CKEDITOR.dom.selection.getNative (ckeditor.js:445)
at CKEDITOR.dom.selection (ckeditor.js:443)
at a.CKEDITOR.editor.getSelection (ckeditor.js:440)
at CKEDITOR.plugins.undo.Image (ckeditor.js:1072)
at CKEDITOR.plugins.undo.UndoManager.save (ckeditor.js:1067)
at a.<anonymous> (ckeditor.js:1063)
at a.n (ckeditor.js:10)
at a.CKEDITOR.event.CKEDITOR.event.fire (ckeditor.js:12)
at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:13)
at CKEDITOR.command.exec (ckeditor.js:952)
当我深入研究代码时,我发现错误位于以下函数中this.document.getWindow().$
未定义,并且尝试调用该函数。
getNative: function() {
return void 0 !== this._.cache.nativeSel ? this._.cache.nativeSel : this._.cache.nativeSel = x ? this.document.$.selection : this.document.getWindow().$.getSelection()
}