首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Kendo窗口中的Kendo用户界面编辑器

Kendo窗口中的Kendo用户界面编辑器
EN

Stack Overflow用户
提问于 2015-11-25 00:08:00
回答 1查看 1.5K关注 0票数 1

我正在使用一个kendo-editor的WYSIWYG文本编辑和工作伟大。但是当kendo-editor在一个kendo-window中时,我会得到这个错误

代码语言:javascript
复制
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.中

代码语言:javascript
复制
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内时,它工作得很好。

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-27 01:13:43

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

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

代码语言:javascript
复制
$("<div/>").kendoWindow({
  open: function(e){
    $("#myTextarea").kendoEditor();
  }
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33906267

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档