FEATURE: add JavaScript mode to ace (#27586)

This allows plugins to use Ace Editor in JavaScript mode. This will be used in Discourse AI when defining custom tools.
This commit is contained in:
Sam 2024-06-24 13:38:24 +10:00 committed by GitHub
parent 4cbe5e0606
commit cb3456e18f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 3 deletions

View File

@ -27,6 +27,11 @@ module("Integration | Component | ace-editor", function (hooks) {
assert.ok(exists(".ace_editor"), "it renders the ace editor"); assert.ok(exists(".ace_editor"), "it renders the ace editor");
}); });
test("javascript editor", async function (assert) {
await render(hbs`<AceEditor @mode="javascript" @content="test: true" />`);
assert.ok(exists(".ace_editor"), "it renders the ace editor");
});
test("disabled editor", async function (assert) { test("disabled editor", async function (assert) {
await render(hbs` await render(hbs`
<AceEditor @mode="sql" @content="SELECT * FROM users" @disabled={{true}} /> <AceEditor @mode="sql" @content="SELECT * FROM users" @disabled={{true}} />

View File

@ -250,9 +250,15 @@ task "javascript:update" => "clean_up" do
ace_root = "#{library_src}/ace-builds/src-min-noconflict/" ace_root = "#{library_src}/ace-builds/src-min-noconflict/"
addtl_files = %w[ext-searchbox mode-html mode-scss mode-sql mode-yaml worker-html].concat( addtl_files = %w[
themes, ext-searchbox
) mode-html
mode-javascript
mode-scss
mode-sql
mode-yaml
worker-html
].concat(themes)
dest_path = dest.split("/")[0..-2].join("/") dest_path = dest.split("/")[0..-2].join("/")
addtl_files.each { |file| FileUtils.cp_r("#{ace_root}#{file}.js", dest_path) } addtl_files.each { |file| FileUtils.cp_r("#{ace_root}#{file}.js", dest_path) }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long