1

我正在尝试在 TinyMce 编辑器之外实现一个按钮,该按钮会在单击时向活动编辑器添加文本。我怎样才能做到这一点?

(例如:我的网站上有一个按钮应该将“测试”添加到编辑器中,但它没有)。

感谢帮助 :)

4

1 回答 1

4

将此代码添加到按钮的 onClick 中:

// the editor id is the same id of your textarea, default "content" in case your textarea does not have an id

tinymce.get('your_editor_id').execCommand('mceInsertContent', false, "Test");

如果您的页面上有一个编辑器,您也可以tinymce.activeEditor使用tinymce.get('your_editor_id').

于 2012-09-12T07:32:23.760 回答