Settings/control: save keyboard shortcuts
This commit is contained in:
parent
9b808a2c36
commit
6435862daa
@ -168,6 +168,10 @@ class Settings {
|
|||||||
this.set(this.active);
|
this.set(this.active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async rollback() {
|
||||||
|
this.active = await this.get();
|
||||||
|
}
|
||||||
|
|
||||||
getDefaultSettings() {
|
getDefaultSettings() {
|
||||||
return JSON.parse(JSON.stringify(this.default));
|
return JSON.parse(JSON.stringify(this.default));
|
||||||
}
|
}
|
||||||
|
@ -81,13 +81,23 @@
|
|||||||
@set-shortcut="updateScopes('page', 'shortcut', $event)"
|
@set-shortcut="updateScopes('page', 'shortcut', $event)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div class="flex flex-row flex-end">
|
||||||
|
<ShortcutButton class="flex b3 button"
|
||||||
|
label="Save"
|
||||||
|
@click.native="saveSettings()"
|
||||||
|
/>
|
||||||
|
<ShortcutButton class="flex b3 button"
|
||||||
|
label="Cancel"
|
||||||
|
@click.native="cancel()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ShortcutButton from '../../common/components/shortcut-button.vue'
|
||||||
import Stretch from '../../common/enums/stretch.enum';
|
import Stretch from '../../common/enums/stretch.enum';
|
||||||
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
|
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
|
||||||
import CommandChain from './command-builder/command-chain';
|
import CommandChain from './command-builder/command-chain';
|
||||||
@ -103,6 +113,7 @@ export default {
|
|||||||
CommandChain: CommandChain,
|
CommandChain: CommandChain,
|
||||||
CommandAddEdit: CommandAddEdit,
|
CommandAddEdit: CommandAddEdit,
|
||||||
ScopeSettings,
|
ScopeSettings,
|
||||||
|
ShortcutButton
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -186,13 +197,11 @@ export default {
|
|||||||
this.currentCmdIndex = -1;
|
this.currentCmdIndex = -1;
|
||||||
this.currentCmd = undefined;
|
this.currentCmd = undefined;
|
||||||
this.addEditCommand = true;
|
this.addEditCommand = true;
|
||||||
console.log("adding command")
|
|
||||||
},
|
},
|
||||||
editCommand(index) {
|
editCommand(index) {
|
||||||
this.currentCmdIndex = index;
|
this.currentCmdIndex = index;
|
||||||
this.currentCmd = this.action.cmd[index];
|
this.currentCmd = this.action.cmd[index];
|
||||||
this.addEditCommand = true;
|
this.addEditCommand = true;
|
||||||
console.log("EDITING COMMAND")
|
|
||||||
},
|
},
|
||||||
deleteCommand(index) {
|
deleteCommand(index) {
|
||||||
this.action.cmd.splice(index,1);
|
this.action.cmd.splice(index,1);
|
||||||
@ -200,8 +209,6 @@ export default {
|
|||||||
updateCommand(action, arg, customArg) {
|
updateCommand(action, arg, customArg) {
|
||||||
this.addEditCommand = false;
|
this.addEditCommand = false;
|
||||||
|
|
||||||
console.log("update command received. args:", {action, arg, customArg})
|
|
||||||
|
|
||||||
if (this.currentCmdIndex < 0) {
|
if (this.currentCmdIndex < 0) {
|
||||||
this.action.cmd.push({
|
this.action.cmd.push({
|
||||||
action: action,
|
action: action,
|
||||||
@ -216,6 +223,17 @@ export default {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.action = JSON.parse(JSON.stringify(this.action));
|
this.action = JSON.parse(JSON.stringify(this.action));
|
||||||
|
},
|
||||||
|
saveSettings() {
|
||||||
|
this.settings.save();
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.settings.rollback();
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,5 +284,18 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin-left: 1em;
|
||||||
|
margin-right: 1em;
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
padding-top: 0.4em;
|
||||||
|
width: 4em;
|
||||||
|
text-align: center;
|
||||||
|
background-color: rgba(0,0,0,0.66);
|
||||||
|
color: #ffc;
|
||||||
|
height: 1.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
align-content: center;
|
align-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex-end {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
.flex-cross-center {
|
.flex-cross-center {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user