Added: pasteStyle handler in gallery page

This commit is contained in:
PiEgg 2018-12-19 11:52:27 +08:00
parent be6cce9501
commit 8ec128121f
6 changed files with 75 additions and 36 deletions

View File

@ -73,7 +73,7 @@
"dependencies": {
"axios": "^0.16.1",
"dateformat": "^3.0.3",
"element-ui": "^2.0.5",
"element-ui": "^2.4.11",
"fs-extra": "^4.0.2",
"image-size": "^0.6.1",
"keycode": "^2.1.9",
@ -81,7 +81,7 @@
"lowdb": "^1.0.0",
"md5": "^2.2.1",
"melody.css": "^1.0.2",
"picgo": "^1.1.10",
"picgo": "^1.1.11",
"qiniu": "^7.1.1",
"request": "^2.83.0",
"request-promise": "^4.2.2",

View File

@ -512,8 +512,6 @@ if (process.env.XDG_CURRENT_DESKTOP && process.env.XDG_CURRENT_DESKTOP.includes(
app.on('ready', () => {
createWindow()
createSettingWindow()
// reset localstorage state
settingWindow.webContents.executeJavaScript(`localStorage.setItem('plugins', '')`)
if (process.platform === 'darwin' || process.platform === 'win32') {
createTray()
}

View File

@ -37,7 +37,6 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
ipcMain.on('getPluginList', event => {
const picgo = new PicGo(CONFIG_PATH)
const pluginList = picgo.pluginLoader.getList()
// console.log(pluginList.length)
const list = []
for (let i in pluginList) {
const plugin = picgo.pluginLoader.getPlugin(pluginList[i])

View File

@ -3,29 +3,58 @@
<div class="view-title">
相册 - {{ filterList.length }} <i class="el-icon-caret-bottom" @click="toggleHandleBar" :class="{'active': handleBarActive}"></i>
</div>
<transition name="el-zoom-in-center">
<transition name="el-zoom-in-top">
<el-row v-show="handleBarActive">
<el-col :span="20" :offset="2" :class="{ 'long-list': filterList.length > 4 }">
<el-col :span="20" :offset="2">
<el-row class="handle-bar" :gutter="16">
<el-col :span="6" v-for="item in $picBed" :key="item.type">
<div class="pic-bed-item" @click="choosePicBed(item.type)" :class="{active: choosedPicBed.indexOf(item.type) !== -1}">
{{ item.name }}
</div>
<el-col :span="12">
<el-select
v-model="choosedPicBed"
multiple
collapse-tags
size="mini"
style="width: 100%"
placeholder="请选择显示的图床">
<el-option
v-for="item in $picBed"
:key="item.type"
:label="item.name"
:value="item.type">
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-select
v-model="pasteStyle"
size="mini"
style="width: 100%"
@change="handlePasteStyleChange"
placeholder="请选择粘贴的格式">
<el-option
v-for="(value, key) in pasteStyleMap"
:key="key"
:label="key"
:value="value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-row class="handle-bar" :gutter="16">
<el-col :span="12">
<el-input placeholder="搜索" size="mini" v-model="searchText">
<el-input
placeholder="搜索"
size="mini"
v-model="searchText">
<i slot="suffix" class="el-input__icon el-icon-close" v-if="searchText" @click="cleanSearch" style="cursor: pointer"></i>
</el-input>
</el-col>
<el-col :span="6">
<div class="item-base copy" :class="{ active: isMultiple(choosedList)}" @click="multiCopy">
<div class="item-base copy round" :class="{ active: isMultiple(choosedList)}" @click="multiCopy">
<i class="el-icon-document"></i> 批量复制
</div>
</el-col>
<el-col :span="6">
<div class="item-base delete" :class="{ active: isMultiple(choosedList)}" @click="multiDelete">
<div class="item-base delete round" :class="{ active: isMultiple(choosedList)}" @click="multiDelete">
<i class="el-icon-delete"></i> 批量删除
</div>
</el-col>
@ -98,7 +127,15 @@ export default {
choosedList: {},
choosedPicBed: [],
searchText: '',
handleBarActive: false
handleBarActive: false,
pasteStyle: '',
pasteStyleMap: {
Markdown: 'markdown',
HTML: 'HTML',
URL: 'URL',
UBB: 'UBB',
Custom: 'Custom'
}
}
},
created () {
@ -108,6 +145,7 @@ export default {
this.filterList = this.getGallery()
})
})
this.getPasteStyle()
},
computed: {
filterList: {
@ -282,6 +320,14 @@ export default {
},
toggleHandleBar () {
this.handleBarActive = !this.handleBarActive
},
getPasteStyle () {
this.pasteStyle = this.$db.read().get('settings.pasteStyle').value() || 'markdown'
},
handlePasteStyleChange (val) {
this.$db.read().set('settings.pasteStyle', val)
.write()
this.pasteStyle = val
}
},
beforeDestroy () {
@ -305,11 +351,12 @@ export default {
.item-base
background #2E2E2E
text-align center
margin-bottom 10px
padding 5px 0
cursor pointer
font-size 13px
transition all .2s ease-in-out
height: 28px
box-sizing: border-box
&.copy
cursor not-allowed
background #49B1F5
@ -324,10 +371,10 @@ export default {
cursor pointer
background #F15140
color #fff
.long-list
width: calc(83.3333333% - 6px)
#gallery-view
position relative
.round
border-radius 14px
.pull-right
float right
.gallery-list
@ -341,8 +388,8 @@ export default {
transition all .2s ease-in-out .1s
width 100%
&.small
height: 245px
top: 152px
height: 287px
top: 113px
&__img
height 150px
position relative
@ -382,14 +429,7 @@ export default {
color #F15140
.handle-bar
color #ddd
.pic-bed-item
@extend .item-base
&:hover
background #A4D8FA
color #fff
&.active
background #49B1F5
color #fff
margin-bottom 10px
.el-input__inner
border-radius 0
border-radius 14px
</style>

View File

@ -25,7 +25,7 @@
:show-text="false"
class="upload-progress"
:class="{ 'show': showProgress }"
:status="showError ? 'exception' : ''"
:status="showError ? 'exception' : 'text'"
></el-progress>
<div class="paste-style">
<div class="el-col-16">

View File

@ -3058,9 +3058,10 @@ electron@1.8.8:
electron-download "^3.0.1"
extract-zip "^1.0.3"
element-ui@^2.0.5:
version "2.4.7"
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.4.7.tgz#073b404222815c08ba2e68b39ec8e6ff7b7b13e0"
element-ui@^2.4.11:
version "2.4.11"
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.4.11.tgz#db6a2d37001b8fe5fff9f176fb58bb3908cfa9c9"
integrity sha512-RtgK0t840NAFTajGMWvylzZRSX1EkZ7V4YgAoBxhv4TtkeMscLuk/IdYOzPdlQq6IN0byx1YVBxCX+u4yYkGvw==
dependencies:
async-validator "~1.8.1"
babel-helper-vue-jsx-merge-props "^2.0.0"
@ -6196,9 +6197,10 @@ performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
picgo@^1.1.10:
version "1.1.10"
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.1.10.tgz#a80ab4f95059e05d96e7bf9ecef9074202539f87"
picgo@^1.1.11:
version "1.1.11"
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.1.11.tgz#a79067e37bfab84d557a7dfe51a733a63ccf7d8f"
integrity sha512-J4igRhH3eRHf7MrgV9eLF+nwABCQyfuKQwtRvKkJXyTiDTuhvfpjv4WOBcW5ilqWUAsgwIP/rXaw1mxxQ5bQbQ==
dependencies:
chalk "^2.4.1"
commander "^2.17.0"