How to do jquery on tinyMCE editor on a blog?
I have implemented tinyMCE as an editor for my blog , but every time I open the comments section , every place I would have commented , the tiny mce editor would a开发者_StackOverflow社区utomatically open up there even if I dont want to .
For example . lets say on a blog post , I have commented twice and I want to comment for the third time , when I go to the blog post , all the previous two times also show up for edit . What I am thinking is to come up to with an edit button jquery enabled , which when clicked gives a drop down of the tinyMCE editor , to edit the text . Is it possible ?
Yes, this is possible. All you need to do is to configure your tinymce properly. Have a look at the configuration setting mode. You should set it to 'none'. Later (onButtonClick) you can do the following to activate your tinymce instance
// important: id of the dom element to be converted into a tinymce editor instance
tinyMCE.execCommand("mceAddControl", true, "id"); instance
Be aware that when you wish to deactivate the tinymce instance (for example if you want to activate another instance and wish to only have one tinymce instance open at one time) you should not just clear the dom and remove the node conatining the tinymce instance, instead deactivate tiny the right way:
tinyMCE.execCommand("mceRemoveControl", true, "id");
Otherwise you could run into trouble reactivating the uncleanly removed editor instance a second time.
精彩评论