diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue
index c83eeed..7c95e7c 100644
--- a/src/components/CommandEditor.vue
+++ b/src/components/CommandEditor.vue
@@ -373,9 +373,8 @@ export default {
runCurrentCommand() {
let command = _.cloneDeep(this.quickcommandInfo);
command.output =
- this.$refs.sidebar?.currentCommand.output || command.program === "html"
- ? "html"
- : "text";
+ this.$refs.sidebar?.currentCommand.output ||
+ (command.program === "html" ? "html" : "text");
command.cmdType = this.$refs.sidebar?.cmdType.name;
this.$refs.result.runCurrentCommand(command);
},
diff --git a/src/components/quickcommandUI/WaitButton.vue b/src/components/quickcommandUI/WaitButton.vue
new file mode 100644
index 0000000..3e86f8c
--- /dev/null
+++ b/src/components/quickcommandUI/WaitButton.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/js/quickcommand.js b/src/js/quickcommand.js
index 0d835a7..b1d4ab9 100644
--- a/src/js/quickcommand.js
+++ b/src/js/quickcommand.js
@@ -11,6 +11,7 @@ import inputBox from "../components/quickcommandUI/InputBox"
import buttonBox from "../components/quickcommandUI/ButtonBox"
import TextArea from "../components/quickcommandUI/TextArea"
import SelectList from "../components/quickcommandUI/SelectList"
+import WaitButton from "../components/quickcommandUI/waitButton"
const quickcommand = {
showInputBox: (options = ["请输入"], title = "") => new Promise((reslove, reject) => {
@@ -112,6 +113,19 @@ const quickcommand = {
console.log('取消')
})
}),
+
+ showWaitButton: (callback, label = "确定") => {
+ Dialog.create({
+ component: WaitButton,
+ componentProps: {
+ label
+ }
+ }).onOk(() => {
+ callback()
+ }).onCancel(() => {
+ console.log('取消')
+ })
+ }
}
-export default quickcommand
\ No newline at end of file
+export default quickcommand
diff --git a/src/plugins/monaco/types/quickcommand.api.d.ts b/src/plugins/monaco/types/quickcommand.api.d.ts
index 44e382b..2902f12 100644
--- a/src/plugins/monaco/types/quickcommand.api.d.ts
+++ b/src/plugins/monaco/types/quickcommand.api.d.ts
@@ -157,7 +157,20 @@ interface quickcommandApi {
* @param message 提示的内容
* @param title 提示的标题
*/
- showConfirmBox(message?: string, title?: string): Promise;
+ showConfirmBox(message?: string, title?: string): Promise;
+
+ /**
+ * 显示等待用户操作的按钮,用户点击后执行相关操作
+ *
+ * ```js
+ * quickcommand.showWaitButton(() => {
+ * stopRunning()
+ * }, "停止运行")
+ * ```
+ * @param callback 点击后的回调
+ * @param label 按钮的标题
+ */
+ showWaitButton(callback, label?: string): void;
/**
* 同步等待,会阻塞进程