TinyMCE Plugin
Pulldown needs to be renderd as html
HTML
<script src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
<textarea>Tarun Lalwani</textarea>
JavaScript
tinymce.PluginManager.add('foo', function (editor, url) {
editor.addButton('foo', {
title: 'Label for plugin button',
text: 'Plugin button text',
type: 'button',
onclick: function () {
if (editor.selection.isCollapsed()) {
var selRng = editor.selection.getRng();
selRng.expand("word"); //expands the DOM range to the current word
editor.selection.setRng(selRng);
}
var selectionText = '';
selectionText = editor.selection.getContent({
'format': 'text'
});
alert('Your current word is: ' + selectionText)
}
});
});
tinymce.init({
selector: 'textarea',
plugins: ['foo'],
toolbar: "foo"
});