Problem/Motivation

AceEditor::getDefaultSettings() and AceFormatter::defaultSettings() both return the whole ace_editor.settings configuration, which includes the theme_list (34 entries) and syntax_list (140 entries) option maps. Those are option sources for the settings form, not settings.

Drupal merges default settings into the saved entity (Editor::__construct() does $this->settings += $plugin->getDefaultSettings()), so every editor or view display saved outside the settings form persists both option lists into editor.editor.*.yml and core.entity_view_display.*.yml. That bloats exported configuration by hundreds of lines per entity and re-introduces "missing schema" errors even once the editor settings schema exists, because the leaked keys are not part of the settings schema.

A second, user-visible failure came from the same area: AceEditor::getJsSettings() read $settings['fieldset'] unguarded, while buildConfigurationForm() already handles both the nested and the flat shape. Configuration created by a recipe, a config import or an older release stores the settings flat, so the editor was handed NULL and the JavaScript failed with "Cannot read properties of null (reading 'theme')", leaving the plain textarea in place.

Steps to reproduce

  • Assign the Ace editor to a text format from configuration (a recipe, a config import, or programmatically) rather than through the format form.
  • Edit content with that format: the editor never attaches and the browser console shows the TypeError above.
  • Export configuration: the editor and any view display using the Ace Format formatter carry the full theme and syntax option lists.

Proposed resolution

  • Return only the actual editor settings from the default-settings methods, excluding the option lists.
  • Accept both the nested and the flat settings shape when building the JavaScript settings, and complete missing keys from the defaults.
  • Guard the JavaScript so a missing setting falls back to a sane default instead of throwing.
  • Add automated coverage for both settings shapes and for empty settings.

Remaining tasks

  • ✅ File an issue
  • ❌ Addition/Change/Update/Fix
  • ❌ Testing to ensure no regression
  • ❌ Automated unit/functional testing coverage
  • ➖ Developer Documentation support
  • ➖ User Guide Documentation support
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • Saved editor and formatter settings no longer carry the theme and syntax option lists.

Release notes snippet

  • Fixed the Ace editor failing to attach when its settings come from configuration created outside the text format form, and stopped the theme and syntax option lists from being written into saved configuration.

Issue fork ace_editor-3618752

Command icon 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

rajab natshah created an issue. See original summary.

  • rajab natshah committed 35b95187 on 2.0.x
    fix: #3618752 Stop the option lists leaking into settings and attach...
rajab natshah’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Issue tags: +ace_editor-2.0.4

✅ Released ace_editor-2.0.4

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.