Added some more commands and mades some quality of life improvements
All checks were successful
Build / build (push) Successful in 4m27s
All checks were successful
Build / build (push) Successful in 4m27s
This commit is contained in:
parent
3a23118036
commit
3cb5795ca5
17 changed files with 432 additions and 75 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import {ListProcessors} from "../../wailsjs/go/main/App";
|
||||
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
import { textProcessor } from "../services.js";
|
||||
|
|
@ -8,7 +10,16 @@ export class CommandsController extends Controller {
|
|||
"commandSelect",
|
||||
];
|
||||
|
||||
connect() {
|
||||
async connect() {
|
||||
this._lastCommand = null;
|
||||
|
||||
let processors = await ListProcessors();
|
||||
processors.forEach((processor) => {
|
||||
let option = document.createElement("option");
|
||||
option.value = processor.name;
|
||||
option.text = processor.label;
|
||||
this.commandSelectTarget.appendChild(option);
|
||||
});
|
||||
this._options = Array.from(this.commandSelectTarget.options);
|
||||
}
|
||||
|
||||
|
|
@ -29,13 +40,29 @@ export class CommandsController extends Controller {
|
|||
this.element.close();
|
||||
}
|
||||
|
||||
focusSelect(ev) {
|
||||
this.commandSelectTarget.focus();
|
||||
}
|
||||
|
||||
runCommand(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
textProcessor.runTextCommand(this.commandSelectTarget.value);
|
||||
this._lastCommand = this.commandSelectTarget.value;
|
||||
|
||||
this.element.close();
|
||||
}
|
||||
|
||||
rerunLastCommand(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
if (this._lastCommand === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
textProcessor.runTextCommand(this._lastCommand);
|
||||
}
|
||||
|
||||
_filterOptions(filterText) {
|
||||
let inputText = filterText.toLowerCase();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue