Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] CKEditor custom config - gsconfig.php definition does not work
#1
Hi guys,
I have a question about the tutorial CKEditor Configuration Files. It seems to be a bit outdated and maybe that's why it doesnt work.

I have no problems redefining custom settings in config.js and custom styles in default.js unless I copy my custom settings elsewhere and set it in gsconfig.php.

These are the places where it works (ofc, that's default)
Code:
/admin/template/js/ckeditor/config.js
/admin/template/js/ckeditor/plugins/styles/styles/default.php


Whenever I try to define custom path to these files in my theme folder, it just doesn't apply. Of course I have flushed browser's cache.

What I did exactly is that I added
Code:
define('GSEDITOROPTIONS', "entities : false,customConfig : '../../../../theme/themeName/ckeditor-config/config.js',skin: 'v2'");

define('GSEDITOROPTIONS',"stylesSet: 'default:http://fullurl/theme/themeName/ckeditor-config/default.js'");

I tried it with both CKEditor versions (3.6.x and 4.x). With 3.6, it just doesn't apply, it loads settings from its original folder admin/.... With 4.x, the editor doesn't load itself at all after adding the lines above into gsconfig.php. There's a different folder structure at 4.x, I know so I changed the paths properly.

Does any of you use it so that it works? I would like to make updating GS faster and easier, it's annoying to have to manually replace those files after each update. It's not any critical but still, when you know there's a feature for this, why not to use it.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#2
I don't know the answer to your questions. Have you tried a different approach:

Add a file to your theme folder, e.g., themeconfig.php, containing your custom define('GSEDITOROPTIONS' ... settings ;
Add an include line in the gsconfig.php file, pointing to themeconfig.php.

Adding a single line to gsconfig is easier than editing existing lines, too. I have no idea if this suggestion will work, but it is less likely to be broken by the way gsconfig settings are used in the GS code.
--
Nick.
Reply
#3
Hi Nick,
thanks for your reply.

I have tried to put the styles.js (default.js) into the root and it worked. Then I moved into my template and it also worked. But it's still useless if I have to keep absolute URL there - I would have to change it each time I create a new website. Functions like get_site_url(); are not usable there as well, so I think I'll have to leave this.

Then I did some tests with config.js and I did not find a way to define my custom that would work.

Including would make no sense as including a php file makes url relative to the file you included the file to, so I would need the same relative URL structure there. Correct me if I'm wrong, happens.

Never mind, I think I'll just go without this feature and I'll update the files with each GS update. It's not that often Smile

Thank you
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#4
customConfig : '../../../../theme/cke_custom.js'
works for me

what version are you using?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
(2014-03-08, 00:31:37)shawn_a Wrote: customConfig : '../../../../theme/cke_custom.js'
works for me

what version are you using?

Thank you Shawn, your certainty made me dig it deeper just to find it out!
I'm using the latest 3.3.1 GS version with patched CKEditor 4.3.2.

Solution and problems you may confront

This is the path to my template where is config.js and styles.js stored.
Code:
http://tomasjanecek.cz/theme/TJv2/ckeditor/
Obviously, config.js contains my custom settings of CKEditor and style.js contains classes which can be added via CKEditor.

1st important thing
- you can't set both the styles and config separately with those two lines I posted. As you can see, both (define('GSEDITOROPTIONS',"stylesSet: ...
AND define('GSEDITOROPTIONS', "entities : false,customConfig : ...) start with "GSEDITOROPTIONS. Therefore, only the thing you define first will take effect. If you want to set both custom styles and custom config, you have to join both settings into one GSEDITOROPTIONS definitions (see below).

2nd important thing
- you can use relative URLs for both styles and config.

3rd important thing
- when defining custom config file, you have to change the part with editor skin at the end to some that exists in your /CKEditor/skins folder:
Code:
,skin: 'v2'");
for
,skin: 'getsimple'"); OR ,skin: 'kama'"); OR ,skin: 'moono'"); OR ,skin: 'moonocolor'");
These I named there are the ones that are present in current GS with patched CKEditor to 4.3.2.

At the end, you end up with the following code or similar:
Code:
define('GSEDITOROPTIONS', "stylesSet: 'default:../../../../theme/TJv2/ckeditor/styles.js', entities : false,customConfig : '../../../../theme/TJv2/ckeditor/config.js', skin: 'getsimple'");
Works like a charm Smile


So after the hours digging into it, I would like to ask someone who takes care of the wiki to update the information there.


Furthermore, I would like to ask Shawn to change the default settings of CKEditor in the "link" popup, tab advanced. On one hand, there are some useless settings like access key, name or tab index. On the other hand, there is title="" attribute missing.
I suggest to remove those useless attributes by adding these lines to line +-60
Code:
advTab.remove( 'advTabIndex');
advTab.remove( 'advAccessKey');
advTab.remove( 'advName' );
and to add title attribute setting by removing line 59 in config.js
Code:
advTab.remove( 'advTitle' );


Thank you for making me dig into it to find the solution and please, consider the two paragraphs above this line.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#6
GSEDITOROPTIONS is a js object so
key: value, pairs ( never comma after last one )

You cannot define anything more than once, that is what a definition is, usually you get php errors from this.
always check error.txt when you are figuring something out, should be the first thing you do.

No clue what the skins thing is about ( edit oh you copied the example verbatim, just remove that, you are not setting a skin )

noone takes care of the wiki, its a wiki, everyone takes care of it, or noone....

There are gseditoroptions all over forums. Connie has written alot about them

heres mine

PHP Code:
define('GSEDITOROPTIONS',
"enterMode: CKEDITOR.ENTER_BR,
shiftEnterMode : CKEDITOR.ENTER_P,
scayt_autoStartup:false,
customConfig : '../../../../theme/cke_custom.js'
"
); 
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
Also if you are using a custom config just move all that junk into it instead.
and just leave the customConfig in there

You have to make a copy of the config.js first into yours or else it wont work at all
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#8
wiki thread http://get-simple.info/forums/showthread...6#pid43556
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#9
I admit this is probably overly complicated, and the fact that you cannot load multiple configs in ckeditor that I know of , I assumed that configs would load then custom overriding, but that is not how it works, and it was already decided to move all gs custom stuff into it so that it was portable, all plugins could use it with no special php functions, also it made upgrading ckeditor a hell of a lot easier now.

3.4 will automatically load ckeditor customizations like these as it does editor.css
and perhaps the config can be smaller, but now it lets you modify everything we do to it thats custom righ tin the config.js file
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
This is how I do it.

PHP Code:
define('GSEDITOROPTIONS',"toolbar:'none',customConfig : '../../../../theme/cke_custom.js'"); 
and then in
my custom config

Code:
    config.toolbar_custom = [
            ['Cut','Copy','Paste','PasteFromWord','-','Undo','Redo','Find','Replace','-','SelectAll'],
        '/',['Table', 'TextColor', 'BGColor', 'Link','Unlink','Anchor', 'Image','SpecialChar','HorizontalRule', 'PageBreak','RemoveFormat','ShowBlocks', 'Source'],
        '/',[ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ],
        '/',['Bold', 'Italic', 'Underline','-','Strike','Subscript','Superscript','-','NumberedList', 'BulletedList', '-','Indent','Outdent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','Blockquote','CreateDiv' ],
        '/',['Styles','Format','Font','FontSize','Preview','Templates','SpellChecker','Scayt','slimbox','about']
    ];
    config.toolbar =  'custom';
// other crap ... config.

Only problem is if you need to override something inline you cannot, you must override it with gseditortools, eg. filebrowserBrowseUrl etc. check edit.php for the inline stuff.

I am trying to figure out the best way to redo all this so it can all be done with a custom config you can leave in your installs and not have to edit anything. But the inline stuff had to stay to keep major plugins working.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#11
I just didn't know that there are more GSEDITOROPTIONS and in that case, you can separate each with a comma.

shawn_a Wrote:You cannot define anything more than once, that is what a definition is, usually you get php errors from this.
always check error.txt when you are figuring something out, should be the first thing you do.
That makes sense. I did not know about errorlog.txt at all, always turned debug mode on and looked at the errors on the screen.


shawn_a Wrote:noone takes care of the wiki, its a wiki, everyone takes care of it, or noone....
Alright, I did not know that anyone can edit it (as it look differently), I always looked at it as a guide, not a wiki like wikipedia which is for everyone made by everyone.

(2014-03-08, 05:15:55)shawn_a Wrote: Also if you are using a custom config just move all that junk into it instead.
and just leave the customConfig in there

You have to make a copy of the config.js first into yours or else it wont work at all
That's what I did, I just wanted to point out that the default setting supplied with GetSimple might be better.

(2014-03-08, 05:27:44)shawn_a Wrote: I admit this is probably overly complicated, and the fact that you cannot load multiple configs in ckeditor that I know of , I assumed that configs would load then custom overriding, but that is not how it works, and it was already decided to move all gs custom stuff into it so that it was portable, all plugins could use it with no special php functions, also it made upgrading ckeditor a hell of a lot easier now.
It's okay as it is now, I just wasn't aware of that so it was a kind of fight to find it out.

(2014-03-08, 08:12:53)shawn_a Wrote: Only problem is if you need to override something inline you cannot, you must override it with gseditortools, eg. filebrowserBrowseUrl etc. check edit.php for the inline stuff.

I am trying to figure out the best way to redo all this so it can all be done with a custom config you can leave in your installs and not have to edit anything. But the inline stuff had to stay to keep major plugins working.

I'm defining the editor toolbar options with GSEDITORTOOL separately, I don't see any problems there. And it's I didn't have to add anything about this at the GSEDITOROPTIONS, so this is pretty straightforward.

It look like this, though I will have to go through all the options and maybe add something more but still keep it simple.

Code:
# WYSIWYG toolbars (advanced, basic or [custom config])
define('GSEDITORTOOL',"['Source', '-', 'Preview'],
  ['Paste', '-', 'SpellChecker', 'Scayt'],
  ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
  ['Image' ,'IMCE', 'MediaEmbed', 'Table', 'HorizontalRule'],
  ['Maximize', 'ShowBlocks'],
  '/',
  ['Bold', 'Italic', '-', 'Subscript', 'Superscript'],
  ['NumberedList', 'BulletedList'],
  ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
  ['Link', 'Unlink'],
  '/',
  ['Styles', 'Format']
");

Thank you for your attention.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply




Users browsing this thread: 1 Guest(s)