Javascript 剑道窗口内的剑道UI编辑器
我正在使用一个Javascript 剑道窗口内的剑道UI编辑器,javascript,html,kendo-ui,kendo-window,kendo-editor,Javascript,Html,Kendo Ui,Kendo Window,Kendo Editor,我正在使用一个剑道编辑器进行所见即所得文本编辑,效果非常好。但是当剑道编辑器在剑道窗口中时我得到了这个错误 TypeError: Cannot read property 'open' of null at Widget.extend._createContentElement (webpack:///./kendo-ui/js/kendo.editor.js?:426:16) at Widget.extend._initializeContentElement (webpack
剑道编辑器
进行所见即所得文本编辑,效果非常好。但是当剑道编辑器
在剑道窗口中时
我得到了这个错误
TypeError: Cannot read property 'open' of null
at Widget.extend._createContentElement (webpack:///./kendo-ui/js/kendo.editor.js?:426:16)
at Widget.extend._initializeContentElement (webpack:///./kendo-ui/js/kendo.editor.js?:512:40)
at new Widget.extend.init (webpack:///./kendo-ui/js/kendo.editor.js?:282:18)
at HTMLTextAreaElement.eval (webpack:///./kendo-ui/js/kendo.core.js?:3104:32)
at Function.jQuery.extend.each (webpack:///../Scripts/jquery.js?:374:23)
at jQuery.fn.jQuery.each (webpack:///../Scripts/jquery.js?:139:17)
at $.fn.(anonymous function) [as kendoEditor] (webpack:///./kendo-ui/js/kendo.core.js?:3103:26)
at createIt (webpack:///./kendo-ui/js/kendo.angular.js?:192:31)
at createWidget (webpack:///./kendo-ui/js/kendo.angular.js?:168:20)
at link (webpack:///./kendo-ui/js/kendo.angular.js?:681:34)
发生在kendo.editor.js中
iframe = $("<iframe />", { title: editor.options.messages.editAreaTitle, frameBorder: "0" })[0];
$(iframe)
.css("display", "")
.addClass("k-content")
.insertBefore(textarea);
iframe.src = src;
wnd = iframe.contentWindow || iframe;
doc = wnd.document || iframe.contentDocument;
$(iframe).one("load", function() {
editor.toolbar.decorateFrom(doc.body);
});
doc.open(); // throws TypeError: Cannot read property 'open' of null
doc.write(
iframe=$(“”,{title:editor.options.messages.editAreaTitle,frameBorder:“0”})[0];
$(iframe)
.css(“显示”、“显示”)
.addClass(“k内容”)
.insertBefore(文本区域);
iframe.src=src;
wnd=iframe.contentWindow | | iframe;
doc=wnd.document | | iframe.contentDocument;
$(iframe).1(“加载”,函数(){
编辑器.工具栏.装饰框(doc.body);
});
doc.open();//抛出TypeError:无法读取null的属性“open”
博士写(
注意,没有错误,当剑道编辑器不在剑道窗口中时,它工作得很好
有没有人遇到过这样的情况,解决方案/解决方法是什么?剑道编辑器实例应该在剑道窗口打开后调用,换句话说,在其容器位于DOM中后调用
您应该在open事件中创建kendoEditor:
$("<div/>").kendoWindow({
open: function(e){
$("#myTextarea").kendoEditor();
}
});
$(“”)。kendoWindow({
开放:功能(e){
$(“#myTextarea”).kendoEditor();
}
});
你确定你的剑道编辑器是在剑道窗口创建后设置的吗?如果不尝试调用剑道编辑器(或绑定到的对象),在剑道窗口“打开”的情况下,这就是问题所在。请随意添加作为答案,我将接受:)