Jump to content

editor - add C format?


OctoDev

Recommended Posts

How to remove it.....

ACP -> Customization -> Editor (Toolbars)

Drag the existing code icon off the toolbar.

How to add code snippet....

Go to ckeditor.com and search for/download the following plugins:

  1. Line Utilities
  2. Widget
  3. Code Snippet

Back to the ACP as above and click the "Add Button" button.

Add the above 3 items in the order listed.....Code Snippet requires Widget which requires Line Utilities, so you need to install as above.

Once done, simply drag the new code snippet button up from the "Buttons not on toolbar" section up to the editor toolbar.

Link to comment
Share on other sites

​I 

How to remove it.....

ACP -> Customization -> Editor (Toolbars)

Drag the existing code icon off the toolbar.

How to add code snippet....

Go to ckeditor.com and search for/download the following plugins:

  1. Line Utilities
  2. Widget
  3. Code Snippet

Back to the ACP as above and click the "Add Button" button.

Add the above 3 items in the order listed.....Code Snippet requires Widget which requires Line Utilities, so you need to install as above.

Once done, simply drag the new code snippet button up from the "Buttons not on toolbar" section up to the editor toolbar.

I uploaded these three to /public/applications/core/interface/ckeditor/ckeditor/plugins

I went back to my ACP and tried to look for the button but i dont, i see that i can add buttons via zip.. so i tried to upload any of the zips but it erroed..

Link to comment
Share on other sites

I uploaded these three to /public/applications/core/interface/ckeditor/ckeditor/plugins

I went back to my ACP and tried to look for the button but i dont, i see that i can add buttons via zip.. so i tried to upload any of the zips but it erroed..

​Which is totally not the way to do it - use my instructions to upload the files, do not manually upload them as you have.

Go back and delete the files you uploaded to /public/applications/core/interface/ckeditor/ckeditor/plugins and start again as I described it.

Link to comment
Share on other sites

​Which is totally not the way to do it - use my instructions to upload the files, do not manually upload them as you have.

Go back and delete the files you uploaded to /public/applications/core/interface/ckeditor/ckeditor/plugins and start again as I described it.

​yeah works now xD

Link to comment
Share on other sites

What are you not sure about exactly? I could hold your hand further here, but I like to encourage people to figure things out themselves....to me, that documentation is pretty clear in that you edit the file I mentioned and you add in the configuration setting you want to use.

What is not clear?

​I can't find what to replace or what to edit in the config file or the other .js

I want to replace so basically normal enter is br and enter + shift is <p> that way it works and makes more sense towards my members..,  i think its way different doing it on ipboard 4.0 as they customized that file it seems :P 

found some old articles from years back, they also didnt work 

Link to comment
Share on other sites

That link directs you to the configuration setting to control what happens when ENTER is pressed.

The default in CKEditor is <p></p>, which means that the following configuration is in effect:
config.enterMode = CKEDITOR.ENTER_P;

So, to change it to <br>...

The config.js is not "customised" - it is actually just configured as per ckeditor documentation. http://docs.ckeditor.com/#!/guide/dev_configuration has a section called "Using the config.js" file which shows how to use the CKEDITOR.editorConfig function to describe what configuration to use for the editor.

Now, the problem may be that the documentation says to add config.enterMode = CKEDITOR_ENTER_BR to the config.js, but if you don't know how the config.js is structured then the question of "where" comes up.

It's quite simple once you clear up a slight difference....

CKEDITOR documentation for editorConfig shows this as a structure:

 

CKEDITOR.editorConfig = function( config ) {
    config.language = 'fr';
    config.uiColor = '#AADC6E';
};
Default IPS config.js has this as the structure:
CKEDITOR.editorConfig=function(a){a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
a.removeDialogTabs="link:advanced"};
Let's make it easier to read....
/*
 Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig=function(a){
    a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];
    a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
    a.removeDialogTabs="link:advanced"
};
[/code]

So where is the 'config' bit? It's called 'a' in the IPS config.js file

CKEDITOR = CKEDITOR.editorConfig = function( config )
IPS = CKEDITOR.editorConfig = function( a )

So instead of adding config.enterMode = CKEDITOR.ENTER_BR; to the file, you add a.enterMode = CKEDITOR.ENTER_BR; (AND ENSURE YOU'VE CLOSED OFF THE PREVIOUS LINE WITH A ";")

Once done, save & replace the file, refresh the page and magic.

Now, how do you modify the Shift+Enter combination?? Guess what....

http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode

That defaults to <br>

Link to comment
Share on other sites

That link directs you to the configuration setting to control what happens when ENTER is pressed.

The default in CKEditor is <p></p>, which means that the following configuration is in effect:
config.enterMode = CKEDITOR.ENTER_P;

So, to change it to <br>...

The config.js is not "customised" - it is actually just configured as per ckeditor documentation. http://docs.ckeditor.com/#!/guide/dev_configuration has a section called "Using the config.js" file which shows how to use the CKEDITOR.editorConfig function to describe what configuration to use for the editor.

Now, the problem may be that the documentation says to add config.enterMode = CKEDITOR_ENTER_BR to the config.js, but if you don't know how the config.js is structured then the question of "where" comes up.

It's quite simple once you clear up a slight difference....

CKEDITOR documentation for editorConfig shows this as a structure:

 

CKEDITOR.editorConfig = function( config ) {
    config.language = 'fr';
    config.uiColor = '#AADC6E';
};
Default IPS config.js has this as the structure:
CKEDITOR.editorConfig=function(a){a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
a.removeDialogTabs="link:advanced"};
Let's make it easier to read....
/*
 Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig=function(a){
    a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];
    a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
    a.removeDialogTabs="link:advanced"
};
[/code]

So where is the 'config' bit? It's called 'a' in the IPS config.js file

CKEDITOR = CKEDITOR.editorConfig = function( config )
IPS = CKEDITOR.editorConfig = function( a )

So instead of adding config.enterMode = CKEDITOR.ENTER_BR; to the file, you add a.enterMode = CKEDITOR.ENTER_BR; (AND ENSURE YOU'VE CLOSED OFF THE PREVIOUS LINE WITH A ";")

Once done, save & replace the file, refresh the page and magic.

Now, how do you modify the Shift+Enter combination?? Guess what....

http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode

That defaults to <br>

​I still don't understand it. Can someone just provide me a file instead of trying to learn me Javascript? 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...