[SOLVED] CKEditor custom config - gsconfig.php definition does not work - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: [SOLVED] CKEditor custom config - gsconfig.php definition does not work (/showthread.php?tid=5752) |
[SOLVED] CKEditor custom config - gsconfig.php definition does not work - TeeJay - 2014-03-07 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 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'"); 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. RE: CKEditor custom config - gsconfig.php definition does not work - hameau - 2014-03-07 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. RE: CKEditor custom config - gsconfig.php definition does not work - TeeJay - 2014-03-07 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 Thank you RE: CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 customConfig : '../../../../theme/cke_custom.js' works for me what version are you using? RE: CKEditor custom config - gsconfig.php definition does not work - TeeJay - 2014-03-08 (2014-03-08, 00:31:37)shawn_a Wrote: customConfig : '../../../../theme/cke_custom.js' 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/ 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'"); 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'"); 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'); 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. RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 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', RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 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 RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 wiki thread http://get-simple.info/forums/showthread.php?tid=5324&pid=43556#pid43556 RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 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 RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - shawn_a - 2014-03-08 This is how I do it. PHP Code: define('GSEDITOROPTIONS',"toolbar:'none',customConfig : '../../../../theme/cke_custom.js'"); my custom config Code: config.toolbar_custom = [ 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. RE: [SOLVED] CKEditor custom config - gsconfig.php definition does not work - TeeJay - 2014-03-09 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.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.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'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]) Thank you for your attention. |