我正在尝试在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)
我的代码看起来像这样:
<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方法来代替?
发布于 2014-12-03 17:25:33
我无法使用https://github.com/Swavek/contenteditable方法来实现这一点
我最终恢复了autorun/html替换方法,它起作用了!
正如这里定义的https://github.com/meteor/meteor/issues/1964,它不像Swavek那么整洁,也许我做了什么傻事?
https://stackoverflow.com/questions/27265717
复制相似问题