mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
Updated: support custom paste link template
This commit is contained in:
parent
df39511cdf
commit
f6536b1dc2
@ -395,7 +395,15 @@ ipcMain.on('updateShortKey', (evt, oldKey) => {
|
||||
notification.show()
|
||||
})
|
||||
|
||||
ipcMain.on('updateDefaultPicBed', (evt) => {
|
||||
ipcMain.on('updateCustomLink', (evt, oldLink) => {
|
||||
const notification = new Notification({
|
||||
title: '操作成功',
|
||||
body: '你的自定义链接格式已经修改成功'
|
||||
})
|
||||
notification.show()
|
||||
})
|
||||
|
||||
ipcMain.on('updteDefaultPicBed', (evt) => {
|
||||
const types = ['weibo', 'qiniu', 'tcyun', 'upyun']
|
||||
let submenuItem = contextMenu.items[2].submenu.items
|
||||
submenuItem.forEach((item, index) => {
|
||||
|
@ -1,9 +1,13 @@
|
||||
import db from '../../datastore'
|
||||
|
||||
export default (style, url) => {
|
||||
const customLink = db.read().get('customLink').value() || '$url'
|
||||
const tpl = {
|
||||
'markdown': `![](${url})`,
|
||||
'HTML': `<img src="${url}"/>`,
|
||||
'URL': url,
|
||||
'UBB': `[IMG]${url}[/IMG]`
|
||||
'UBB': `[IMG]${url}[/IMG]`,
|
||||
'Custom': customLink.replace(/\$url/, url)
|
||||
}
|
||||
return tpl[style]
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ const weiboUpload = async function (img, type, webContents) {
|
||||
body: '微博Cookie失效,请在网页版重新登录一遍'
|
||||
})
|
||||
notification.show()
|
||||
return new Error()
|
||||
} else {
|
||||
const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg'
|
||||
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}${extname}`
|
||||
|
@ -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) => {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user