首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编辑程序-获取无法在“”Node“”上执行“”insertBefore“”,出现流星错误

编辑程序-获取无法在“”Node“”上执行“”insertBefore“”,出现流星错误
EN

Stack Overflow用户
提问于 2014-12-03 15:11:02
回答 1查看 535关注 0票数 1

我正在尝试在Meteor 1.0中使用Redactor。我尝试与这种方法相结合,因为当我直接包含它时,我得到了加倍的文本:https://github.com/Swavek/contenteditable

错误详细信息:

Exception from Tracker recompute function: Error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. at Error (native) at Function.DOMRange._insertNodeWithHooks (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:379:12) at Function.DOMRange._insert (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:348:16) at DOMRange.attach (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:425:16) at DOMRange.setMembers (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:469:12) at doMaterialize (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1866:22) at Object.Tracker.nonreactive (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:502:12) at doRender (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1856:15) at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1795:16 at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2029:12)

我的代码看起来像这样:

代码语言:javascript
复制
<template name="contenteditable">

   {{{editable}}}

</template>


Template.contenteditable.helpers({
    editable: function () {
        var displayContent = "Please type something...";
        if (this.content){
            displayContent = this.content;
        }

        return '<div class="rich-text-editor" tabindex=0>' +  displayContent + '</div>';
     }

});

Template.contenteditable.rendered = function(){
    $('.rich-text-editor').redactor({
         blurCallback: function(e)
         {


             e.preventDefault();
             e.stopImmediatePropagation();

             var blurredItem = e.currentTarget;

          console.log("Blaze.getData(blurredItem)._id:" + Blaze.getData(blurredItem)._id + " val:" + this.code.get())





         <DO SOME UPDATE STUFF>

         }
    });
}

有什么想法吗?也许我需要使用.html/innerHTML方法来代替?

EN

回答 1

Stack Overflow用户

发布于 2014-12-03 17:25:33

我无法使用https://github.com/Swavek/contenteditable方法来实现这一点

我最终恢复了autorun/html替换方法,它起作用了!

正如这里定义的https://github.com/meteor/meteor/issues/1964,它不像Swavek那么整洁,也许我做了什么傻事?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27265717

复制
相关文章

相似问题

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