michaelpapworth / tinymce-knockout-binding

A KnockoutJS custom binding that applies a TinyMCE Editor to the bound HTML element
MIT License
39 stars 19 forks source link

Can I challenge you to include tagging/autotagging of the text into the binding? #3

Closed asleg closed 10 years ago

asleg commented 10 years ago

By tagging I mean that the the editor search the value-attribute for a set of tags given as an option.

By auto tagging I mean a button og function that does tagging of the value-attribute automatically. Probably should specify in some option parameter how to recognize a word as a tag, for instance with a special character like #.

michaelpapworth commented 10 years ago

If I understand your requirement for "tagging" correctly, this is actually nothing to do with this binding. In fact there are two parts. First you should probably create a tags binding. This would allow you to bind an observableArray held by the view-model onto the <textarea> that could implement a regular expression for example and populate the array based on the matches. Would look something like this?

<textarea data-bind="wysiwyg: content, tags: myTagArray"></textarea>

The "autotagging" may be slightly more complex but I would approach this by implementing a TinyMCE plugin, thus giving you a "toolbar-button" or "menu-item" to transform selected text into a tag, which would then be detected by your tag binding to populate the array.