Should switching text editors retain image upload settings?

Created on 22 October 2021, over 3 years ago
Updated 8 March 2024, about 1 year ago

Problem/Motivation

Discovered while working on #3245320: Automatic upgrade path always disables image uploads β€” in the UI β†’ .

Root cause:
editor_form_filter_admin_format_editor_configure() does

    elseif (empty($editor) || $editor_value !== $editor->getEditor()) {
      $format = $form_state->getFormObject()->getEntity();
      $editor = Editor::create([
          'format' => $format->isNew() ? NULL : $format->id(),
        'editor' => $editor_value,
      ]);
      $form_state->set('editor', $editor);
    }

It'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 Editor config entity at the top-level, and they even have an API interface: \Drupal\editor\EditorInterface::getImageUploadSettings() + \Drupal\editor\EditorInterface::setImageUploadSettings().

Steps to reproduce

Switch the default Basic HTML text format to use CKEditor 5 and observe the image uploads setting getting turned off.

Proposed resolution

Carry over image upload settings when switching text editor.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
EditorΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024