Forum

Thread tagged as: Problem, Redactor, CKEditor

v3 editor woes

I'm having a real headache with editors in v3.

Redactor (included): 1) When I click on image or file buttons, nothing happens and there are no console errors: https://jmp.sh/qZdODNp (same as https://forum.grabaperch.com/forum/10-10-2017-blog-post-images)

2) I cannot make sense of how to customise the Redactor buttons - I am trying to marry up the Perch docs (https://docs.grabaperch.com/api/editors/) with the Redactor docs (https://imperavi.com/redactor/docs/toolbar/) and I am really confused.

For example, how do you remove a button?

How do you change the available formats in the format dropdown?

https://docs.grabaperch.com/api/editors/#custom-configurations-for-default-editors vs https://imperavi.com/redactor/examples/formatting/

I saw this post (https://forum.grabaperch.com/forum/04-13-2017-redactor-plugins-in-perch-3) but Redactor is no longer a Perch Add-on available for download.

So I gave up on Redactor, and went to CKEditor. I can customise this in /plugins/addons/editors/ck-editor/ck-editor-4/config.js via https://ckeditor.com/latest/samples/toolbarconfigurator/index.html#basic ...but:

1) Images uploaded do not go into Assets

2) I've enabled some buttons that still aren't showing (e.g. iframe)

Is there a tutorial or guidance on this? Heeeeelp!

I should also add that there were console errors when I added CKEditor but did not have a config.js file in the root of editors - fixed once I added that file (despite it being blank).

Diagnostics: https://pastebin.com/ptjUEtr6

Keir Moffatt

Keir Moffatt 0 points

  • 3 years ago

I have also come across a lot of problems when trying to use the bundled version of Redactor in Perch 3. Customisation is very confusing, where's in the old Redactor add on it was very straight forward and worked well. I'm unsure how to make any customisation outside of the core folder so that when perch is updated you don't overwrite everything you have done. Image editing has suddenly become non existent and I have had a lot of complaints from clients since updating to Perch 3. Where you used to be able to add an image and resize it and align it on the page now it seems all we get is [cms:asset 2087 width=100] ... pretty confusing for editors.

Overall it seems what used to be a nice clean useful WYSIWYG editor is now a real PITA...unless there is some nice documentation somewhere to follow??

Drew McLellan

Drew McLellan 2638 points
Perch Support

When I click on image or file buttons, nothing happens and there are no console errors

I've not been able to reproduce that, but I'm trying to.

I cannot make sense of how to customise the Redactor buttons

There's an example at the bottom of the docs you linked to. config is the Redactor config object. So if you want to change the buttons, update config.buttons. If you want to change the formatting options, update config.formatting and so on.

CKEditor doesn't have Assets support. It's also an abomination. I wouldn't recommend it.

Thanks Drew - I'll have another crack - just wasn't sure how the Redactor settings came across but I'll do some trial and error. If I succeed, I'll do a tutorial!

I'll try what this chap said re buckets: https://forum.grabaperch.com/forum/10-10-2017-blog-post-images

Drew McLellan

Drew McLellan 2638 points
Perch Support

Rob - if you have issues, you should open your own thread rather than jumping on someone else's. I only happened to see your reply because Keir responded after and it's his thread.

Ok, so I've been focussing first on the image/file button issue. It is something to do with my local environment - the buttons work when I put online.

Trying to compare diagnostics to see if that can shed some light:

LOCAL DIAGNOSTICS: https://pastebin.com/7kNwQtJu

LIVE DIAGNOSTICS: https://pastebin.com/zPjXGTeT

I changed the PHP version to 7~ but that didn't help. Wondering if permissions but not sure.

This thread really helped: https://forum.grabaperch.com/forum/06-28-2017-help-with-customising-redactor-toolbar-with-minimal-buttons

So I added define('PERCH_CUSTOM_EDITOR_CONFIGS', true); to my Perch config.php file.

Then I created the following perch/plugins/editors/config.js file: https://pastebin.com/DX9Nj5UH

I also downloaded the various plugins I needed from https://imperavi.com/redactor/plugins/ and placed them in perch/plugins/editors/redactor-plugins/

Some queries:

1) Why will it not honour my button order? https://jmp.sh/iMzJ7oi

2) Do the plugin script loaders have to be nested in this way? https://jmp.sh/9XYPrre

3) What happened to the image editing UI? https://jmp.sh/zsB5KvK

--

CKEditor doesn't have Assets support. It's also an abomination. I wouldn't recommend it.

It is but, asset support aside, it is providing a more compelling user experience than the current Redactor setup right now.

Regarding the image/file buttons not working, I can confirm as indicated in this post (https://forum.grabaperch.com/forum/10-10-2017-blog-post-images) that explicitly specifying a bucket (e.g. bucket="default") fixes it.

Assets still behaves strangely - only showing certain assets until you change the filter: https://jmp.sh/2oHyTlO

Drew McLellan

Drew McLellan 2638 points
Perch Support

Your images above are 404ing ... did you solve your issue and remove them?

Not sure what you mean re 404ing?

Current status:

1) Managed to customise Redactor except it ignores button order in my config

2) Wondered if there was a tidier way of including plugins rather than nested getScript

3) Redactor no longer provides the image editing UI and inserts image text-code instead of the actual image (e.g. [cms:asset 19]​​)

4) Resolved local issue of image/file not working by manually specifying bucket="default"

5) The Assets UI behaves strangely (but perhaps this should be a new thread?):

  • Click 'image' and Assets initially shows just images but when clicking any other filter, suddenly videos are shown too
  • Or, click 'file' and Assets initially shows just videos but when clicking any other filter, suddenly images are shown too

See: https://jmp.sh/1rcjHeU

Drew McLellan

Drew McLellan 2638 points
Perch Support

Not sure what you mean re 404ing?

I mean when I try to view them I get an HTTP 404 - they can't be found.

Ah, re-linked them - hotlinking probably wasn't working.