Tinymce - initially hide ()

I can create a tinymce editor and turn the editor on and off. After the initial creation, is there a preferred way to hide it (not hidden, but the editor is turned off and just show the div)?

tinymce.init({ 'selector': "#divID" }); tinymce.editors['divID'].hide(); tinymce.editors['divID'].show(); 
+4
source share
2 answers

Here is what I ended up doing. I don’t know if there is a better way, but it works.

 tinymce.init({ 'selector':'#divID', setup: function(ed) { ed.on('init', function(e) { e.target.hide(); }); } }); 
+6
source

I'm really not sure how I understand you correctly. Tinymce is a javascript iframe editor, you cannot manipulate it until it is fully loaded on the page.

Do you want to show the editor by clicking inside the div? You can use this inline parameter:

 tinymce.init({ selector: "divID", inline: true }); 

Working example

Do you want to hide the editor after some event? You can use this:

 $('#bottonID').click(function(){ tinymce.editors['divID'].hide(); }); 

Working example

Or, conversely, try using jquery tinymce: download
Then manipulate tinima as follows:

 $(function() { $('textarea.tinymce').tinymce({ //your code }); }); 

If you could be more specific, what would you like to achieve, I could provide a more accurate answer.

+3
source

Source: https://habr.com/ru/post/1501314/


All Articles