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()
|
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']
|
const types = ['weibo', 'qiniu', 'tcyun', 'upyun']
|
||||||
let submenuItem = contextMenu.items[2].submenu.items
|
let submenuItem = contextMenu.items[2].submenu.items
|
||||||
submenuItem.forEach((item, index) => {
|
submenuItem.forEach((item, index) => {
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
import db from '../../datastore'
|
||||||
|
|
||||||
export default (style, url) => {
|
export default (style, url) => {
|
||||||
|
const customLink = db.read().get('customLink').value() || '$url'
|
||||||
const tpl = {
|
const tpl = {
|
||||||
'markdown': `![](${url})`,
|
'markdown': `![](${url})`,
|
||||||
'HTML': `<img src="${url}"/>`,
|
'HTML': `<img src="${url}"/>`,
|
||||||
'URL': url,
|
'URL': url,
|
||||||
'UBB': `[IMG]${url}[/IMG]`
|
'UBB': `[IMG]${url}[/IMG]`,
|
||||||
|
'Custom': customLink.replace(/\$url/, url)
|
||||||
}
|
}
|
||||||
return tpl[style]
|
return tpl[style]
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ const weiboUpload = async function (img, type, webContents) {
|
|||||||
body: '微博Cookie失效,请在网页版重新登录一遍'
|
body: '微博Cookie失效,请在网页版重新登录一遍'
|
||||||
})
|
})
|
||||||
notification.show()
|
notification.show()
|
||||||
|
return new Error()
|
||||||
} else {
|
} else {
|
||||||
const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg'
|
const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg'
|
||||||
imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}${extname}`
|
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>
|
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -103,6 +151,8 @@ export default {
|
|||||||
menu: null,
|
menu: null,
|
||||||
visible: false,
|
visible: false,
|
||||||
keyBindingVisible: false,
|
keyBindingVisible: false,
|
||||||
|
customLinkVisible: false,
|
||||||
|
customLink: db.read().get('customLink').value() || '$url',
|
||||||
os: '',
|
os: '',
|
||||||
shortKey: {
|
shortKey: {
|
||||||
upload: db.read().get('shortKey.upload').value()
|
upload: db.read().get('shortKey.upload').value()
|
||||||
@ -152,6 +202,12 @@ export default {
|
|||||||
_this.keyBindingVisible = true
|
_this.keyBindingVisible = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '自定义链接格式',
|
||||||
|
click () {
|
||||||
|
_this.customLinkVisible = true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '打开更新助手',
|
label: '打开更新助手',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
@ -179,6 +235,15 @@ export default {
|
|||||||
db.read().set('shortKey', this.shortKey).write()
|
db.read().set('shortKey', this.shortKey).write()
|
||||||
this.keyBindingVisible = false
|
this.keyBindingVisible = false
|
||||||
this.$electron.ipcRenderer.send('updateShortKey', oldKey)
|
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) => {
|
beforeRouteEnter: (to, from, next) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="upload-view">
|
<div id="upload-view">
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col :span="16" :offset="4">
|
<el-col :span="20" :offset="2">
|
||||||
<div class="view-title">
|
<div class="view-title">
|
||||||
图片上传
|
图片上传
|
||||||
</div>
|
</div>
|
||||||
@ -38,6 +38,7 @@
|
|||||||
<el-radio-button label="HTML"></el-radio-button>
|
<el-radio-button label="HTML"></el-radio-button>
|
||||||
<el-radio-button label="URL"></el-radio-button>
|
<el-radio-button label="URL"></el-radio-button>
|
||||||
<el-radio-button label="UBB"></el-radio-button>
|
<el-radio-button label="UBB"></el-radio-button>
|
||||||
|
<el-radio-button label="Custom" title="自定义"></el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-col-8">
|
<div class="el-col-8">
|
||||||
@ -141,6 +142,8 @@ export default {
|
|||||||
border 2px dashed #dddddd
|
border 2px dashed #dddddd
|
||||||
border-radius 8px
|
border-radius 8px
|
||||||
text-align center
|
text-align center
|
||||||
|
width 450px
|
||||||
|
margin-left 25px
|
||||||
color #dddddd
|
color #dddddd
|
||||||
cursor pointer
|
cursor pointer
|
||||||
transition all .2s ease-in-out
|
transition all .2s ease-in-out
|
||||||
|
Loading…
Reference in New Issue
Block a user