I'm trying to remove tinyMCE from a specific textarea that I have created earlier but the following command kept on producing "undefined" error (checked using firebug console):
tinyMCE.execCommand('mceFocus', false, 'textarea-plainText');
tinyMCE.execCommand('mceRemoveControl', false, 'textarea-plainText')
I have initialized the TinyMCE for that particular text area using jQuery:
$('textarea#textarea-plainText').tinymce({
script_url : '<?php echo base_url(); ?>/assets/js/tinymce/tinymce.min.js',
oninit: function() {
$("textarea#textarea-plainText").tinymce().setContent("");
$("textarea#textarea-plainText").tinymce().setContent(noteSecContent.html[0].notesec_content);
}
});
I have also try to add tinyMCE using the following command but it also return undefined although I have a textarea with "textarea-plainText" ID:
$.getScript('<?php echo base_url(); ?>assets/js/tinymce/tinymce.min.js', function() {
window.tinymce.dom.Event.domLoaded = true;
tinyMCE.init({
mode: 'none'
});
tinyMCE.execCommand('mceAddControl', false, 'textarea-plainText');
});
In short, I can only initialize either using the jquery method or exact method. But not using tinyMCE.execCommand. Somehow the "exeCommand" command just wont work.
HTML for the textarea:
<div id="plainTextModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="plainTextLabel" aria-hidden="true">
<div class="modal-body">
<textarea id='textarea-plainText'></textarea>
</div>
<div class="modal-footer">
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">Cancel</button>
<a href="" id="confirm-delete-note-section" class="btn btn-primary">Save</a>
<a href="" id="confirm-delete-note-section" class="btn btn-info">Save & Close</a>
</div>
</div>
It's a modal, so it is initially hidden until the modal is called.
I'm using TinyMCE 4.0b1 by the way.