Fix scopes and shortcut button for add action
This commit is contained in:
parent
812f3e6b69
commit
76ff4da77f
@ -107,9 +107,7 @@ export default {
|
|||||||
name: 'New action',
|
name: 'New action',
|
||||||
label: 'New action',
|
label: 'New action',
|
||||||
cmd: [],
|
cmd: [],
|
||||||
scopes: {
|
scopes: {}
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
addEditCommand: false,
|
addEditCommand: false,
|
||||||
currentCmdIndex: -1,
|
currentCmdIndex: -1,
|
||||||
@ -158,7 +156,13 @@ export default {
|
|||||||
this.action.label = newLabel;
|
this.action.label = newLabel;
|
||||||
},
|
},
|
||||||
updateScopes(scope, prop, value) {
|
updateScopes(scope, prop, value) {
|
||||||
|
if(!this.action.scopes[scope]) {
|
||||||
|
this.action.scopes[scope] = {};
|
||||||
|
}
|
||||||
|
this.action.scopes[scope][prop] = value;
|
||||||
|
|
||||||
|
// TODO: remove for release
|
||||||
|
this.action = JSON.parse(JSON.stringify(this.action))
|
||||||
},
|
},
|
||||||
addNewCommand() {
|
addNewCommand() {
|
||||||
this.currentCmdIndex = -1;
|
this.currentCmdIndex = -1;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<div class="flex flex-input flex-grow">
|
<div class="flex flex-input flex-grow">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
v-model="scopeOptions.label"
|
v-model="scopeOptions.label"
|
||||||
@input="setLabel"
|
@input="setLabel($event.target.value)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -50,11 +50,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setLabel(label) {
|
setLabel(label) {
|
||||||
console.log("label")
|
|
||||||
if (label.trim() === '') {
|
if (label.trim() === '') {
|
||||||
label = undefined;
|
label = undefined;
|
||||||
}
|
}
|
||||||
this.$emit(label.trim())
|
this.$emit('set-label', label.trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w100">
|
<div class="w100">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
class="shortcut-change-input"
|
||||||
|
ref="input"
|
||||||
:value="shortcutText"
|
:value="shortcutText"
|
||||||
@focus="initiateKeypress"
|
@focus="initiateKeypress"
|
||||||
@keyup="processKeyup"
|
@keyup="processKeyup"
|
||||||
/>
|
/>
|
||||||
|
<span v-if="shortcut" @click="$emit('set-shortcut')">(Clear shortcut)</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -34,8 +36,7 @@ export default {
|
|||||||
},
|
},
|
||||||
processKeyup(event) {
|
processKeyup(event) {
|
||||||
if (this.waitingForPress) {
|
if (this.waitingForPress) {
|
||||||
console.log("PROCESSING KEY UP", event)
|
const shortcut = {
|
||||||
$emit('set-shortcut', {
|
|
||||||
key: event.key,
|
key: event.key,
|
||||||
ctrlKey: event.ctrlKey,
|
ctrlKey: event.ctrlKey,
|
||||||
metaKey: event.metaKey,
|
metaKey: event.metaKey,
|
||||||
@ -43,7 +44,10 @@ export default {
|
|||||||
shiftKey: event.shiftKey,
|
shiftKey: event.shiftKey,
|
||||||
onKeyUp: true,
|
onKeyUp: true,
|
||||||
onKeyDown: false,
|
onKeyDown: false,
|
||||||
});
|
};
|
||||||
|
this.$emit('set-shortcut', shortcut)
|
||||||
|
this.$refs.input.blur();
|
||||||
|
this.shortcutText = KeyboardShortcutParser.parseShortcut(shortcut);
|
||||||
}
|
}
|
||||||
this.waitingForPress = false;
|
this.waitingForPress = false;
|
||||||
}
|
}
|
||||||
@ -51,6 +55,11 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style style="scss" scoped>
|
||||||
|
.shortcut-change-input {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 0px solid transparent;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user