我遇到了带有backbone.js的TinyMCE v4。 当我刷新页面时,编辑器工作正常,但是当我使用我的路由器进行导航时,它可以正常工作
APP.Views.AddEdit = Backbone.View.extend({
el:'#addEditHolder',
initialize: function() {
_.bindAll(this, 'render', 'saveModel');
this.listenTo(this.model, 'change', this.render);
vent.on("model:save", this.saveModel, this);
this.render();
this.form = this.$('form');
this.name = this.form.find('#addedit_name');
this.description = this.form.find('#addedit_description');
},
template: APP.template2( 'addEditTemplate' ),
render: function() {
this.$el.html(this.template(this.model.toJSON()));
tinymce.init({
selector: "textarea.richContent",
theme: "modern",
width: '100%',
height: 240
});
return this;
},
saveModel: function() {
this.model.save({
name:this.name.val(),
description:this.description.val()
},
{
wait: true,
patch: true
});
}
});