5513 Posts in 1732 Topics by 1218 members
|Go to End|
28 July 2010 at 9:23am
I made a simple plugin, and know how to use the HtmlEditorConfig to enable it and add a button, but where would be the most appropriate place to save the plugin be so that it is not lost in an upgrade?
30 July 2010 at 2:46am
OK, maybe I don't know how to use the HtlmlEditorConfig to enable the plugin as well as I thought...
I had it working with the standardwhen it was in the tinymce plugins folder, but moving the plugin 1 level outside of the standard plugin folder with:
HtmlEditorConfig::get('cms')->enablePlugins('testplugin');made it stop working.
Checking the code for HtmlEditorConfig it notes, "If passed in as a map of plugin-name to path, the plugin will be loaded by tinymce.PluginManager.load() instead of through tinyMCE.init(). Keep in mind that these externals plugins require a dash-prefix in their name."
First, based on the documentation for HtmlEditorConfig they use an underscore, not a dash--which is correct?. 2nd, what do I need to rename exactly--just the folder with my plugin, or just prefix the plugin folder name with tinymce(_/-) when enabling it as in the documentation? Finally, does the fact it is loading the plugin with tinymce.PluginManager.load() instead of tinyMCE.init() require me to change the code of the plugin (and how)?
Using SS 2.4
26 September 2010 at 1:15am
26 September 2010 at 6:49pm Last edited: 26 September 2010 6:49pm
I have looked in to this some more. I have got some custom plugins to work in their own directories (like modules) in SS 2.3 but the same behavior you describe with them not working in SS2.4 is happening (they only work in the tinymce/plugins directory). If anyone can confirm what we are experiencing here and can maybe identify the exact cause of this problem or a solution that would be very helpful.
27 September 2010 at 3:02pm Last edited: 27 September 2010 3:04pm
Ok so I finally worked this out. In SS2.4 the directory of tinymce was changed from SS2.3. So if you are to add a plugin to tinymce in your config file you need to specify the directory of it exactly from the plugins directory. So from what I gather the best practice is to place your plugin in the top level directory like a module. Then in your _config.php file you add the plugin like this.
Now if you want to use a tinymce plugin that is thirdparty and you haven't created it yourself the plugin will be written as though it is inside the tinymce/plugins directory. So if you want to use it in SS as a toplevel module any references to files in tinymce will need to have their paths changed. Here is an example.
Code from plugins html file (pluginname.htm).
In addition to this the url to your plugin inside editor_plugin_src.js also needs to be changed to reference the file path of the plugin. Here is an example of the changes that I had to make.
Code from editor_plugin_src.js
// Load plugin specific language pack
//Code changes in init
file : url + '../../../../../../plugindir/pluginname.htm',
plugin_url : url + '../../../../../../plugindirname', // Plugin absolute URL
//Code changes in addButton
image : url + '../../../../../../pluginanme/img/pluginimg.gif'
Hopefully this will help people when they are having trouble with tinymce.
2 December 2010 at 7:08am
Just a quick note...
Should actually be...
17 December 2010 at 3:42am
sorry but nothing described here is working for me. If the plugin I downloaded would at least work in the original sapphire/thirdparty/plugins folder everything would be fine for me.....
I put the plugin named loaded with tinymce.create("tinymce.plugins.Quotes".... in editor_plugin.js of the plugin in the original thirdparty folder and used
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'Quotes'); // positions plugin
in _config.php to use it.... but NOTHING happens. Not even errormessages that would lead me to where I can do something....
any hint would be appreciated...
oh and my editor is in english although I set the CMS language to german.... how can I fix this????
LITTLE bit frustrated.......
4 January 2011 at 11:17pm
Ok, I found out it seems the htmleditor config is not set in /mysite/_config.php but in /cms/_config.php, but entering my plugindetails there doesn't do anything either.... so it might be broke... I'll try another one and put it in the sapphire folder... maybe that'll work.
But that the editor is in english is still confusinga s I set the default language with Translatable::set_default_locale('de_DE'); and TinyMCE config loads with "en" from i18n Class..... I even tried both, using Translatable and additionally i18n::set_default_locale('de_DE'); but it is still in english....
|Go to Top|