3
我有Meteor项目,它使用froala:编辑器 - 反应包为了设置用户关于我的领域。Meteor froala:编辑器反应式保存在数据的变化
这里是我的模板的js代码:
Template.profile.helpers({
getAbout: function() {
return Meteor.user().profile.about;
},
doSave: function (e, editor) {
// Get edited HTML from Froala-Editor
var newHTML = editor.getHTML();
// Do something to update the edited value provided by the Froala-Editor plugin, if it has changed:
if (!_.isEqual(newHTML, Meteor.user().profile.about)) {
Meteor.call("updateTestimony", Meteor.userId(), newHTML);
}
return false; // Stop Froala Editor from POSTing to the Save URL
}
}
这里是我的模板的html代码:
<template name="profile">
<div>
{{> froalaReactive _onbeforeSave=doSave _value=getAbout}}
</div>
</template>
它应该保存为价值变动(我希望)。 但我在线var newHTML = editor.getHTML();
有错误,我也尝试var newHTML = editor.html.get(true);
。这两个都会导致无法读取html或getHTML属性的错误。我希望这只是一个语法错误,我需要别的东西,但是这里有什么问题?