mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-17 00:27:36 +08:00
🚧 WIP: almost finish shortKey system
This commit is contained in:
@@ -37,7 +37,7 @@ class DB {
|
||||
this.db.set('settings.shortKey[picgo:upload]', {
|
||||
enable: true,
|
||||
key: 'CommandOrControl+Shift+P',
|
||||
name: 'picgo:upload',
|
||||
name: 'upload',
|
||||
label: '快捷上传'
|
||||
}).write()
|
||||
}
|
||||
@@ -58,6 +58,9 @@ class DB {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).insert(value).write()
|
||||
}
|
||||
unset (key: string, value: any): boolean {
|
||||
return this.read().get(key).unset(value).write()
|
||||
}
|
||||
}
|
||||
|
||||
export default new DB()
|
||||
|
||||
64
src/universal/types/types.d.ts
vendored
64
src/universal/types/types.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
// global
|
||||
interface Obj {
|
||||
interface IObj {
|
||||
[propName: string]: any
|
||||
}
|
||||
|
||||
interface ObjT<T> {
|
||||
interface IObjT<T> {
|
||||
[propName: string]: T
|
||||
}
|
||||
|
||||
@@ -31,6 +31,14 @@ interface IShortKeyConfig {
|
||||
key: string // 按键
|
||||
name: string
|
||||
label: string
|
||||
from?: string
|
||||
}
|
||||
|
||||
interface IPluginShortKeyConfig {
|
||||
key: string
|
||||
name: string
|
||||
label: string
|
||||
handle: IShortKeyHandler
|
||||
}
|
||||
|
||||
interface IShortKeyConfigs {
|
||||
@@ -41,6 +49,11 @@ interface IOldShortKeyConfigs {
|
||||
upload: string
|
||||
}
|
||||
|
||||
interface IKeyCommandType {
|
||||
key: string,
|
||||
command: string
|
||||
}
|
||||
|
||||
// Main process
|
||||
interface IBrowserWindowOptions {
|
||||
height: number,
|
||||
@@ -83,7 +96,7 @@ declare type ILogType = 'success' | 'info' | 'warn' | 'error'
|
||||
declare var __static: string
|
||||
|
||||
// PicGo Types
|
||||
|
||||
type ICtx = import('picgo')
|
||||
interface IPicGoPlugin {
|
||||
name: string
|
||||
author: string
|
||||
@@ -135,14 +148,53 @@ interface INPMSearchResultObject {
|
||||
}
|
||||
|
||||
// GuiApi
|
||||
|
||||
interface IGuiApi {
|
||||
showInputBox: (options: IShowInputBoxOption) => Promise<string>
|
||||
showFileExplorer: (options: IShowFileExplorerOption) => Promise<string>
|
||||
upload: (input: IUploadOption) => Promise<ImgInfo[]>
|
||||
showNotification: (options?: IShowNotificationOption) => void
|
||||
showMessageBox: (options?: IShowMessageBoxOption) => Promise<IShowMessageBoxResult>
|
||||
}
|
||||
interface IShowInputBoxOption {
|
||||
title: string
|
||||
placeholder: string
|
||||
}
|
||||
|
||||
// PicBeds
|
||||
type IShowFileExplorerOption = IObj
|
||||
|
||||
type IUploadOption = undefined | string[]
|
||||
|
||||
interface IShowNotificationOption {
|
||||
title: string
|
||||
body: string
|
||||
}
|
||||
|
||||
interface IShowMessageBoxOption {
|
||||
title: string
|
||||
message: string
|
||||
type: string
|
||||
buttons: string[]
|
||||
}
|
||||
|
||||
interface IShowMessageBoxResult {
|
||||
result: number
|
||||
checkboxChecked: boolean
|
||||
}
|
||||
|
||||
interface IShortKeyHandlerObj {
|
||||
handle: IShortKeyHandler
|
||||
key: string
|
||||
label: string
|
||||
}
|
||||
|
||||
type IShortKeyHandler = (ctx: ICtx, guiApi?: IGuiApi) => Promise<void | ICtx>
|
||||
|
||||
interface shortKeyHandlerMap {
|
||||
from: string
|
||||
handle: IShortKeyHandler
|
||||
}
|
||||
|
||||
// PicBeds
|
||||
interface IAliYunConfig {
|
||||
accessKeyId: string
|
||||
accessKeySecret: string,
|
||||
@@ -193,3 +245,5 @@ interface IUpYunConfig {
|
||||
options: string,
|
||||
path: string
|
||||
}
|
||||
|
||||
type ILoggerType = string | Error | boolean | number | undefined
|
||||
|
||||
2
src/universal/types/view.d.ts
vendored
2
src/universal/types/view.d.ts
vendored
@@ -9,6 +9,6 @@ interface ISettingForm {
|
||||
logLevel: string[]
|
||||
}
|
||||
|
||||
interface ShortKeyMap {
|
||||
interface IShortKeyMap {
|
||||
[propName: string]: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user