Skip to content

Commit

Permalink
DEV: add @submit hook for ace editor (discourse#28010)
Browse files Browse the repository at this point in the history
* DEV: add @commit hook for ace editor

Add @commit hook to AceEditor to handle "save and run" in Data Explorer
  • Loading branch information
Lhcfl authored Jul 22, 2024
1 parent fb7cc2d commit 0eeebeb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/assets/javascripts/discourse/app/components/ace-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ export default class AceEditor extends Component {
bindKey: { mac: "cmd-s", win: "ctrl-s" },
});
}
if (this.submit) {
editor.commands.addCommand({
name: "submit",
exec: () => {
this.submit();
},
bindKey: { mac: "cmd-enter", win: "ctrl-enter" },
});
}

editor.on("blur", () => {
this.warnSCSSDeprecations();
Expand Down

0 comments on commit 0eeebeb

Please sign in to comment.