mirror of
https://github.com/Molunerfinn/PicGo.git
synced 2024-04-21 10:31:33 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f373fb325 | ||
|
|
92b9fbcee8 | ||
|
|
37a784225e | ||
|
|
16fe016c70 |
@@ -133,7 +133,8 @@ let rendererConfig = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.join(__dirname, '../src/renderer'),
|
'@': path.join(__dirname, '../src/renderer'),
|
||||||
'vue$': 'vue/dist/vue.esm.js'
|
'vue$': 'vue/dist/vue.esm.js',
|
||||||
|
'utils': path.join(__dirname, '../src/renderer/utils')
|
||||||
},
|
},
|
||||||
extensions: ['.js', '.vue', '.json', '.css', '.node']
|
extensions: ['.js', '.vue', '.json', '.css', '.node']
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
## 应用说明
|
## 应用说明
|
||||||
|
|
||||||
PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS`,`又拍云`。未来将支持更多图床。
|
PicGo目前支持了`微博图床`,`七牛图床`,`腾讯云COS v4版本`,`又拍云`。未来将支持更多图床。
|
||||||
|
|
||||||
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
支持macOS、windows 64位(v1.3.0以上)系统,未来将支持linux。
|
||||||
|
|
||||||
支持快捷键`command+shift+p`(macOS)或者`control+shift+p`(windows)用以支持快捷上传剪贴板里的图片(第一张)。
|
支持快捷键`command+shift+p`(macOS)或者`control+shift+p`(windows)用以支持快捷上传剪贴板里的图片(第一张)。PicGo v1.4.0版本及以上支持自定义快捷键啦,使用方法见[配置手册](https://github.com/Molunerfinn/PicGo/wiki/%E8%AF%A6%E7%BB%86%E7%AA%97%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%BF%AB%E6%8D%B7%E9%94%AE)。
|
||||||
|
|
||||||
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件,windows用户请下载最新版本的`exe`文件。**如果是国内用户下载github release文件速度很慢的话,推荐使用[Free Download Manager](http://www.freedownloadmanager.org/download.htm)来下载,速度会快。**
|
点击此处下载[应用](https://github.com/Molunerfinn/PicGo/releases),macOS用户请下载最新版本的`dmg`文件,windows用户请下载最新版本的`exe`文件。**如果是国内用户下载github release文件速度很慢的话,推荐使用[Free Download Manager](http://www.freedownloadmanager.org/download.htm)来下载,速度会快。**
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "picgo",
|
"name": "picgo",
|
||||||
"version": "1.3.2",
|
"version": "1.4.0",
|
||||||
"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",
|
||||||
@@ -75,6 +75,7 @@
|
|||||||
"element-ui": "^2.0.5",
|
"element-ui": "^2.0.5",
|
||||||
"fs-extra": "^4.0.2",
|
"fs-extra": "^4.0.2",
|
||||||
"image-size": "^0.6.1",
|
"image-size": "^0.6.1",
|
||||||
|
"keycode": "^2.1.9",
|
||||||
"lodash-id": "^0.14.0",
|
"lodash-id": "^0.14.0",
|
||||||
"lowdb": "^1.0.0",
|
"lowdb": "^1.0.0",
|
||||||
"md5": "^2.2.1",
|
"md5": "^2.2.1",
|
||||||
|
|||||||
@@ -29,4 +29,10 @@ if (!db.has('picBed').value()) {
|
|||||||
}).write()
|
}).write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!db.has('shortKey').value()) {
|
||||||
|
db.set('shortKey', {
|
||||||
|
upload: 'CommandOrControl+Shift+P'
|
||||||
|
}).write()
|
||||||
|
}
|
||||||
|
|
||||||
export default db
|
export default db
|
||||||
|
|||||||
+55
-13
@@ -21,6 +21,7 @@ let window
|
|||||||
let settingWindow
|
let settingWindow
|
||||||
let tray
|
let tray
|
||||||
let menu
|
let menu
|
||||||
|
let contextMenu
|
||||||
const winURL = process.env.NODE_ENV === 'development'
|
const winURL = process.env.NODE_ENV === 'development'
|
||||||
? `http://localhost:9080`
|
? `http://localhost:9080`
|
||||||
: `file://${__dirname}/index.html`
|
: `file://${__dirname}/index.html`
|
||||||
@@ -39,7 +40,7 @@ const uploadFailed = () => {
|
|||||||
function createTray () {
|
function createTray () {
|
||||||
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
|
const menubarPic = process.platform === 'darwin' ? `${__static}/menubar.png` : `${__static}/menubar-nodarwin.png`
|
||||||
tray = new Tray(menubarPic)
|
tray = new Tray(menubarPic)
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
contextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: '关于',
|
label: '关于',
|
||||||
click () {
|
click () {
|
||||||
@@ -308,18 +309,26 @@ const uploadClipboardFiles = async () => {
|
|||||||
imgUrl
|
imgUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img = await uploader(uploadImg, 'imgFromClipboard', window.webContents)
|
img = await uploader(uploadImg, 'imgFromClipboard', settingWindow.webContents)
|
||||||
if (img !== false) {
|
if (img !== false) {
|
||||||
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
if (img.length > 0) {
|
||||||
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
const pasteStyle = db.read().get('picBed.pasteStyle').value() || 'markdown'
|
||||||
const notification = new Notification({
|
clipboard.writeText(pasteTemplate(pasteStyle, img[0].imgUrl))
|
||||||
title: '上传成功',
|
const notification = new Notification({
|
||||||
body: img[0].imgUrl,
|
title: '上传成功',
|
||||||
icon: img[0].imgUrl
|
body: img[0].imgUrl,
|
||||||
})
|
icon: img[0].imgUrl
|
||||||
notification.show()
|
})
|
||||||
window.webContents.send('clipboardFiles', [])
|
notification.show()
|
||||||
window.webContents.send('uploadFiles', img)
|
window.webContents.send('clipboardFiles', [])
|
||||||
|
window.webContents.send('uploadFiles', img)
|
||||||
|
} else {
|
||||||
|
const notification = new Notification({
|
||||||
|
title: '上传不成功',
|
||||||
|
body: '你剪贴板最新的一条记录不是图片哦'
|
||||||
|
})
|
||||||
|
notification.show()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uploadFailed()
|
uploadFailed()
|
||||||
}
|
}
|
||||||
@@ -344,6 +353,10 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('uploadClipboardFilesFromUploadPage', () => {
|
||||||
|
uploadClipboardFiles()
|
||||||
|
})
|
||||||
|
|
||||||
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||||
const imgs = await uploader(files, 'imgFromUploader', settingWindow.webContents)
|
const imgs = await uploader(files, 'imgFromUploader', settingWindow.webContents)
|
||||||
if (imgs !== false) {
|
if (imgs !== false) {
|
||||||
@@ -367,6 +380,35 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('updateShortKey', (evt, oldKey) => {
|
||||||
|
globalShortcut.unregisterAll()
|
||||||
|
for (let key in oldKey) {
|
||||||
|
globalShortcut.register(db.read().get('shortKey').value()[key], () => {
|
||||||
|
return shortKeyHash[key]()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const notification = new Notification({
|
||||||
|
title: '操作成功',
|
||||||
|
body: '你的快捷键已经修改成功'
|
||||||
|
})
|
||||||
|
notification.show()
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.on('updateDefaultPicBed', (evt) => {
|
||||||
|
const types = ['weibo', 'qiniu', 'tcyun', 'upyun']
|
||||||
|
let submenuItem = contextMenu.items[2].submenu.items
|
||||||
|
submenuItem.forEach((item, index) => {
|
||||||
|
const result = db.read().get('picBed.current').value() === types[index]
|
||||||
|
if (result) {
|
||||||
|
item.click() // It's a bug which can not set checked status
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const shortKeyHash = {
|
||||||
|
upload: uploadClipboardFiles
|
||||||
|
}
|
||||||
|
|
||||||
const isSecondInstance = app.makeSingleInstance(() => {
|
const isSecondInstance = app.makeSingleInstance(() => {
|
||||||
if (settingWindow) {
|
if (settingWindow) {
|
||||||
if (settingWindow.isMinimized()) {
|
if (settingWindow.isMinimized()) {
|
||||||
@@ -389,7 +431,7 @@ app.on('ready', () => {
|
|||||||
createTray()
|
createTray()
|
||||||
updateChecker()
|
updateChecker()
|
||||||
|
|
||||||
globalShortcut.register('CommandOrControl+Shift+P', () => {
|
globalShortcut.register(db.read().get('shortKey.upload').value(), () => {
|
||||||
uploadClipboardFiles()
|
uploadClipboardFiles()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const checkVersion = async () => {
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
title: '发现新版本',
|
title: '发现新版本',
|
||||||
buttons: ['Yes', 'No'],
|
buttons: ['Yes', 'No'],
|
||||||
message: '发现新版本,是否去下载最新的版本?',
|
message: '发现新版本,更新了很多功能,是否去下载最新的版本?',
|
||||||
checkboxLabel: '以后不再提醒',
|
checkboxLabel: '以后不再提醒',
|
||||||
checkboxChecked: false
|
checkboxChecked: false
|
||||||
}, (res, checkboxChecked) => {
|
}, (res, checkboxChecked) => {
|
||||||
|
|||||||
@@ -20,4 +20,8 @@
|
|||||||
#app
|
#app
|
||||||
overflow-x hidden
|
overflow-x hidden
|
||||||
user-select none
|
user-select none
|
||||||
|
.el-button-group
|
||||||
|
width 100%
|
||||||
|
.el-button
|
||||||
|
width 50%
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -63,11 +63,36 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="修改快捷键"
|
||||||
|
:visible.sync="keyBindingVisible"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="快捷上传"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
class="align-center"
|
||||||
|
@keydown.native.prevent="keyDetect('upload', $event)"
|
||||||
|
v-model="shortKey.upload"
|
||||||
|
:autofocus="true"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer">
|
||||||
|
<el-button @click="cancelKeyBinding">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirmKeyBinding">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import pkg from '../../../package.json'
|
import pkg from '../../../package.json'
|
||||||
|
import keyDetect from 'utils/key-binding'
|
||||||
import { remote } from 'electron'
|
import { remote } from 'electron'
|
||||||
|
import db from '../../datastore'
|
||||||
const { Menu, dialog, BrowserWindow } = remote
|
const { Menu, dialog, BrowserWindow } = remote
|
||||||
export default {
|
export default {
|
||||||
name: 'setting-page',
|
name: 'setting-page',
|
||||||
@@ -77,7 +102,11 @@ export default {
|
|||||||
defaultActive: 'upload',
|
defaultActive: 'upload',
|
||||||
menu: null,
|
menu: null,
|
||||||
visible: false,
|
visible: false,
|
||||||
os: ''
|
keyBindingVisible: false,
|
||||||
|
os: '',
|
||||||
|
shortKey: {
|
||||||
|
upload: db.read().get('shortKey.upload').value()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -117,6 +146,12 @@ export default {
|
|||||||
_this.visible = true
|
_this.visible = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '修改快捷键',
|
||||||
|
click () {
|
||||||
|
_this.keyBindingVisible = true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '打开更新助手',
|
label: '打开更新助手',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
@@ -131,6 +166,19 @@ export default {
|
|||||||
},
|
},
|
||||||
openDialog () {
|
openDialog () {
|
||||||
this.menu.popup(remote.getCurrentWindow)
|
this.menu.popup(remote.getCurrentWindow)
|
||||||
|
},
|
||||||
|
keyDetect (type, event) {
|
||||||
|
this.shortKey[type] = keyDetect(event).join('+')
|
||||||
|
},
|
||||||
|
cancelKeyBinding () {
|
||||||
|
this.keyBindingVisible = false
|
||||||
|
this.shortKey = db.read().get('shortKey').value()
|
||||||
|
},
|
||||||
|
confirmKeyBinding () {
|
||||||
|
const oldKey = db.read().get('shortKey').value()
|
||||||
|
db.read().set('shortKey', this.shortKey).write()
|
||||||
|
this.keyBindingVisible = false
|
||||||
|
this.$electron.ipcRenderer.send('updateShortKey', oldKey)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteEnter: (to, from, next) => {
|
beforeRouteEnter: (to, from, next) => {
|
||||||
@@ -211,4 +259,7 @@ export default {
|
|||||||
&-title
|
&-title
|
||||||
text-align center
|
text-align center
|
||||||
color #878d99
|
color #878d99
|
||||||
|
.align-center
|
||||||
|
input
|
||||||
|
text-align center
|
||||||
</style>
|
</style>
|
||||||
@@ -59,7 +59,10 @@
|
|||||||
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如?imageslim"></el-input>
|
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如?imageslim"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="confirm">确定</el-button>
|
<el-button-group>
|
||||||
|
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||||
|
<el-button type="success" @click="setDefaultPicBed('qiniu')" round :disabled="defaultPicBed === 'qiniu'">设为默认图床</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -122,9 +125,6 @@ export default {
|
|||||||
line-height 22px
|
line-height 22px
|
||||||
padding-bottom 0
|
padding-bottom 0
|
||||||
color #eee
|
color #eee
|
||||||
.el-button
|
|
||||||
width 100%
|
|
||||||
border-radius 19px
|
|
||||||
.el-input__inner
|
.el-input__inner
|
||||||
border-radius 19px
|
border-radius 19px
|
||||||
.el-radio-group
|
.el-radio-group
|
||||||
|
|||||||
@@ -57,7 +57,10 @@
|
|||||||
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="confirm">确定</el-button>
|
<el-button-group>
|
||||||
|
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||||
|
<el-button type="success" @click="setDefaultPicBed('tcyun')" round :disabled="defaultPicBed === 'tcyun'">设为默认图床</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -120,9 +123,6 @@ export default {
|
|||||||
line-height 22px
|
line-height 22px
|
||||||
padding-bottom 0
|
padding-bottom 0
|
||||||
color #eee
|
color #eee
|
||||||
.el-button
|
|
||||||
width 100%
|
|
||||||
border-radius 19px
|
|
||||||
.el-input__inner
|
.el-input__inner
|
||||||
border-radius 19px
|
border-radius 19px
|
||||||
.el-radio-group
|
.el-radio-group
|
||||||
|
|||||||
@@ -49,7 +49,10 @@
|
|||||||
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如!imgslim"></el-input>
|
<el-input v-model="form.options" @keyup.native.enter="confirm" placeholder="例如!imgslim"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="confirm">确定</el-button>
|
<el-button-group>
|
||||||
|
<el-button type="primary" @click="confirm" round>确定</el-button>
|
||||||
|
<el-button type="success" @click="setDefaultPicBed('upyun')" round :disabled="defaultPicBed === 'upyun'">设为默认图床</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -110,9 +113,6 @@ export default {
|
|||||||
line-height 22px
|
line-height 22px
|
||||||
padding-bottom 0
|
padding-bottom 0
|
||||||
color #eee
|
color #eee
|
||||||
.el-button
|
|
||||||
width 100%
|
|
||||||
border-radius 19px
|
|
||||||
.el-input__inner
|
.el-input__inner
|
||||||
border-radius 19px
|
border-radius 19px
|
||||||
.el-radio-group
|
.el-radio-group
|
||||||
|
|||||||
@@ -25,19 +25,27 @@
|
|||||||
:status="showError ? 'exception' : ''"
|
:status="showError ? 'exception' : ''"
|
||||||
></el-progress>
|
></el-progress>
|
||||||
<div class="paste-style">
|
<div class="paste-style">
|
||||||
<div class="paste-style__text">
|
<div class="el-col-16">
|
||||||
链接格式
|
<div class="paste-style__text">
|
||||||
|
链接格式
|
||||||
|
</div>
|
||||||
|
<el-radio-group v-model="pasteStyle" size="mini"
|
||||||
|
@change="handlePasteStyleChange"
|
||||||
|
>
|
||||||
|
<el-radio-button label="markdown">
|
||||||
|
Markdown
|
||||||
|
</el-radio-button>
|
||||||
|
<el-radio-button label="HTML"></el-radio-button>
|
||||||
|
<el-radio-button label="URL"></el-radio-button>
|
||||||
|
<el-radio-button label="UBB"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
<div class="el-col-8">
|
||||||
|
<div class="paste-style__text">
|
||||||
|
快捷上传
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" round size="mini" @click="uploadClipboardFiles">剪贴板图片上传</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-radio-group v-model="pasteStyle" size="mini"
|
|
||||||
@change="handlePasteStyleChange"
|
|
||||||
>
|
|
||||||
<el-radio-button label="markdown">
|
|
||||||
Markdown
|
|
||||||
</el-radio-button>
|
|
||||||
<el-radio-button label="HTML"> </el-radio-button>
|
|
||||||
<el-radio-button label="URL"> </el-radio-button>
|
|
||||||
<el-radio-button label="UBB"> </el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -114,6 +122,9 @@ export default {
|
|||||||
handlePasteStyleChange (val) {
|
handlePasteStyleChange (val) {
|
||||||
this.$db.read().set('picBed.pasteStyle', val)
|
this.$db.read().set('picBed.pasteStyle', val)
|
||||||
.write()
|
.write()
|
||||||
|
},
|
||||||
|
uploadClipboardFiles () {
|
||||||
|
this.$electron.ipcRenderer.send('uploadClipboardFilesFromUploadPage')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,10 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="confirm('weiboForm')" round>确定</el-button>
|
<el-button-group>
|
||||||
|
<el-button type="primary" @click="confirm('weiboForm')" round>确定</el-button>
|
||||||
|
<el-button type="success" @click="setDefaultPicBed('weibo')" round :disabled="defaultPicBed === 'weibo'">设为默认图床</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -129,8 +132,10 @@ export default {
|
|||||||
line-height 22px
|
line-height 22px
|
||||||
padding-bottom 0
|
padding-bottom 0
|
||||||
color #eee
|
color #eee
|
||||||
.el-button
|
.el-button-group
|
||||||
width 100%
|
width 100%
|
||||||
|
.el-button
|
||||||
|
width 50%
|
||||||
.el-input__inner
|
.el-input__inner
|
||||||
border-radius 19px
|
border-radius 19px
|
||||||
.el-radio-group
|
.el-radio-group
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
|
import db from '../../datastore'
|
||||||
export default {
|
export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
this.disableDragEvent()
|
this.disableDragEvent()
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
defaultPicBed: db.read().get('picBed.current').value()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
disableDragEvent () {
|
disableDragEvent () {
|
||||||
window.addEventListener('dragenter', this.disableDrag, false)
|
window.addEventListener('dragenter', this.disableDrag, false)
|
||||||
@@ -15,6 +21,17 @@ export default {
|
|||||||
e.dataTransfer.effectAllowed = 'none'
|
e.dataTransfer.effectAllowed = 'none'
|
||||||
e.dataTransfer.dropEffect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setDefaultPicBed (type) {
|
||||||
|
db.read().set('picBed.current', type).write()
|
||||||
|
this.defaultPicBed = type
|
||||||
|
this.$electron.ipcRenderer.send('updateDefaultPicBed')
|
||||||
|
const successNotification = new window.Notification('设置默认图床', {
|
||||||
|
body: '设置成功'
|
||||||
|
})
|
||||||
|
successNotification.onclick = () => {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import keycode from 'keycode'
|
||||||
|
|
||||||
|
const isSpecialKey = (keyCode) => {
|
||||||
|
const keyArr = [
|
||||||
|
16, // Shift
|
||||||
|
17, // Ctrl
|
||||||
|
18, // Alt
|
||||||
|
91, // Left Meta
|
||||||
|
93 // Right Meta
|
||||||
|
]
|
||||||
|
|
||||||
|
return keyArr.includes(keyCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyDetect = (event) => {
|
||||||
|
const meta = process.platform === 'darwin' ? 'Cmd' : 'Super'
|
||||||
|
let specialKey = {
|
||||||
|
Ctrl: event.ctrlKey,
|
||||||
|
Shift: event.shiftKey,
|
||||||
|
Alt: event.altKey
|
||||||
|
}
|
||||||
|
specialKey[meta] = event.metaKey
|
||||||
|
|
||||||
|
let pressKey = []
|
||||||
|
|
||||||
|
for (let i in specialKey) {
|
||||||
|
if (specialKey[i]) {
|
||||||
|
pressKey.push(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isSpecialKey(event.keyCode)) {
|
||||||
|
pressKey.push(keycode(event.keyCode).toUpperCase())
|
||||||
|
}
|
||||||
|
return pressKey
|
||||||
|
}
|
||||||
|
|
||||||
|
export default keyDetect
|
||||||
@@ -4884,6 +4884,10 @@ keyboardevents-areequal@^0.2.1:
|
|||||||
version "0.2.2"
|
version "0.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194"
|
resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194"
|
||||||
|
|
||||||
|
keycode@^2.1.9:
|
||||||
|
version "2.1.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.1.9.tgz#964a23c54e4889405b4861a5c9f0480d45141dfa"
|
||||||
|
|
||||||
keypress@0.1.x:
|
keypress@0.1.x:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a"
|
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a"
|
||||||
|
|||||||
Reference in New Issue
Block a user