gpt4 book ai didi

javascript - Kendo Window 内的 Kendo UI 编辑器

转载 作者:行者123 更新时间:2023-11-27 23:38:37 25 4
gpt4 key购买 nike

我正在使用kendo-editor进行所见即所得文本编辑,效果很好。但是,当kendo-editor位于kendo-window内部时,我收到此错误

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(

请注意,没有错误,并且当 kendo-editor 不在 kendo-window 内时效果很好。

有人遇到过这样的事情吗?解决方案/解决方法是什么?

最佳答案

Kendo Editor 实例应该在打开 kendo 窗口之后调用,换句话说,在它的容器位于 DOM 中之后。

您应该在 open 事件中创建 kendoEditor:

$("<div/>").kendoWindow({
open: function(e){
$("#myTextarea").kendoEditor();
}
});

关于javascript - Kendo Window 内的 Kendo UI 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com