mirror of
https://github.com/BoostIO/BoostNote-App.git
synced 2024-10-04 08:07:41 +03:00
Move CodeMirror type definitions
This commit is contained in:
parent
cc5c24194e
commit
5e2aa82f99
@ -4,36 +4,6 @@ import 'codemirror/addon/mode/overlay'
|
||||
import 'codemirror/mode/markdown/markdown'
|
||||
import debounce from 'lodash/debounce'
|
||||
|
||||
window.CodeMirror = CodeMirror
|
||||
|
||||
declare module 'codemirror' {
|
||||
function autoLoadMode(instance: CodeMirror.Editor, mode: string): void
|
||||
|
||||
interface ModeInfo {
|
||||
name: string
|
||||
mime?: string
|
||||
mimes?: string[]
|
||||
mode: string
|
||||
ext: string[]
|
||||
alias?: string[]
|
||||
}
|
||||
const modeInfo: ModeInfo[]
|
||||
|
||||
interface Editor {
|
||||
options: CodeMirror.EditorConfiguration
|
||||
}
|
||||
|
||||
function findModeByMIME(mime: string): ModeInfo | undefined
|
||||
function findModeByName(name: string): ModeInfo | undefined
|
||||
|
||||
function runMode(
|
||||
text: string,
|
||||
modespec: any,
|
||||
callback: HTMLElement | ((text: string, style: string | null) => void),
|
||||
options?: { tabSize?: number; state?: any }
|
||||
): void
|
||||
}
|
||||
|
||||
const dispatchModeLoad = debounce(() => {
|
||||
window.dispatchEvent(new CustomEvent('codemirror-mode-load'))
|
||||
}, 300)
|
||||
|
30
typings/codemirror.d.ts
vendored
30
typings/codemirror.d.ts
vendored
@ -1,3 +1,31 @@
|
||||
declare module 'codemirror/mode/*' {
|
||||
import CodeMirror from 'codemirror'
|
||||
|
||||
declare module 'codemirror/mode/*'
|
||||
|
||||
declare module 'codemirror' {
|
||||
function autoLoadMode(instance: CodeMirror.Editor, mode: string): void
|
||||
|
||||
interface ModeInfo {
|
||||
name: string
|
||||
mime?: string
|
||||
mimes?: string[]
|
||||
mode: string
|
||||
ext: string[]
|
||||
alias?: string[]
|
||||
}
|
||||
const modeInfo: ModeInfo[]
|
||||
|
||||
interface Editor {
|
||||
options: CodeMirror.EditorConfiguration
|
||||
}
|
||||
|
||||
function findModeByMIME(mime: string): ModeInfo | undefined
|
||||
function findModeByName(name: string): ModeInfo | undefined
|
||||
|
||||
function runMode(
|
||||
text: string,
|
||||
modespec: any,
|
||||
callback: HTMLElement | ((text: string, style: string | null) => void),
|
||||
options?: { tabSize?: number; state?: any }
|
||||
): void
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user