如何动态加载 &卸载 TinyMCE 插件 [英] How to dynamically load & unload a TinyMCE Plugin
问题描述
有谁知道有没有一种方法可以在 TinyMCE 已经加载后动态加载和卸载 TinyMCE 插件?具体来说,我正在考虑询问用户是否希望使用单选按钮或 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.
推荐答案
我以前用过一点 TinyMCE,不记得有什么方法.
I've used TinyMCE in the past a bit, and don't recall any way of doing this.
在 http://tinymce.moxiecode.com/js/tinymce/docs/api/index.html#class_tinymce.Editor.html,好像插件只有一个属性,没有method()来添加更多.
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.
似乎销毁原始实例并加载新配置是您唯一的选择.(除非你想修改 TinyMCE 代码)
It would seem that destroying the original instance and loading a new config is your only option. (Unless you want to modify TinyMCE code)
这篇关于如何动态加载 &卸载 TinyMCE 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!