mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-30 04:30:01 +08:00
🚧 WIP: handle shortcut setting time
This commit is contained in:
@@ -91,29 +91,6 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="修改快捷键"
|
||||
:visible.sync="keyBindingVisible"
|
||||
>
|
||||
<el-form
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item
|
||||
label="快捷上传"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
@keydown.native.prevent="keyDetect('upload', $event)"
|
||||
v-model="shortKey.upload"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelKeyBinding">取消</el-button>
|
||||
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="自定义链接格式"
|
||||
:visible.sync="customLinkVisible"
|
||||
|
||||
@@ -120,30 +120,6 @@
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
title="修改上传快捷键"
|
||||
:visible.sync="keyBindingVisible"
|
||||
:modal-append-to-body="false"
|
||||
>
|
||||
<el-form
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item
|
||||
label="快捷上传"
|
||||
>
|
||||
<el-input
|
||||
class="align-center"
|
||||
@keydown.native.prevent="keyDetect('upload', $event)"
|
||||
v-model="shortKey.upload"
|
||||
:autofocus="true"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelKeyBinding" round>取消</el-button>
|
||||
<el-button type="primary" @click="confirmKeyBinding" round>确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="自定义链接格式"
|
||||
:visible.sync="customLinkVisible"
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<el-button
|
||||
class="edit"
|
||||
size="mini"
|
||||
@click="openKeyBindingDialog(scope.row.name)"
|
||||
@click="openKeyBindingDialog(scope.row.name, scope.$index)"
|
||||
type="text">
|
||||
编辑
|
||||
</el-button>
|
||||
@@ -102,13 +102,19 @@ export default {
|
||||
list: [],
|
||||
keyBindingVisible: false,
|
||||
shortKeyName: '',
|
||||
shortKey: ''
|
||||
shortKey: '',
|
||||
currentIndex: 0
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const shortKeyConfig = this.$db.get('settings.shortKey')
|
||||
this.list = Object.keys(shortKeyConfig).map(item => shortKeyConfig[item])
|
||||
},
|
||||
watch: {
|
||||
keyBindingVisible (val) {
|
||||
this.$electron.ipcRenderer.send('toggleShortKeyModifiedMode', val)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calcOrigin (item) {
|
||||
const [origin] = item.split(':')
|
||||
@@ -123,9 +129,10 @@ export default {
|
||||
keyDetect (event) {
|
||||
this.shortKey = keyDetect(event).join('+')
|
||||
},
|
||||
openKeyBindingDialog (name) {
|
||||
openKeyBindingDialog (name, index) {
|
||||
this.shortKeyName = name
|
||||
this.shortKey = this.$db.get(`settings.shortKey.${name}.key`)
|
||||
this.currentIndex = index
|
||||
this.keyBindingVisible = true
|
||||
},
|
||||
cancelKeyBinding () {
|
||||
@@ -137,8 +144,12 @@ export default {
|
||||
this.$db.set(`settings.shortKey.${this.shortKeyName}.key`, this.shortKey)
|
||||
const newKey = this.$db.get(`settings.shortKey.${this.shortKeyName}`)
|
||||
this.$electron.ipcRenderer.send('updateShortKey', newKey, oldKey)
|
||||
this.list[this.currentIndex].key = this.shortKey
|
||||
this.keyBindingVisible = false
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$electron.ipcRenderer.send('toggleShortKeyModifiedMode', false)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user