From f07a1e529e4a5d997de1c58282a201e973317893 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 27 Feb 2019 21:59:57 +0100 Subject: [PATCH] add-edit-command component is capable of adding commands --- src/ext/conf/ActionList.js | 4 +-- .../add-edit-action-popup.vue | 26 +++++++++++++++++-- .../command-builder/command-add-edit.vue | 19 +++++++++----- .../command-builder/command-chain.vue | 2 ++ .../controls-settings/controls-settings.vue | 5 ++++ 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/ext/conf/ActionList.js b/src/ext/conf/ActionList.js index 9cdcfd3..5b3f4ef 100644 --- a/src/ext/conf/ActionList.js +++ b/src/ext/conf/ActionList.js @@ -43,8 +43,8 @@ var ActionList = { name: 'Thin borders', arg: Stretch.Conditional, },{ - name: Stretch.Default, - arg: -1, + name: 'Default', + arg: Stretch.Default, scopes: { site: true } diff --git a/src/options/controls-settings/add-edit-action-popup.vue b/src/options/controls-settings/add-edit-action-popup.vue index 74d394e..59b10c1 100644 --- a/src/options/controls-settings/add-edit-action-popup.vue +++ b/src/options/controls-settings/add-edit-action-popup.vue @@ -12,9 +12,16 @@ @new-command="addNewCommand()" > +
+        Action:
+        {{action}}
+        ----
+      
@@ -118,7 +125,7 @@ export default { cmd: [], }, addEditCommand: false, - currentCmd: {}, + currentCmdIndex: -1, } }, created () { @@ -148,8 +155,23 @@ export default { }, addNewCommand() { - this.currentCmd = {}; + this.currentCmdIndex = -1; this.addEditCommand = true; + console.log("adding command") + }, + updateCommand(action, arg) { + this.addEditCommand = false; + if (this.currentCmdIndex < 0) { + this.action.cmd.push({ + cmd: action, + arg: arg, + }); + } else { + this.action.cmd[this.currentCmdIndex] = { + cmd: action, + arg: arg, + }; + } } } } diff --git a/src/options/controls-settings/command-builder/command-add-edit.vue b/src/options/controls-settings/command-builder/command-add-edit.vue index d8065a1..22848f3 100644 --- a/src/options/controls-settings/command-builder/command-add-edit.vue +++ b/src/options/controls-settings/command-builder/command-add-edit.vue @@ -1,6 +1,10 @@