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