mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-18 05:27:35 +08:00
🐛 Fix: enum type error
This commit is contained in:
22
src/universal/types/enum.ts
Normal file
22
src/universal/types/enum.ts
Normal 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'
|
||||
}
|
||||
15
src/universal/types/types.d.ts
vendored
15
src/universal/types/types.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user