Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOLVED CKeditor Plugins (6 Questions)(& switching to CKeditor 4)
#1
Ok, a good rich text editor (CKeditor) is about 60% of any CMS, so it's crucially important.   There's a wealth of great plugins at the CKeditor site.   But... 14 hours later, I'm still having trouble getting any of them or their configs to work!  
1:   - - One problem is the contradictory, minimal docs on how to install.
I put them in their plugin folder:  \admin\template\js\ckeditor\plugins
then I go to \ckeditor\config.js  and, as per the docs, enter for example the great 'autogrow' plugin:
config.extraPlugins = 'autogrow';  
But, it fails with any plugin!  However I figured out a hack that sometimes works:   I go to:  \ckeditor\ckeditor.js, do a search through 1000s of jumbled  (no whitespace!) lines of code for:  'extraPlugins' and put this:  extraPlugins:'autogrow',
That works on this plugin.  Not on other plugins. 
- - -
2. - - What format to add multible plugins here?  I think it is:  extraPlugins:'autogrow,textselection,autocorrect',
But nothing works.
- - -
3. - -   I haven't yet found other plugins that work.  (can anyone reocmmedn ones that work, just for testing sake?)  Part of the problem is the CKeditor site only lists plugin versions for CKE v4+.    And GetSimple uses the ancient 3+.  I need these plugins now, now a year from now.   Being open source, the old versions SHOULD be available on some archive site, but googling I couldn't find them.  Anyone know?
- - -
4.   - - So, okay, I try the GSCkePatch of Shawn, to update CK to v4.   But the patch really confuses me.  It puts a whole new, 2nd CKeditor in the GS plugin folder:   sitename\plugins\GSCkePatch\js\ckeditor
Now we have 2 sets of config.js and ckeditor.js files, etc.  Which ones to edit?  Well, I tried editing one, then the other.  Nothing worked.  Not even the autogrow plugin this time.   So I disabled the patch.
- - -
5.   - - Ok, I'd really rather just download the new CKeditor v4.4 and copy it into/over the original GS folder:  \admin\template\js\ckeditor
Then make any necessary changes that you recommend here.   Can that work?  I really HOPE!   Any recommendations?
- - -
6: - - And lastly, CKeditor allws changing the default 'strong' tag to 'b' tag, according to its documentation here: http://docs.ckeditor.com/#!/api/CKEDITOR.config
by typing this:
  config.coreStyles_bold = { element: 'b', overrides: 'strong' };
So I put that line in getsimple's ckeditor's config.js file, (again just before the comment areas saying not to edit below).  But nothing happens.  Am I doing something wrong?
- - well...
Thanks much for any and all help.  
————————
Reply
#2
As of Get Simple 3.3.10, CK v4 is being used. (in that CHANGES.MD you'll find it specifies "CKEditor 4.5.9")
Avoid that CKE Patch. It isn't needed (now) and, as you note, does confuse matters.

A little youtube plugin installed for fine for me and should be a pretty straight forward test, though with that one you'll need to remember to add the button to your toolbar to verify it is working properly.
http://ckeditor.com/addon/youtube

As for autogrow behaving a bit differently than the others you are adding in, perhaps it is because autogrow is already included & expected? You'll find it commented out in the CKE config. It looks a bit different than the way we're supposed to install plugins though:
extraPlugins.push('autogrow'); instead of
config.extraPlugins = 'autogrow';
Reply
#3
what they said...

you have that last one backwards

config.coreStyles_bold = { element: 'strong', overrides: 'b' };

This will only affect new elements you add,
Note that the `overrides` part will only work if you have ACF enabled, it is disabled by default in GS, as people complain it changes their code etc. (overrides convert existing elements in your source)
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
Ok, thanks. I will try both of your suggestions, and post results here later. thanks again.
Reply
#5
UPDATE:
I am now using the newset GS, with CKeditor 4.5.  Thanks for that needed update!!   Results:
@Shawn, re#6: I think you misread the CKeditor documentation.  I now have it working, and I did have the code correct, which is:  
config.coreStyles_bold = { element: 'b', overrides: 'strong' };
This correctly now uses the 'b' tag, as I prefer.
Also, I did NOT have to enable ACF, I left the getsimple default setting of 'ture'.
The problem earlier was with CKeditor 3, where it didn't work.
-
As for the 'Autogrow' included plugin, I can't get it to work no matter what I try!  I UNcommentd the line:  extraPlugins.push('autogrow');   and then also its various config lines, like:  config.autoGrow_minHeight   = 200;
I also tried editing directly the ckeditor.js (which worked in CKeditor 3), but nothing works here.  Amy ideas?
====  
Reply
#6
Oh b is the default so i was confused why you would be trying to do that. That shouldnt be necessary then at all. Was your b button doing strong?

Ill test autogrow again but im pretty sure it was working for me.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
Well, CKeditor plugins aren't working for me.
I tried the youtube plugin which was recommended as easy. In ckeditors' config.js I edited this line to read:
config.extraPlugins = extraPlugins.join('youtube,');
However, this caused the ENTIRE Ckeditor box(both the toolbar and the editing area) to disappear!
(I had also edited the gsconfig.php to add the new youtube button. But even when I removed it, the CKeditor remained missing. I had to remove my config.js "config.extraPlugins" edit to get it to come back. )
Reply
#8
(2016-09-11, 13:22:25)shawn_a Wrote: Oh b is the default so i was confused why you would be trying to do that. That shouldnt be necessary then at all. Was your b button doing strong?

Ill test autogrow again but im pretty sure it was working for me.

Yes, it was doing 'strong'.  The CKeditor by default uses the 'strong' and 'em' tags.   You need the overrides code I mentioned above to change this. 
Reply
#9
That is not what I was seeing in my install, which i found odd, since that is modern html.
Let me check again.

also
config.extraPlugins = extraPlugins.join('youtube,');
is wrong syntax, join is like implode for arrays using a delimiter.

we are using an array, use push like the examples show in the file before the join!

Code:
    extraPlugins.push('youtube');
    config.extraPlugins = extraPlugins.join(','); // joins the config string for us

works fine

Be sure to add "Youtube" to your toolbar

you could also do string concatenation ( but then you gotta keep track of your commas , which is why i chose array push

Code:
    config.extraPlugins = extraPlugins.join(',');
    config.extraPlugins += ",youtube";

indeed my editor is now using strong also, very odd, i wonder if it was some config i had enabled when testing that was doing B by default. anyway thanks, i learned something new, i might add that to the config for others to comment out if they need it, although it is not proper html5
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
In my case I added that little youtube plugin with
Code:
config.extraPlugins = 'youtube';
No join, no push, and no comma after 'youtube'

It also worked when I used
Code:
config.extraPlugins = 'youtube,image2';
But I never got around to trying to add a third plugin to that line (which apparently is when it can break for some people?).

I'd not included 'push' simply because I didn't understand what it did. If I am understanding it (above the join line) would allow us to add as many plugins as we'd like without mysterious breakage, correct?
Reply
#11
Yes you just keep pushing plugins onto the array the the code collapses it into the comma delimited string for you, people kept having problems with using string cause you gotta edit the whole thing and make sure you have commas etc.

This also lets you just copy and paste stuff to other people and they do not have to edit anything since you can just paste per line.

You can also wrap them in other code if you wanted to add conditions like if debug mode add these plugins. Without having to do a whiole bunch of + concatenation with comma calculating.

The wiki will have to be updated with this info, it is also worth mentioning that this file will be overwritten on upgrades so i recomend using customconfig and pointing it to a copy outside of admin.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#12
Nice! Thanks Smile
Reply
#13
@Raeven, @Shawn, Thanks so much for both of your info. There is no current documentation on this, so trying to guess the syntax is difficult. This info should be added to the main docs. Anyway, got Raeven's line to work with config.extraPlugins = 'youtube';
But you're saying I can't add more than 2 plugins with this code? I don't fully understand the new push/join stuff; never heard of that in code before. But I'll try it too. (I'm working the next few days, so I may be slow to post).
@Shawn: Any info on how to get autogrow to work? UNcommenting the extraPlugins.push('autogrow'); fails to do anything for me.
Thanks.
Reply
#14
@Shawn, if I understand you correctly, the line: config.extraPlugins = extraPlugins.join(',');
should never be edited, and should come after all the 'push' lines, as it simply joins them into a new array string? If so, perhaps that line should be moved down and placed just after the comment that says: 'DO NOT EDIT BELOW THIS LINE'
??
Reply
#15
(2016-09-13, 13:20:04)Arugula Wrote: But you're saying I can't add more than 2 plugins with this code?

Sorry, you are right - I wasn't very clear at all . Nope, I was saying that while I'd read some (non Get Simple) reports from others mentioning being able to add second plugin and then running into problems, I've not personally tried it and so can't personally confirm that the same isn't an issue with Get Simple. 
But it sounds like using 'push' is the proper approach so now I'll probably switch to that just to be proper.

EDIT: By the way the autogrow plugin does seem to work when I un-comment it, but I'm not really sure if it is working properly. It seems a bit odd to me. The expanded size seems to appear in chunks when I make the editor window the focus. That is to say that when I open a previously created page it looks normal (like it always has). But when I click in the page then it'll suddenly become longer. Not necessarily the length of the contents. By setting the max length to 1600 and viewing a long page I had to click a few times to get it the long enough and then it went ahead and got longer until it was the full 1600 even though the content had already run out further up.

Un-commenting the plugin but failing to un-comment its config settings (minHeight, maxHeight, bottomSpace) was even weirder (the scroll bar disappeared when I clicked its down arrow, and my mouse wheel would not scroll. I had to use keyboard arrows) .
Reply
#16
The docs are a wiki we rely on users to maintain them so feel free.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#17
Well, the good news is that after fooling around some hours with it, I got everything to work!  It turns out that you mustn't ever use the line:    config.extraPlugins = 'youtube';
Because it will interfere and undo all the 'push' lines above it.   if you add all of the plugins with the new 'push' syntax, and simply comment out the line:  // config.extraPlugins =;
Then all is well.  
Thanks much for all the help.
Reply
#18
How do I mark this thread as 'SOLVED' ?
Reply
#19
(2016-09-19, 12:45:42)Arugula Wrote: How do I mark this thread as 'SOLVED'  ?

You edit the first post in the topic (yours) and left to the subject text there's a pulldown-menu where you can change it into solved.
Reply




Users browsing this thread: 1 Guest(s)