🐛 Fix: enum type error

This commit is contained in:
Molunerfinn
2019-12-20 18:45:26 +08:00
parent 87638a2882
commit 4e3fa28be6
5 changed files with 105 additions and 18 deletions

View File

@@ -0,0 +1,22 @@
export enum IChalkType {
success = 'green',
info = 'blue',
warn = 'yellow',
error = 'red'
}
export enum IPicGoHelperType {
afterUploadPlugins = 'afterUploadPlugins',
beforeTransformPlugins = 'beforeTransformPlugins',
beforeUploadPlugins = 'beforeUploadPlugins',
uploader = 'uploader',
transformer = 'transformer'
}
export enum IPasteStyle {
MARKDOWN = 'markdown',
HTML = 'HTML',
URL = 'URL',
UBB = 'UBB',
CUSTOM = 'Custom'
}

View File

@@ -77,25 +77,12 @@ interface Bounds {
y: number
}
declare enum PasteStyle {
MARKDOWN = 'markdown',
HTML = 'HTML',
URL = 'URL',
UBB = 'UBB',
CUSTOM = 'Custom'
}
declare type ILogType = 'success' | 'info' | 'warn' | 'error'
// global value
declare var __static: string
// PicGo Types
declare enum PicGoHelperType {
afterUploadPlugins = 'afterUploadPlugins',
beforeTransformPlugins = 'beforeTransformPlugins',
beforeUploadPlugins = 'beforeUploadPlugins',
uploader = 'uploader',
transformer = 'transformer'
}
interface IPicGoPlugin {
name: string

View File

@@ -1,4 +1,5 @@
import db from '#/datastore'
import { IPasteStyle } from '#/types/enum'
const formatCustomLink = (customLink: string, item: ImgInfo) => {
let fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
@@ -17,7 +18,7 @@ const formatCustomLink = (customLink: string, item: ImgInfo) => {
return customLink
}
export default (style: PasteStyle, item: ImgInfo) => {
export default (style: IPasteStyle, item: ImgInfo) => {
let url = item.url || item.imgUrl
const customLink = db.get('settings.customLink') || '$url'
const tpl = {