I get the console error "Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://www.site.ca/node/1/worker-html.js' failed to load." when using JS aggregation.
The ace editor still works, but I cannot do search, etc, in the editor.
Could be related to https://www.drupal.org/project/ace_editor/issues/2090921
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | ace_editor-3326303-9.patch | 3.54 KB | klaasvw |
| #6 | ace_editor-js-aggregation-error-3326303-6.patch | 3.38 KB | angrytoast |
| #5 | ace_editor-js-aggregation-error-3326303-5.patch | 2.8 KB | angrytoast |
Issue fork ace_editor-3326303
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 #2
jglynn commentedAlso related to https://www.drupal.org/project/ace_editor/issues/2659476
Comment #3
angrytoast commentedAdding a patch for this bug that looks to work for both
1.4.0and2.0.0-alpha1as of 2023-07-05.It adds a general
setup.jsthat callsace.config.set('basePath')to make sure it has the value of the discovered library path from the module.Comment #4
angrytoast commentedComment #5
angrytoast commentedA quick update to the previous patch in #3. Currently
ace_editor_lib_pathdoesn't cache its discovered library path so it must run through the filesystem each time it is run. Because the patch adds ahook_page_attachmentsimplementation to populatedrupalSettings, it's helpful to cache the path for future use.A better solution would be to introduce a service that can be used in both procedural code and the various plugins this module provides but that seems like a bigger refactor that should be tackled separately.
Comment #6
angrytoast commentedFollowing up again, here's a slightly different approach that limits the
drupalSettingsaddition by not usinghook_page_attachments. Instead it adds them in the respective plugin files so that it's only added when needed, which feels better.That said, we only use the filter functionality. I can confirm it works there, but can't confirm for the AceFormatter use case. I'm also not familiar with editor plugins so the
base_pathisn't added there todrupalSettingsand will need more work.In summary:
drupalSettings.ace_editor.base_pathto every pageComment #7
rajab natshahNeeds an updated issue fork and MR for the
2.0.xbranchComment #10
klaasvw commentedI've pushed a MR again 2.0.x containing the changes from #5.
This version will only add the setting if one of the ace_editor libraries is loaded.
Also note that not only the Ace basePath is set but also the theme-, worker- and modePath.
Comment #11
psf_ commentedHi,
#10 works for me using "ace_editor" 2.0.1 on Drupal 10.3.10.
Before installing the patch, the "ace formatter" didn't display themes, and there was no syntax highlighting.