Redactor - 无法执行' insertBefore'在' Node' Meteor的错误

时间:2014-12-03 07:11:02

标签: meteor contenteditable redactor

我正在尝试将Redactor与Meteor 1.0一起使用。 我试图结合这种方法,因为当我直接包含它时,我得到了加倍的文本: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)

我的代码类似于:

<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方法?

1 个答案:

答案 0 :(得分:0)

我无法使用https://github.com/Swavek/contenteditable方法

我最终还原了自动运行/ html替换方法,它确实有效!

如此处所定义https://github.com/meteor/meteor/issues/1964它不像Swavek那样整洁,也许我做的事情很傻?