481 Posts in 150 Topics by 238 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1665 Views |
-
Code snippets using syntaxhl TinyMCE plugin

7 July 2010 at 1:54am
Hi,
I would like to insert code snippets (e.g., Java snippets in a programming tutorial) on a SilverStripe 2.4.0 CMS --preferably without having to edit a page's HTML manually. The syntaxhl TinyMCE plugin (http://github.com/RichGuk/syntaxhl) seemed an ideal solution.
I tried installing the plugin as follows:
- downloaded the plugin code into site/cms/javascript/tinymce_syntaxhl
- edited site/cms/_config.php such that the plugin is enabled and its button is installed:
-- added HtmlEditorConfig::get('cms')->enablePlugins(array('syntaxhl' => '../../../cms/javascript/tinymce_syntaxhl/editor_plugin_src.js'));
-- added HtmlEditorConfig::get('cms')->insertButtonsAfter ('formatselect', 'syntaxhl');
-- added textarea[cols|rows|disabled|name|readonly|class] to extended_valid_elementsThis does result in an extra button being shown in the editor, but the associated popup is very rudimentary. The labels of the insert and cancel buttons, for instance, are #{insert} and #{cancel}. The same goes for all other form elements (e.g. {#syntaxhl_dlg.highlight_options}).
Worse, the #{insert} button has no effect (popup does not close, nothing is inserted).I'm guessing the problem is related to the way I installed the plugin. Any help is appreciated as I'm a complete SilverStripe newbie (until now, the default installation suited my needs perfectly).
Thanks in advance.
-
Re: Code snippets using syntaxhl TinyMCE plugin

7 July 2010 at 2:19am
Moving the syntaxhl files to site/sapphire/thirdparty/tinymce/plugins/syntaxhl and subsequently enabling it through HtmlEditorConfig::get('cms')->enablePlugins('syntaxhl'); instead worked like a charm.
My apologies for the unnecessary posting!
| 1665 Views | ||
|
Page:
1
|
Go to Top |

