add-edit-command component is capable of adding commands
This commit is contained in:
parent
9084b8b156
commit
f07a1e529e
@ -43,8 +43,8 @@ var ActionList = {
|
|||||||
name: 'Thin borders',
|
name: 'Thin borders',
|
||||||
arg: Stretch.Conditional,
|
arg: Stretch.Conditional,
|
||||||
},{
|
},{
|
||||||
name: Stretch.Default,
|
name: 'Default',
|
||||||
arg: -1,
|
arg: Stretch.Default,
|
||||||
scopes: {
|
scopes: {
|
||||||
site: true
|
site: true
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,16 @@
|
|||||||
@new-command="addNewCommand()"
|
@new-command="addNewCommand()"
|
||||||
>
|
>
|
||||||
</CommandChain>
|
</CommandChain>
|
||||||
|
<pre>
|
||||||
|
Action:
|
||||||
|
{{action}}
|
||||||
|
----
|
||||||
|
</pre>
|
||||||
<CommandAddEdit class="w100"
|
<CommandAddEdit class="w100"
|
||||||
v-if="addEditCommand"
|
v-if="addEditCommand"
|
||||||
:command="currentCmd"
|
:command="currentCmd"
|
||||||
|
@set-command="updateCommand"
|
||||||
|
@close-popup="addEditCommand=false"
|
||||||
>
|
>
|
||||||
</CommandAddEdit>
|
</CommandAddEdit>
|
||||||
|
|
||||||
@ -118,7 +125,7 @@ export default {
|
|||||||
cmd: [],
|
cmd: [],
|
||||||
},
|
},
|
||||||
addEditCommand: false,
|
addEditCommand: false,
|
||||||
currentCmd: {},
|
currentCmdIndex: -1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@ -148,8 +155,23 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
addNewCommand() {
|
addNewCommand() {
|
||||||
this.currentCmd = {};
|
this.currentCmdIndex = -1;
|
||||||
this.addEditCommand = true;
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
Values:
|
||||||
<div class="window-content">
|
<div class="window-content">
|
||||||
|
<pre>{{action}}</pre>
|
||||||
|
<pre>{{selectedAction}}</pre>
|
||||||
|
<pre>{{selectedArgument}}</pre>
|
||||||
|
|
||||||
<!-- ACTION SELECT -->
|
<!-- ACTION SELECT -->
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
@ -15,6 +19,7 @@
|
|||||||
>
|
>
|
||||||
<option v-for="(action, key) in ActionList"
|
<option v-for="(action, key) in ActionList"
|
||||||
:value="key"
|
:value="key"
|
||||||
|
:key="key"
|
||||||
>
|
>
|
||||||
{{action.name}}
|
{{action.name}}
|
||||||
</option>
|
</option>
|
||||||
@ -31,9 +36,12 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-grow flex-input">
|
<div class="flex flex-grow flex-input">
|
||||||
<select @change="setArgument($event.target.value)">
|
<select class=""
|
||||||
<option v-for="arg of ActionList[selectedAction].args"
|
@change="setArgument($event.target.value)"
|
||||||
:value="arg"
|
>
|
||||||
|
<option v-for="(arg, key) of ActionList[selectedAction].args"
|
||||||
|
:key="key"
|
||||||
|
:value="key"
|
||||||
>
|
>
|
||||||
{{arg.name}}
|
{{arg.name}}
|
||||||
</option>
|
</option>
|
||||||
@ -41,8 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- CUSTOM ARGUMENT INPUT -->
|
<!-- CUSTOM ARGUMENT INPUT -->
|
||||||
<div v-if="selectedArgument && selectedArgument.customArg"
|
<div v-if="selectedArgument && selectedArgument.customArg"
|
||||||
class="flex flex-row">
|
class="flex flex-row">
|
||||||
@ -111,8 +117,7 @@ export default {
|
|||||||
this.customArgumentValue = undefined;
|
this.customArgumentValue = undefined;
|
||||||
},
|
},
|
||||||
setArgument(arg) {
|
setArgument(arg) {
|
||||||
console.log("SETTING ARGUMENT", cmd);
|
this.selectedArgument = ActionList[this.selectedAction].args[arg];
|
||||||
this.selectedArgument = arg;
|
|
||||||
this.customArgumentValue = undefined;
|
this.customArgumentValue = undefined;
|
||||||
},
|
},
|
||||||
emitCommand() {
|
emitCommand() {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
{{command}}
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<CommandBlock v-for="(cmd, index) of command"
|
<CommandBlock v-for="(cmd, index) of command"
|
||||||
|
:key="index"
|
||||||
:command="cmd"
|
:command="cmd"
|
||||||
first
|
first
|
||||||
last
|
last
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-for="(action, index) of settings.active.actions">
|
<template v-for="(action, index) of settings.active.actions">
|
||||||
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-ar'"
|
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-ar'"
|
||||||
|
:key="index"
|
||||||
:action="action"
|
:action="action"
|
||||||
@edit="changeShortcut(index)"
|
@edit="changeShortcut(index)"
|
||||||
>
|
>
|
||||||
@ -20,6 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-for="(action, index) of settings.active.actions">
|
<template v-for="(action, index) of settings.active.actions">
|
||||||
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-stretch'"
|
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-stretch'"
|
||||||
|
:key="index"
|
||||||
:action="action"
|
:action="action"
|
||||||
@edit="changeShortcut(index)"
|
@edit="changeShortcut(index)"
|
||||||
>
|
>
|
||||||
@ -32,6 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-for="(action, index) of settings.active.actions">
|
<template v-for="(action, index) of settings.active.actions">
|
||||||
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-alignment'"
|
<ActionAlt v-if="action.cmd.length === 1 && action.cmd[0].action === 'set-alignment'"
|
||||||
|
:key="index"
|
||||||
:action="action"
|
:action="action"
|
||||||
@edit="changeShortcut(index)"
|
@edit="changeShortcut(index)"
|
||||||
>
|
>
|
||||||
@ -49,6 +52,7 @@
|
|||||||
action.cmd[0].action === 'pan' ||
|
action.cmd[0].action === 'pan' ||
|
||||||
action.cmd[0].action === 'set-pan'
|
action.cmd[0].action === 'set-pan'
|
||||||
)"
|
)"
|
||||||
|
:key="index"
|
||||||
:action="action"
|
:action="action"
|
||||||
@edit="changeShortcut(index)"
|
@edit="changeShortcut(index)"
|
||||||
>
|
>
|
||||||
@ -69,6 +73,7 @@
|
|||||||
action.cmd[0].action !== 'set-stretch' &&
|
action.cmd[0].action !== 'set-stretch' &&
|
||||||
action.cmd[0].action !== 'set-ar'
|
action.cmd[0].action !== 'set-ar'
|
||||||
)"
|
)"
|
||||||
|
:key="index"
|
||||||
:action="action"
|
:action="action"
|
||||||
@edit="changeShortcut(index)"
|
@edit="changeShortcut(index)"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user