- Issue created by @nuez
- last update
about 1 year ago Patch Failed to Apply - @nuez opened merge request.
The drupalSettings
global object is first built by using values in the html <script[data-drupal-selector="drupal-settings-json]>
tag.
Additional settings might be added to the global drupalSettings
through ajax requests. Think of ckeditor instances added to text fields that open in a modal.
Sometimes, the drupalSettingsLoader get's reloaded. Since it doesn't check if the drupalSettings already exist, it overwrites whatever was added by taking the values in the html <script[data-drupal-selector="drupal-settings-json]>
.
See drupalSettingsLoader.js
I'm not sure if this can be reproduced easily, but i have bumped into this problem using several contrib modules, (ief, entity_browser, ajax_comments) and have come to the conclusion that this is a core issue.
It should be possible to reproduce this issue writing a test.
1. open an node form in a modal, check that the editor settings are added to drupalSettings using the browser console.
2. Execute an ajax command that sets some drupal setting.
3. Check drupalSettings global in the browser console: editor settings have dissappeared.
Only set drupalSettings based on the data-attribute in HTML if drupalSettings doesn't exist already.
Active
10.2 β¨
Last updated
Affects the content, performance, or handling of Javascript.