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": { "dependencies": {
"axios": "^0.16.1", "axios": "^0.16.1",
"dateformat": "^3.0.3", "dateformat": "^3.0.3",
"element-ui": "^2.0.5", "element-ui": "^2.4.11",
"fs-extra": "^4.0.2", "fs-extra": "^4.0.2",
"image-size": "^0.6.1", "image-size": "^0.6.1",
"keycode": "^2.1.9", "keycode": "^2.1.9",
@ -81,7 +81,7 @@
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"md5": "^2.2.1", "md5": "^2.2.1",
"melody.css": "^1.0.2", "melody.css": "^1.0.2",
"picgo": "^1.1.10", "picgo": "^1.1.11",
"qiniu": "^7.1.1", "qiniu": "^7.1.1",
"request": "^2.83.0", "request": "^2.83.0",
"request-promise": "^4.2.2", "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', () => { app.on('ready', () => {
createWindow() createWindow()
createSettingWindow() createSettingWindow()
// reset localstorage state
settingWindow.webContents.executeJavaScript(`localStorage.setItem('plugins', '')`)
if (process.platform === 'darwin' || process.platform === 'win32') { if (process.platform === 'darwin' || process.platform === 'win32') {
createTray() createTray()
} }

View File

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

View File

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

View File

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

View File

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