Problem/Motivation
With the focus on all the complex/tricky parts, we lost sight of the simplest possible thing: the image upload settings!
Steps to reproduce
- Go to Basic HTML text format. Observe that Image Uploads are enabled.
- Switch to CKEditor 5
- Observe that Image Uploads are disabled
Note that this works fine in \Drupal\Tests\ckeditor5\Kernel\SmartDefaultSettingsTest (i.e. when not using the UI), this is only a problem because \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ImageUpload is interacting with global form state; it's unlike all other CKEditor 5 plugins, because its settings are stored "globally" in the Editor config entity.
Therefore this would not affect the automated Drupal 9 → 10 upgrade path, but it would affect anybody trying to use CKEditor 5 in Drupal 9.3/9.4.
Proposed resolution
- Add failing test
- Fix
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Issue fork ckeditor5-3245320
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
wim leersComment #4
wim leersYay, that failing test worked! :D
Now onto fixing this…
Comment #5
wim leersStepped through this with a debugger.
editor_form_filter_admin_format_editor_configure()doesIt's that second condition that allows entering this branch that is true when switching the text editor. While text-editor specific settings cannot be carried over, image upload settings can be, because they're embedded in the
Editorconfig entity at the top-level, and they even have an API interface:\Drupal\editor\EditorInterface::getImageUploadSettings()+\Drupal\editor\EditorInterface::setImageUploadSettings().Created core
editor.modulebug report: #3245351: Should switching text editors retain image upload settings?.Comment #6
wim leersComment #8
wim leersWalked @lauriii through this on a call, he says it totally makes sense 🚢
Comment #10
wim leers