Add utility functions for binding TextEditorViews to elements/models.
Review Request #6477 — Created Oct. 21, 2014 and submitted
TextEditorView now has a set of utility functions for binding various
things in a consistent way.
bindRichTextAttr()
will cause the TextEditorView'srichText
flag to
be initially set and bound to an attribute on a model. It will not save
out to that attribute, as in practice that's not very useful to us (we
tend to pull data out of the editor when we go to save).Passing
bindRichText: {model: ..., attrName: ...}
to the constructor
will initiate abindRichTextAttr()
automatically.
bindRichTextCheckbox()
will bind therichText
flag to a checkbox,
synchronizing state both ways. This is used internally for the
inlineEditor, but will also be used in other locations.
bindRichTextVisibility()
will bind therichText
flag to the
visibility of an element. This is also used internally for the Markdown
Reference link, and will be used elsewhere.Unit tests have been added to cover these cases.
Unit tests pass.
Tested manually with different settings, along with some upcoming changes.