Command identifiers for tinymce 4.x (mceAddControl)

ⅰ亾dé卋堺 提交于 2020-01-01 11:55:08

问题


I am migrating from tinyMCE 3.x to the latest version of tinyMCE 4.x. My problem is that I have dynamic generation of tinyMCE instances so in 3.x I was using:

tinymce.EditorManager.execCommand('mceAddControl', true, "content_txt");

but in version 4.x this doesn't work. I started to check the documentation but I can't find the identifiers for version 4.x


回答1:


Migration is very simple, replace

tinymce.EditorManager.execCommand('mceAddControl', true, "content_txt");

by

tinymce.EditorManager.execCommand('mceAddEditor', true, "content_txt");

When you want to turn it of, you can use

tinymce.EditorManager.execCommand('mceRemoveEditor', false, "content_txt");



回答2:


Use mceRemoveEditor/mceAddEditor exactly the same commands as stated here http://www.tinymce.com/forum/viewtopic.php?id=31256




回答3:


the add/remove editor execCommands worked but lost the editor's configuration. I found these show/hide methods to be more equivalent to the old add/remove controls commands.

tinyMCE.editors[id].show();
tinyMCE.editors[id].hide();


来源:https://stackoverflow.com/questions/18286293/command-identifiers-for-tinymce-4-x-mceaddcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!