I have few dropdown boxes which should insert dynamic text(according to the selection) at cursor position in tinyMCE rich text editor.
我有几个下拉框,应该在tinyMCE富文本编辑器中的光标位置插入动态文本(根据选择)。
I found a lot of post related to above issue as bellow and it is not working currently with my code, also not giving any errors in the console as well.
我发现很多与上述问题有关的帖子如下所示,目前我的代码无效,也没有在控制台中给出任何错误。
tinyMCE.execInstanceCommand('text',"mceInsertContent",false,"This is the text to be inserted");
// here 'text' is id of textarea on which TinyMCE is rendered
I guess that when I click on dropdown boxes I loose the focus in text editor, but still I couldn't able to fix that.
我想当我点击下拉框时,我在文本编辑器中放松了焦点,但我仍然无法解决这个问题。
Any help would appreciate.
任何帮助都会很感激。
1 个解决方案
#1
4
Need to use execCommand
insted of execInstanceCommand
as bellow,
需要使用execInstance命令的execCommand,如下所示,
tinyMCE.execCommand('mceInsertContent',false,"This is the text to be inserted");
Reason is I used tinyMCE old version(2X), So most of the commands not working with old API.
原因是我使用的是tinyMCE旧版本(2X),因此大多数命令都不能使用旧的API。
#1
4
Need to use execCommand
insted of execInstanceCommand
as bellow,
需要使用execInstance命令的execCommand,如下所示,
tinyMCE.execCommand('mceInsertContent',false,"This is the text to be inserted");
Reason is I used tinyMCE old version(2X), So most of the commands not working with old API.
原因是我使用的是tinyMCE旧版本(2X),因此大多数命令都不能使用旧的API。