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