开发者

TinyMCE contained element?

I wrote a TinyMCE plugin for Wordpress that drops a prepared bit of HTML into the textarea when a button on the toolbar is clicked. This is to assist in formatting some relatively complicated elements.

I would like for this piece of HTML to be wrapped in some sort of container that TinyMCE recognizes and allows for easy selection 开发者_StackOverflow社区or deletion if needed.

Currently, the only way to delete an individual element is by erasing all of the information each individual "sub element" contains. I can't seem to find any information in the API regarding manually assigning an element as a singular combined object. As far as behavior goes, think "resize frame" or something similar (only this won't need to have any resizing capabilities).

Any ideas?


If you want to wrap text/html inside an element of your choice (i used a span here) at the current cursor position of tinymce editor instance ed you can simply do

ed.execCommand('insertHTML', false, '<span class="custom_to_delete">My_Text</span>');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜