我使用<div ng-repeat="f in display.files">
<div id="image_thumb">
<a ng-href="/uploads/{{f}}" target="_blank"><img src="/uploads/{{f}}" class="displaythumb"></a>
<br><br>
<p id="thumbname">{{f}}</p>
进行WYSIWYG文本编辑,效果很好。但当kendo-editor
内kendo-editor
时,我收到此错误
kendo-window
在 kendo.editor.js 中发生。
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)
请注意,当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
内时,没有错误,效果很好。
有没有人碰到这样的事情,什么是解决方案/解决方法?
答案 0 :(得分:1)
应该在打开kendo Window之后调用Kendo Editor实例,换句话说,在其容器位于DOM之后。
您应该在open事件中创建kendoEditor:
$("<div/>").kendoWindow({
open: function(e){
$("#myTextarea").kendoEditor();
}
});