mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50f31bd438 | ||
|
|
5b0d596c6d | ||
|
|
c59e2bcc97 | ||
|
|
3c6b329927 | ||
|
|
466dbec4b7 | ||
|
|
4e02244ebe | ||
|
|
748a7fd07e | ||
|
|
4000cea7c8 |
@@ -1,3 +1,28 @@
|
||||
## :tada: 2.1.2 (2019-04-19)
|
||||
|
||||
|
||||
### :sparkles: Features
|
||||
|
||||
* add file-name for customurl ([c59e2bc](https://github.com/Molunerfinn/PicGo/commit/c59e2bc)), closes [#173](https://github.com/Molunerfinn/PicGo/issues/173)
|
||||
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* log-level filter bug ([4e02244](https://github.com/Molunerfinn/PicGo/commit/4e02244)), closes [#237](https://github.com/Molunerfinn/PicGo/issues/237)
|
||||
* log-level's reset value from 'all' -> ['all'] ([3c6b329](https://github.com/Molunerfinn/PicGo/commit/3c6b329)), closes [#240](https://github.com/Molunerfinn/PicGo/issues/240) [#237](https://github.com/Molunerfinn/PicGo/issues/237)
|
||||
* mini window hidden bug in linux ([466dbec](https://github.com/Molunerfinn/PicGo/commit/466dbec)), closes [#239](https://github.com/Molunerfinn/PicGo/issues/239)
|
||||
|
||||
|
||||
|
||||
## :tada: 2.1.1 (2019-04-16)
|
||||
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* upload-area can't upload images ([4000cea](https://github.com/Molunerfinn/PicGo/commit/4000cea))
|
||||
|
||||
|
||||
|
||||
# :tada: 2.1.0 (2019-04-15)
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "picgo",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.2",
|
||||
"author": "Molunerfinn <marksz@teamsz.xyz>",
|
||||
"description": "Easy to upload your pic & copy to write",
|
||||
"license": "MIT",
|
||||
|
||||
+7
-19
@@ -170,8 +170,7 @@ function createTray () {
|
||||
const imgs = await new Uploader(files, window.webContents).upload()
|
||||
if (imgs !== false) {
|
||||
for (let i in imgs) {
|
||||
const url = imgs[i].url || imgs[i].imgUrl
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, url))
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, imgs[i]))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: imgs[i].imgUrl,
|
||||
@@ -225,26 +224,18 @@ const createMiniWidow = () => {
|
||||
let obj = {
|
||||
height: 64,
|
||||
width: 64,
|
||||
show: false,
|
||||
show: process.platform === 'linux',
|
||||
frame: false,
|
||||
fullscreenable: false,
|
||||
skipTaskbar: true,
|
||||
resizable: false,
|
||||
transparent: true,
|
||||
transparent: process.platform !== 'linux',
|
||||
icon: `${__static}/logo.png`,
|
||||
webPreferences: {
|
||||
backgroundThrottling: false
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
obj.transparent = false
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
obj.show = false
|
||||
}
|
||||
|
||||
if (db.read().get('settings.miniWindowOntop').value()) {
|
||||
obj.alwaysOnTop = true
|
||||
}
|
||||
@@ -351,8 +342,7 @@ const uploadClipboardFiles = async () => {
|
||||
if (img !== false) {
|
||||
if (img.length > 0) {
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
const url = img[0].url || img[0].imgUrl
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, url))
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0]))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: img[0].imgUrl,
|
||||
@@ -382,8 +372,7 @@ const uploadChoosedFiles = async (webContents, files) => {
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
let pasteText = ''
|
||||
for (let i in imgs) {
|
||||
const url = imgs[i].url || imgs[i].imgUrl
|
||||
pasteText += pasteTemplate(pasteStyle, url) + '\r\n'
|
||||
pasteText += pasteTemplate(pasteStyle, imgs[i]) + '\r\n'
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: imgs[i].imgUrl,
|
||||
@@ -409,8 +398,7 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
||||
const img = await new Uploader(undefined, window.webContents).upload()
|
||||
if (img !== false) {
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
const url = img[0].url || img[0].imgUrl
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, url))
|
||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0]))
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: img[0].imgUrl,
|
||||
@@ -432,7 +420,7 @@ ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
|
||||
})
|
||||
|
||||
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||
return uploadChoosedFiles(evt, files)
|
||||
return uploadChoosedFiles(evt.sender, files)
|
||||
})
|
||||
|
||||
ipcMain.on('updateShortKey', (evt, oldKey) => {
|
||||
|
||||
@@ -63,8 +63,7 @@ class GuiApi {
|
||||
const pasteStyle = db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
let pasteText = ''
|
||||
for (let i in imgs) {
|
||||
const url = imgs[i].url || imgs[i].imgUrl
|
||||
pasteText += pasteTemplate(pasteStyle, url) + '\r\n'
|
||||
pasteText += pasteTemplate(pasteStyle, imgs[i]) + '\r\n'
|
||||
const notification = new Notification({
|
||||
title: '上传成功',
|
||||
body: imgs[i].imgUrl,
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
import db from '../../datastore'
|
||||
|
||||
export default (style, url) => {
|
||||
const formatCustomLink = (customLink, item) => {
|
||||
let fileName = item.fileName.replace(new RegExp(`\\${item.extname}$`), '')
|
||||
let url = item.url || item.imgUrl
|
||||
let formatObj = {
|
||||
url,
|
||||
fileName
|
||||
}
|
||||
let keys = Object.keys(formatObj)
|
||||
keys.forEach(item => {
|
||||
if (customLink.indexOf(`$${item}`) !== -1) {
|
||||
let reg = new RegExp(`\\$${item}`, 'g')
|
||||
customLink = customLink.replace(reg, formatObj[item])
|
||||
}
|
||||
})
|
||||
return customLink
|
||||
}
|
||||
|
||||
export default (style, item) => {
|
||||
let url = item.url || item.imgUrl
|
||||
const customLink = db.read().get('settings.customLink').value() || '$url'
|
||||
const tpl = {
|
||||
'markdown': ``,
|
||||
'HTML': `<img src="${url}"/>`,
|
||||
'URL': url,
|
||||
'UBB': `[IMG]${url}[/IMG]`,
|
||||
'Custom': customLink.replace(/\$url/g, url)
|
||||
'Custom': formatCustomLink(customLink, item)
|
||||
}
|
||||
return tpl[style]
|
||||
}
|
||||
|
||||
@@ -213,13 +213,12 @@ export default {
|
||||
this.changeZIndexForGallery(false)
|
||||
},
|
||||
copy (item) {
|
||||
const url = item.url || item.imgUrl
|
||||
const style = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
const copyLink = pasteStyle(style, url)
|
||||
const copyLink = pasteStyle(style, item)
|
||||
const obj = {
|
||||
title: '复制链接成功',
|
||||
body: copyLink,
|
||||
icon: url
|
||||
icon: item.url || item.imgUrl
|
||||
}
|
||||
const myNotification = new window.Notification(obj.title, obj)
|
||||
this.$electron.clipboard.writeText(copyLink)
|
||||
@@ -325,8 +324,7 @@ export default {
|
||||
Object.keys(this.choosedList).forEach(key => {
|
||||
if (this.choosedList[key]) {
|
||||
const item = this.$db.read().get('uploaded').getById(key).value()
|
||||
const url = item.url || item.imgUrl
|
||||
copyString += pasteStyle(style, url) + '\n'
|
||||
copyString += pasteStyle(style, item) + '\n'
|
||||
this.choosedList[key] = false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="picgo-setting">
|
||||
<div class="view-title">
|
||||
PicGo设置
|
||||
PicGo设置 - <i class="el-icon-document" @click="goConfigPage"></i>
|
||||
</div>
|
||||
<el-row class="setting-list">
|
||||
<el-col :span="15" :offset="4">
|
||||
@@ -154,11 +154,17 @@
|
||||
:model="customLink"
|
||||
ref="customLink"
|
||||
:rules="rules"
|
||||
size="small"
|
||||
>
|
||||
<el-form-item
|
||||
label="用占位符$url来表示url的位置"
|
||||
prop="value"
|
||||
>
|
||||
<div class="custom-title">
|
||||
用占位符 <b>$url</b> 来表示url的位置
|
||||
</div>
|
||||
<div class="custom-title">
|
||||
用占位符 <b>$fileName</b> 来表示文件名的位置
|
||||
</div>
|
||||
<el-input
|
||||
class="align-center"
|
||||
v-model="customLink.value"
|
||||
@@ -167,7 +173,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
如[]($url)
|
||||
如[$fileName]($url)
|
||||
</div>
|
||||
<span slot="footer">
|
||||
<el-button @click="cancelCustomLink" round>取消</el-button>
|
||||
@@ -241,7 +247,6 @@
|
||||
v-model="form.logLevel"
|
||||
multiple
|
||||
collapse-tags
|
||||
@change="handleLogLevelChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(value, key) of logLevel"
|
||||
@@ -285,6 +290,14 @@ export default {
|
||||
return callback()
|
||||
}
|
||||
}
|
||||
let logLevel = this.$db.read().get('settings.logLevel').value()
|
||||
if (!Array.isArray(logLevel)) {
|
||||
if (logLevel && logLevel.length > 0) {
|
||||
logLevel = [logLevel]
|
||||
} else {
|
||||
logLevel = ['all']
|
||||
}
|
||||
}
|
||||
return {
|
||||
form: {
|
||||
updateHelper: this.$db.read().get('settings.showUpdateTip').value(),
|
||||
@@ -294,7 +307,7 @@ export default {
|
||||
autoRename: this.$db.read().get('settings.autoRename').value() || false,
|
||||
uploadNotification: this.$db.read().get('settings.uploadNotification').value() || false,
|
||||
miniWindowOntop: this.$db.read().get('settings.miniWindowOntop').value() || false,
|
||||
logLevel: this.$db.read().get('settings.logLevel').value() || ['all']
|
||||
logLevel
|
||||
},
|
||||
picBed: [],
|
||||
logFileVisible: false,
|
||||
@@ -471,7 +484,15 @@ export default {
|
||||
},
|
||||
cancelLogLevelSetting () {
|
||||
this.logFileVisible = false
|
||||
this.form.logLevel = this.$db.read().get('settings.logLevel').value() || 'all'
|
||||
let logLevel = this.$db.read().get('settings.logLevel').value()
|
||||
if (!Array.isArray(logLevel)) {
|
||||
if (logLevel && logLevel.length > 0) {
|
||||
logLevel = [logLevel]
|
||||
} else {
|
||||
logLevel = ['all']
|
||||
}
|
||||
}
|
||||
this.form.logLevel = logLevel
|
||||
},
|
||||
handleLevelDisabled (val) {
|
||||
let currentLevel = val
|
||||
@@ -492,6 +513,9 @@ export default {
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
goConfigPage () {
|
||||
this.$electron.remote.shell.openExternal('https://picgo.github.io/PicGo-Doc/zh/guide/config.html#picgo设置')
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
@@ -502,6 +526,12 @@ export default {
|
||||
<style lang='stylus'>
|
||||
.el-message
|
||||
left 60%
|
||||
.view-title
|
||||
.el-icon-document
|
||||
cursor pointer
|
||||
transition color .2s ease-in-out
|
||||
&:hover
|
||||
color #49B1F5
|
||||
#picgo-setting
|
||||
.sub-title
|
||||
font-size 14px
|
||||
|
||||
@@ -452,6 +452,9 @@ $darwinBg = #172426
|
||||
font-size 20px
|
||||
vertical-align middle
|
||||
cursor pointer
|
||||
transition color .2s ease-in-out
|
||||
&:hover
|
||||
color #49B1F5
|
||||
.handle-bar
|
||||
margin-bottom 20px
|
||||
&.cut-width
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
this.notification.icon = item.imgUrl
|
||||
const myNotification = new window.Notification(this.notification.title, this.notification)
|
||||
const pasteStyle = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
|
||||
this.$electron.clipboard.writeText(pasteTemplate(pasteStyle, item.imgUrl))
|
||||
this.$electron.clipboard.writeText(pasteTemplate(pasteStyle, item))
|
||||
myNotification.onclick = () => {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user