The page has a tinyMCE text box and an outside button. It is required that when you click a button in a text field, and any text is inserted into the current position. I found how to make a similar, but not quite that:

// Обработчик нажатия кнопки // getContent сохраняет html активного редактора // setContent вставляет какой либо html в редактор old_html=tinyMCE.activeEditor.getContent(); tinyMCE.activeEditor.setContent( old_html+"Привет"); 

This way I can insert the html code at the beginning or end of the editor, but I’ll have to go inside. So I couldn’t find the desired function, can anyone know?

  • @ Alexander Egorov, If you are given a comprehensive answer, mark it as correct (click on the check mark next to the selected answer). - Deleted

1 answer 1

Use the following command:

 tinyMCE.execCommand('mceInsertContent', false, 'Текст для вставки'); 

Here is an example: http://jsfiddle.net/6jLcv/

  • Thank you, what you need - Alexander Egorov