Compare commits

..
6 Commits
Author SHA1 Message Date
Molunerfinn 50f31bd438 🎉 Release: v2.1.2 2019-04-19 13:26:04 +08:00
Molunerfinn 5b0d596c6d 🔨 Refactor: improve picgo-setting page's thing
Add $fileName info
Add settings documentation url icon button
2019-04-19 11:00:51 +08:00
Molunerfinn c59e2bcc97 Feature: add file-name for customurl
add $fileName arg for customUrl

ISSUES CLOSED: #173
2019-04-18 17:25:10 +08:00
Molunerfinn 3c6b329927 🐛 Fix: log-level's reset value from 'all' -> ['all']
ISSUES CLOSED: #240, #237
2019-04-18 16:23:21 +08:00
Molunerfinn 466dbec4b7 🐛 Fix: mini window hidden bug in linux
ISSUES CLOSED: #239
2019-04-17 14:45:08 +08:00
Molunerfinn 4e02244ebe 🐛 Fix: log-level filter bug
if logLevel is not an array, it will throw an error to setting page

ISSUES CLOSED: #237
2019-04-17 09:28:36 +08:00
9 changed files with 87 additions and 35 deletions
+16
View File
@@ -1,3 +1,19 @@
## :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)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "picgo",
"version": "2.1.1",
"version": "2.1.2",
"author": "Molunerfinn <marksz@teamsz.xyz>",
"description": "Easy to upload your pic & copy to write",
"license": "MIT",
+6 -18
View File
@@ -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,
+1 -2
View File
@@ -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,
+20 -2
View File
@@ -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': `![](${url})`,
'HTML': `<img src="${url}"/>`,
'URL': url,
'UBB': `[IMG]${url}[/IMG]`,
'Custom': customLink.replace(/\$url/g, url)
'Custom': formatCustomLink(customLink, item)
}
return tpl[style]
}
+3 -5
View File
@@ -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
}
})
+36 -6
View File
@@ -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
+3
View File
@@ -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
+1 -1
View File
@@ -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
}