Syntax Highlighter

Jan 26, 2015 at 4:36 AM
I've installed the latest CKEditor Provider.

If I look at the toolbar configuration on the HTML Editor page, the Syntax Highlighter button is on the toolbar between the object and table buttons. But, on opening the editor, that's the only button on that toolbar that doesn't appear.

How do I get syntax highlighter button to appear and work?

Thanks!
Jan 31, 2015 at 2:13 PM
Did you upgrade from a previous version?

I ask because in version 2.1 i switched the plugin the syntax highligter plugin is now the CodeSnippet Button/Plugin.

Did you see the SyntaxHighlighter or the CodeSnippet Button?
Jan 31, 2015 at 2:45 PM
I see the SyntaxHighlight button available for the toolbar, but nothing appears when the editor is invoked.

I did upgrade from a previous version.

How should I go about fixing this? (I went to uninstall, but the provider doesn't seem to have an uninstall button in Extensions.)

Jan 31, 2015 at 3:02 PM
jncraig wrote:
I see the SyntaxHighlight button available for the toolbar, but nothing appears when the editor is invoked. I did upgrade from a previous version. How should I go about fixing this? (I went to uninstall, but the provider doesn't seem to have an uninstall button in Extensions.)
Well uninstall wouldn't help if it is a new installation. By default the button should be visible by default in the editor, at least for admins from the Full toolbarset.

What changes did you actually made, did you created your own toolbarset? Be aware that the toolbarset are role based. Are you logged in as Admin/Host or regular user?


PS: I you still want to uninstall, i created a WIKI Page on how to uninstall the editor

https://dnnckeditor.codeplex.com/wikipage?title=Uninstallation
Jan 31, 2015 at 4:25 PM
Oh, this was an upgrade ...

I uninstalled CKEditor, and then reinstalled it and made it the default.

Logged in as host, I don't seen any buttons on the editor toolbar for SyntaxHighlight or CodeSnippet.

If I go to the CKEditor config and look at the Full toolbar, there is an entry for SyntaxHighlight, but it doesn't appear when the editor is opened. I don't see anything for CodeSnippet.

Where should I be looking in the editor to verify that CodeSnippet is there and configured?


Thanks.
Jan 31, 2015 at 4:43 PM
Go to your home folder (By default it is Portals/0/) and delete the files CKToolbarButtons.xml, CKToolbarSets.xml and and CKEditorSettings.xml then reload the editor.
Jan 31, 2015 at 5:05 PM
By the Way this is how the default toolbarset should look (including the codeSnippet Button)

Image
Jan 31, 2015 at 5:16 PM
Perfect!

Thanks for the help ... and for this contribution to DNN.

Jan 31, 2015 at 6:22 PM
OK, working now but with a bit of a problem ...

Inserting a code snippet into a module resuts in this being added to the top of a module:

<!-- Injected Highlight.js Code -->
<script type="text/javascript">
window.onload = function() {var aCodes = document.getElementsByTagName('pre');for (var i=0; i < aCodes.length;i++){hljs.highlightBlock(aCodes[i]);} };</script>

The first two lines of this block are also injected into the page's meta tags.

I am actually using this in an articles module, and putting the script there seems to prevent automatic generation of a summary for the article.

So, the question is: can I control where the script is injected at least in the module? Moving it to the bottom of the block of text or out of the module completely would be helpful.

Feb 1, 2015 at 4:14 AM
What you can control from within the editor settings if you want the script to be injected or not.

I would suggest to disable "Inject Link to SyntaxHighlighter Js?" and put the code in your site
Feb 1, 2015 at 4:47 AM
Perfect. I had not found that option yet. Can you point me to it?

Feb 1, 2015 at 5:20 AM
jncraig wrote:
Perfect. I had not found that option yet. Can you point me to it?
You can find it on the Main Settings Tab inside the Editor Settings
Feb 1, 2015 at 6:01 AM
Thanks, again!