English 中文(简体)
How to dynamically load & unload a TinyMCE Plugin
原标题:
  • 时间:2009-12-06 19:25:03
  •  标签:
  • tinymce

Does anyone know if there is a way I can dynamically load and unload a TinyMCE plugin after TinyMCE has already been loaded? Specifically, I m thinking about asking the user whether or not they wish to load the fullpage plugin using perhaps a radio button or something above TinyMCE:

<input type="radio" name="fullpage" value="enabled"  /> Enable Fullpage Plugin<br />
<input type="radio" name="fullpage" value="disabled" /> Disable Fullpage Plugin<br />
<textarea name="tinymce" id="tinymce">...</textarea>

I suppose I could destroy the original instance and load a new config (one for enabled / one for disabled), but it seems as though there should be a more elegant way of loading and unloading plugins.

问题回答

I ve used TinyMCE in the past a bit, and don t recall any way of doing this.

Checking the API docs at http://tinymce.moxiecode.com/js/tinymce/docs/api/index.html#class_tinymce.Editor.html, it seems like there is only a property for the plugins, no method() to add more.

It would seem that destroying the original instance and loading a new config is your only option. (Unless you want to modify TinyMCE code)

You can use the AddOnManager load() function to dynamically load a plugin (AddOnManager API Reference). You may need to create an instance of the plugin class, in this case tinymce.plugins.FullPagePlugin once it s loaded.

However, since most plugins are designed to be loaded during the initialization of the editor, it s unlikely that the plugin will work consistently. The full page plugin in particular expects to be able to filter the content on the way into the editor so it s likely to have problems.

REgards,

Adrian Sutton.
http://tinymce.ephox.com





相关问题
Tinymce Model Binding with ASP.NET MVC

Does anyone know how to auto-populate the tinymce editor from the ASP.NET MVC model? In other words, what code do I need to use to set the contents of tinymce? EDITED: My problem is that tinyMCE is ...

How to dynamically load & unload a TinyMCE Plugin

Does anyone know if there is a way I can dynamically load and unload a TinyMCE plugin after TinyMCE has already been loaded? Specifically, I m thinking about asking the user whether or not they wish ...

tinyMCE problem with jQuery load

I have a DIV and a Load button on my page and when I click in Load button the jQuery loads a HTML from another file, this HTML file have texteareas and start tinymce. Ex: <script language="...

TinyMCE - adding an ON/OFF toggle switch

I m using TinyMCE on the text-areas in my Magento admin section. I have my TinyMCE editor visible form the start, but I want the option to disable/re-enable it. I m using the jQuery plugin version, ...

My admin panel and upload

I have written an admin panel for my site (im beginner in php). In content.php I have insert tinyMCE editor. I want to upload images from editor. What is the best way to do this. (not very familiar ...

How to click TinyMCE toolbar s button programmatically?

I want to make preview button as usual form button next to submit button(as it made in most cases of "Post new topic" forms). How can I programmatically simulate toolbar s preview button click ? I ...

热门标签