Problem/Motivation
The editor module was introduced in #1833716: WYSIWYG: Introduce "Text editors" as part of filter format configuration, to layer Text Editor integration on top of our Text Format concept provided by the filter module.
A major reason for doing this was because we wanted it to be entirely optional: rich text/WYSIWYG editors were frowned upon at the time, especially because they generated poor HTML markup.
Times have changed.
Drupal 8 shipped with CKEditor 4, and everything was nicely decoupled. Custom text editors can be implemented. And they are. We should keep the ability to have different text editors for sure!
But … the split between the filter and editor modules, that is more questionable. It means a lot of extra complexity.
On the form side:
editormodule must alter thefilter_formatform to inject its things. It generates a subform (and subform state) for this, so it can make the text editor configurable and allow theEditorplugin to inject its form.- and in turn, a specific text editor that provides extensibility (such as core's CKEditor module) must generate a subform (and subform state) for every plugin that it accepts.
On the configuration side:
FilterFormatandEditorare two distinct config entity types, and eachEditoris tightly coupled to aFilterFormat- … but it's the end user's responsibility to keep these in sync!
- If/when we add config entity validation (see #3231342: [PP-2] Introduce ConfigEntityForm to standardize use of validation constraints for config entities), this will become worse, because we'll need to always validate a
FilterFormat+Editorpair!
Proposed resolution
Merge them. A single new TextFormat config entity that can optionally contain a text editor — text editors are and should remain optional.
Comments
Comment #3
catchThis seems reasonable to me.
Would editor module still exist to provide the image upload/link/untransformed routes and etc. and we just remove the configuration handling from it?
Comment #4
wim leersIMHO: no, the module would be gone entirely.
We'd have to keep the routes around for BC reasons of course, but there's no reason that the
editor.*routes could not exist incore/modules/text_format/text_format.routing.yml— we have no validation at all around that anyway 🤓Comment #5
wim leersThis would also make #3225033: Whenever "Enable image uploads" is enabled for a text editor, the editor_file_reference filter should be enabled simpler to fix.
Comment #6
catchOK this seems like a good plan, but it might end up being one for 10.1.x or later since it'll have a lot of deprecations we won't want to commit to 9.5.x
Comment #7
wim leersYep, agreed! And … there's no way in hell this would happen in time anyway 😅
Comment #9
longwaveI had not seen this issue before but I came to the same conclusion while reviewing #3270734: Update Editor + CKEditor 5 module to not use CKEditor 4 in tests with Wim.
Do we need the complexity of merging the two existing config entities into a new config entity, or do we just extend
FilterFormatto include an optional editor? editor.module could even still exist if we want to continue separation of concerns - some sites may not provide a WYSIWYG editor at all, but still handle HTML that needs to be filtered. Editor config could be considered a third party setting for a filter format?Comment #10
wim leersThis is definitely how I envisioned this happening!
Not sure yet if that's necessary or desirable. But I'm 70% convinced we should not do that. A lot of complexity lies in form alterations that
editor.modulehas to do. Removing those would be valuable.Using a text editor would definitely remain optional.
I think it'd be simpler to instead have an optional
editorentry in thefilter_formatconfig entity 🤓Comment #12
wim leersSomething interesting just came up that is very closely related to this issue: #2830210-30: Allow tokens to be used in Text Editor/CKEditor 5 image upload directory path.
Comment #14
aaronmchaleJust stopping by to note that, if this is done, we figured out a BC-safe reusable pattern for removing/moving admin paths around. Which we originally did for moving around the Boock types and Custom block library.
Please do feel free to reuse the same pattern.
See #3333383: Create a redirect for the new Block types path.
Oh and just ignore me if there aren't actually any paths to redirect here, but just dropping this in incase it's useful.
Comment #15
wim leersThere aren't 😄 Because
editorhas no admin UI of its own; it already is altering theformatadmin UI!Comment #16
aaronmchaleExcellent! One less thing to worry about then :D
Comment #17
wim leersNote: this should also do #3064957: getJSSettings() is not in lowerCamel format.
Comment #18
wim leersWe should first land #3425349: [PP-1] Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor`, which I'm working on right now 👍
Comment #19
quietone commentedAdding postponed to remaining tasks according to remaining tasks.
Comment #20
catch