mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 20:56:54 +08:00
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:
@ -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}"
|
||||
|
Reference in New Issue
Block a user