【问题标题】:Redactor - getting Failed to execute 'insertBefore' on 'Node' error with MeteorRedactor - 使用 Meteor 无法在“节点”错误上执行“insertBefore”
【发布时间】:2014-12-03 07:11:02
【问题描述】:

我正在尝试将 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 方法?

【问题讨论】:

    标签: meteor contenteditable redactor


    【解决方案1】:

    我无法使用https://github.com/Swavek/contenteditable 方法实现此功能

    我最终恢复了 autorun/html 替换方法并且它有效!

    正如https://github.com/meteor/meteor/issues/1964 定义的那样,它不像 Swavek 那样整洁,也许我在做一些愚蠢的事情?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-07
      • 1970-01-01
      • 1970-01-01
      • 2019-03-03
      相关资源
      最近更新 更多