I'm making a form with rich text in it. I have TinyMCE for that, Backbone controls the logic and underscore is used for templating.
I can't find if there's a way to bind a Backbone model to the TinyMCE value?
Something like:
var backboneModel = new BackBobeModel();
tinymce.init({
selector:'#rich-text',
'data-object': backboneModel.richText
});
As far as I know, TinyMCE doesn't bind automatically with Backbone. So I made a simple reusable
TextAreacomponent.It's made from a Backbone View which init its own root
<textarea>element as a TinyMCE instance and binds itself into itsChangeevent.TinyMCE Backbone component
Use it as-is
You can use it without a model, and it will create its own model to keep track of the data.
It's possible to retrieve the data or even listen to the component's model.
Use it with a custom model
Say you have a custom model with arbitrary attributes.
Just pass it to the component, defining which attribute it should use to update the model.
The same initial model instance
descriptionattribute will now be auto-updated anytime a user types in the TinyMCE box.