我正在使用 meteorjs 和froala-reactive editor。
在我的路由器中,我将收集数据返回到模板,它工作正常。
但我需要能够更新编辑器的内容。最好的更新方式是_value
什么?
模板代码:
{{> froalaReactive _onbeforeSave=doSave inlineMode=false _value=getText}}
router.js 代码:
Router.route('admin/pages/:_id', function () {
this.render('Page', {
data: function () {
Session.set('editorContent', 'editor content here');
return Pages.findOne({_id: this.params._id})
}});
});
辅助功能:
Template.Page.helpers({
getText: function () {
var self = this;
return function (e, editor, data) {
return Session.get("editorContent");
};
}
});
我希望当会话变量 editorContent 更改编辑器中显示的内容时会更新,但这不起作用。