Closed (fixed)
Project:
Ace Code Editor
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Dec 2022 at 18:39 UTC
Updated:
7 Sep 2026 at 22:50 UTC
Jump to comment: Most recent, Most recent file
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.
Comment #13
rajab natshahFixed on 2.0.x: the library directory is published in drupalSettings and applied to ace.config, so the dynamically loaded mode, theme and worker files resolve however the script is delivered.
Comment #15
rajab natshah✅ Released ace_editor-2.0.4