Updated: support custom paste link template

This commit is contained in:
Molunerfinn
2018-03-09 14:35:41 +08:00
parent df39511cdf
commit f6536b1dc2
5 changed files with 84 additions and 3 deletions

View File

@@ -86,6 +86,54 @@
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
</span>
</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"
>
<el-form
label-position="top"
>
<el-form-item
label="用占位符$url来表示url的位置"
>
<el-input
class="align-center"
v-model="customLink"
:autofocus="true"
></el-input>
</el-form-item>
</el-form>
<div>
[]($url)
</div>
<span slot="footer">
<el-button @click="cancelCustomLink">取消</el-button>
<el-button type="primary" @click="confirmCustomLink">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@@ -103,6 +151,8 @@ export default {
menu: null,
visible: false,
keyBindingVisible: false,
customLinkVisible: false,
customLink: db.read().get('customLink').value() || '$url',
os: '',
shortKey: {
upload: db.read().get('shortKey.upload').value()
@@ -152,6 +202,12 @@ export default {
_this.keyBindingVisible = true
}
},
{
label: '自定义链接格式',
click () {
_this.customLinkVisible = true
}
},
{
label: '打开更新助手',
type: 'checkbox',
@@ -179,6 +235,15 @@ export default {
db.read().set('shortKey', this.shortKey).write()
this.keyBindingVisible = false
this.$electron.ipcRenderer.send('updateShortKey', oldKey)
},
cancelCustomLink () {
this.customLinkVisible = false
this.customLink = db.read().get('customLink').value() || '$url'
},
confirmCustomLink () {
db.read().set('customLink', this.customLink).write()
this.customLinkVisible = false
this.$electron.ipcRenderer.send('updateCustomLink')
}
},
beforeRouteEnter: (to, from, next) => {

View File

@@ -1,7 +1,7 @@
<template>
<div id="upload-view">
<el-row :gutter="16">
<el-col :span="16" :offset="4">
<el-col :span="20" :offset="2">
<div class="view-title">
图片上传
</div>
@@ -38,6 +38,7 @@
<el-radio-button label="HTML"></el-radio-button>
<el-radio-button label="URL"></el-radio-button>
<el-radio-button label="UBB"></el-radio-button>
<el-radio-button label="Custom" title="自定义"></el-radio-button>
</el-radio-group>
</div>
<div class="el-col-8">
@@ -141,6 +142,8 @@ export default {
border 2px dashed #dddddd
border-radius 8px
text-align center
width 450px
margin-left 25px
color #dddddd
cursor pointer
transition all .2s ease-in-out