0
votes

In the context of a custom CMS, I have replaced the default 'Link' and 'Image' buttons with my own dialogs and commands to be able to link to existing CMS pages and files by selecting them from my custom dialogs.

In older versions of CKEditor, there was no ACF, so this was no problem.

In 4.1+, if I do not include the original 'Link' and 'Image' buttons, the results from my new buttons get filtered by the ACF. The plugins themselves work just fine, but I can't figure out how to get the ACF to automatically allow links and images.

* I AM NOT INTERESTED IN DISABLING THE ACF *, I just want the plugins to behave.

Example toolbar configuration that allows my buttons (LinkContent, ImageSelect, and FileSelect) to work:

{ name: 'links',       items : [ 'Link', 'LinkContent', 'Image', 'ImageSelect', 'FileSelect' ] }

If I use the following, the content from my buttons is filtered out:

{ name: 'links',       items : [ 'LinkContent', 'ImageSelect', 'FileSelect' ] }

In my plugin definitions, I have added what I thought was the appropriate ACF settings. In my ImageSelect plugin file:

CKEDITOR.plugins.add('imageselector', {

init: function( editor ) {

    editor.addCommand( 'imageselectorDialog', new CKEDITOR.dialogCommand ( 'imageselectorDialog', {
        allowedContent: 'img[alt,!src]{width,height}',
        requiredContent: 'img',
        exec: function( editor ) {
...

Would love to find out how to correct this without having to include the default buttons alongside my own.

1

1 Answers

0
votes

Okay, so my solution is actually correct. As has been the case with most CKEditor frustrations, the reason it looked incorrect is because CKEditor tends to be very persistent with its caching (* not actually cached by CKEditor -- see comments below).

After my changes were pulled into someone else's checkout, the plugins worked perfectly.

Lesson -- Completely clear your cache with EVERY change when trying to debug CKEditor problems.

EDIT -- clarified that caching is not done by CKEditor because someone complained.