DEV: Refactor ace-editor loading and bump to latest version (#27772)

- Delete vendored copy
- Create a JS entrypoint under `static/` which imports all the modes/themes/extensions we need
- Create an async `load-ace-editor` entrypoint
- Update `<AceEditor` component to use the new entrypoint
- De-jquery-ify `<AceEditor`
- Bump `v1.4.13` -> `v1.35.2`
This commit is contained in:
David Taylor
2024-07-09 10:09:30 +01:00
committed by GitHub
parent 0846862cb5
commit a461eaddc3
27 changed files with 100 additions and 294 deletions

View File

@ -65,7 +65,6 @@ end
def dependencies
[
{ source: "ace-builds/src-min-noconflict/ace.js", destination: "ace.js", public: true },
{
source: "@json-editor/json-editor/dist/jsoneditor.js",
package_name: "@json-editor/json-editor",
@ -237,31 +236,6 @@ task "javascript:update" => "clean_up" do
dest = "#{path}/#{filename}"
FileUtils.mkdir_p(path) unless File.exist?(path)
if src.include? "ace.js"
versions["ace/ace.js"] = versions.delete("ace.js")
themes = %w[theme-chrome theme-chaos]
themes.each do |file|
versions["ace/#{file}.js"] = "#{package_dir_name}/#{package_version}/#{file}.js"
end
ace_root = "#{library_src}/ace-builds/src-min-noconflict/"
addtl_files = %w[
ext-searchbox
mode-html
mode-javascript
mode-scss
mode-sql
mode-yaml
worker-html
].concat(themes)
dest_path = dest.split("/")[0..-2].join("/")
addtl_files.each { |file| FileUtils.cp_r("#{ace_root}#{file}.js", dest_path) }
end
end
else
dest = "#{vendor_js}/#{filename}"