mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
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:
parent
4cbe5e0606
commit
cb3456e18f
|
@ -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}} />
|
||||||
|
|
|
@ -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) }
|
||||||
|
|
8
public/javascripts/ace.js/1.4.13/mode-javascript.js
Normal file
8
public/javascripts/ace.js/1.4.13/mode-javascript.js
Normal file
File diff suppressed because one or more lines are too long
8
public/javascripts/ace/mode-javascript.js
Normal file
8
public/javascripts/ace/mode-javascript.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user