build: 提交 dist 构建产物(v0.4.1 完整 5 格式 + sourcemap + 类型声明)
CI / test-rest (push) Successful in 9m29s
CI / e2e (push) Successful in 9m42s
CI / verify (18.x) (push) Successful in 9m54s
CI / verify (20.x) (push) Successful in 9m52s
CI / test-parser (push) Successful in 9m26s
CI / test-core (push) Successful in 9m35s
CI / verify (24.x) (push) Successful in 9m47s

This commit is contained in:
2026-08-09 20:20:39 +08:00
parent 4d6767482e
commit 0cb0d28bb4
9 changed files with 16280 additions and 1 deletions
+755
View File
@@ -0,0 +1,755 @@
/**
* MetonaEditor Plugins — plugin system v2
* @module plugins
* @version 0.2.0
*/
/** The editor surface plugins may rely on. Keeps plugin code type-checked
* without importing the full MarkdownEditor class (avoids circular imports). */
interface EditorLike {
id?: string;
value?: string;
_value?: string;
el: HTMLElement;
textarea: HTMLTextAreaElement;
config?: Record<string, any>;
on?: (name: string, fn: (...args: any[]) => void) => (() => void) | void;
off?: (name: string, fn: (...args: any[]) => void) => unknown;
_emit?: (name: string, ...args: any[]) => void;
_pushHistory?: () => void;
_render?: () => void;
_updateWordCount?: () => void;
insert?: (text: string, opts?: {
replace?: boolean;
}) => unknown;
setValue?: (value: string, opts?: {
silent?: boolean;
}) => unknown;
getValue?: () => string;
getHTML?: () => string;
focus?: () => unknown;
toast?: (message: string, opts?: {
type?: string;
duration?: number;
animation?: string;
}) => unknown;
}
interface Plugin {
name: string;
version?: string;
description?: string;
depends?: string[];
priority?: number;
install?: (editor: EditorLike, options?: any) => void | Promise<void>;
destroy?: (editor: EditorLike) => void;
[key: string]: any;
}
interface PluginSchema {
[key: string]: {
type?: string;
required?: boolean;
default?: any;
enum?: any[];
validator?: (val: any) => boolean | string;
};
}
declare class PluginManager {
plugins: Map<string, Plugin & {
enabled: boolean;
}>;
register(name: string, plugin: Plugin): this;
unregister(name: string): this;
get(name: string): Plugin | null;
has(name: string): boolean;
getAll(): Plugin[];
getNames(): string[];
enable(name: string): this;
disable(name: string): this;
isEnabled(name: string): boolean;
destroy(): void;
}
declare const topologicalSort: (plugins: Plugin[]) => Plugin[];
declare const validateConfig: (schema?: PluginSchema, config?: Record<string, any>) => {
valid: boolean;
errors: string[];
patched: Record<string, any>;
};
declare const presetPlugins: Record<string, Plugin>;
declare const pluginUtils: {
createManager: () => PluginManager;
manager: PluginManager;
register: (name: string, plugin: Plugin) => PluginManager;
unregister: (name: string) => PluginManager;
get: (name: string) => Plugin | null;
has: (name: string) => boolean;
getAll: () => Plugin[];
getNames: () => string[];
enable: (name: string) => PluginManager;
disable: (name: string) => PluginManager;
isEnabled: (name: string) => boolean;
getPreset: (name: string) => Plugin | null;
getAllPresets: () => Record<string, Plugin>;
createPlugin: (config?: Partial<Plugin>) => Plugin;
validatePlugin: (plugin: any) => {
valid: boolean;
errors: string[];
};
topologicalSort: (plugins: Plugin[]) => Plugin[];
validateConfig: (schema?: PluginSchema, config?: Record<string, any>) => {
valid: boolean;
errors: string[];
patched: Record<string, any>;
};
};
declare const loadRemote: (url: string, locale: string) => Promise<boolean>;
interface InstanceI18n {
set: (locale: string) => string;
get: () => string;
getDirection: () => 'ltr' | 'rtl';
t: (key: string, params?: Record<string, any>) => string;
formatNumber: (n: number, opts?: Intl.NumberFormatOptions) => string;
formatDate: (d: Date | string, opts?: Intl.DateTimeFormatOptions) => string;
}
declare const createInstanceI18n: (editor: any) => InstanceI18n;
declare const i18nUtils: {
t: (key: string, params?: Record<string, any>, locale?: string) => string;
getCurrentLocale: () => string;
setCurrentLocale: (locale: string) => void;
switchLocale: (locale: string) => void;
getFallbackLocale: () => string;
setFallbackLocale: (locale: string) => void;
hasTranslation: (key: string) => boolean;
getTranslations: (locale: string) => Record<string, any>;
addTranslations: (locale: string, translations: Record<string, any>) => void;
loadRemote: (url: string, locale: string) => Promise<boolean>;
getSupportedLocales: () => string[];
isLocaleSupported: (locale: string) => boolean;
getLocaleName: (locale: string) => string;
getLocaleDirection: (locale: string) => "ltr" | "rtl";
formatNumber: (number: number, options?: Intl.NumberFormatOptions) => string;
formatCurrency: (amount: number, currency?: string, options?: Intl.NumberFormatOptions) => string;
formatDate: (date: Date | string, options?: Intl.DateTimeFormatOptions) => string;
addLocaleListener: (fn: (locale: string) => void) => () => void;
removeLocaleListener: (fn: (locale: string) => void) => void;
clearLocaleListeners: () => void;
initI18n: () => void;
saveLocale: (locale: string) => void;
loadLocale: () => string;
getDefaultLocale: () => string;
createInstanceI18n: (editor: any) => InstanceI18n;
};
/**
* MetonaEditor Highlight — built-in lightweight syntax highlighter
* @module highlight
* @version 0.4.0
*
* Zero-dependency tokenizer for common languages. Safe by construction:
* input is HTML-escaped first, then annotated with <span> classes on the
* escaped text (no raw HTML can leak through).
*/
interface LanguageDef {
keywords: string[];
builtins: string[];
hasBlocks?: boolean;
hasHashComments?: boolean;
hasTemplateStrings?: boolean;
singleQuoteStrings?: boolean;
}
/** Map a code-block language hint to the canonical language name */
declare const normalizeLanguage: (lang: string) => string;
/** Highlight code with the built-in tokenizer. Falls back to escaped plain text. */
declare const highlight: (code: string, lang: string) => string;
/** Register or override a language definition */
declare const registerLanguage: (name: string, def: LanguageDef) => void;
declare const getSupportedLanguages: () => string[];
/**
* MetonaEditor Icons — SVG toolbar icons
* @module icons
* @version 0.2.0
*/
declare const ICONS: Record<string, string>;
/**
* MetonaEditor Constants — default configs, themes, animations
* @module constants
* @version 0.2.0
*/
type EditMode = 'edit' | 'split' | 'preview';
type ThemeName = 'light' | 'dark' | 'auto' | 'warm' | string;
type ToolbarItem = string | '|';
interface RenderEnv {
highlight?: (code: string, lang: string) => string;
locale?: string;
refs?: Record<string, string>;
}
interface EditorStyle {
color?: string;
backgroundColor?: string;
[key: string]: string | undefined;
}
interface EditorOptions {
value?: string;
placeholder?: string;
mode?: EditMode;
height?: number | string;
toolbar?: ToolbarItem[] | false;
wordCount?: boolean;
autofocus?: boolean;
spellcheck?: boolean;
historyLimit?: number;
historyDebounce?: number;
syncScroll?: boolean;
tabSize?: number;
readOnly?: boolean;
lineNumbers?: boolean;
outline?: boolean;
autoBrackets?: boolean;
zenMode?: boolean;
zenMaxWidth?: number | string | false;
wordWrap?: boolean;
maxLength?: number;
theme?: ThemeName;
locale?: string;
render?: ((markdown: string, env: RenderEnv) => string) | null;
highlight?: ((code: string, lang: string) => string) | null;
sanitize?: ((html: string) => string) | null;
className?: string;
style?: EditorStyle;
plugins?: any[];
id?: string;
onChange?: ((value: string, editor: any) => void) | null;
onInput?: ((value: string, editor: any) => void) | null;
onFocus?: ((editor: any) => void) | null;
onBlur?: ((editor: any) => void) | null;
onSave?: ((value: string, editor: any) => void) | null;
onModeChange?: ((mode: string, editor: any) => void) | null;
onFullscreen?: ((fullscreen: boolean, editor: any) => void) | null;
onCreate?: ((editor: any) => void) | null;
onDestroy?: ((editor: any) => void) | null;
onLinkClick?: ((href: string, text: string, editor: any) => void) | null;
floatingToolbar?: boolean;
}
interface ThemeConfig {
bg: string;
text: string;
border: string;
shadow: string;
hoverShadow?: string;
toolbarBg?: string;
textareaBg?: string;
previewBg?: string;
codeBg?: string;
codeText?: string;
accent?: string;
muted?: string;
progressBg?: string;
closeHoverBg?: string;
}
interface AnimationConfig {
name?: string;
enter: Record<string, string>;
leave: Record<string, string>;
duration: number;
easing: string;
}
/** Default toolbar button sequence */
declare const DEFAULT_TOOLBAR: ToolbarItem[];
/** Default options */
declare const DEFAULTS: Readonly<EditorOptions>;
declare const THEMES: Record<string, ThemeConfig | string>;
declare const EDIT_MODES: EditMode[];
declare const TOOLBAR_ACTIONS: string[];
/**
* MetonaEditor Parser — lightweight Markdown parser (TypeScript)
* @module parser
* @version 0.2.0
*/
interface Token {
type: string;
[key: string]: any;
}
interface ParseResult {
tokens: Token[];
footnotes: Record<string, string>;
refs: Record<string, string>;
}
interface BlockHandler {
name: string;
priority: number;
test: (line: string, lines: string[], i: number) => any;
parse: (lines: string[], i: number, match: any, tokens: Token[], footnotes: Record<string, string>, refs?: Record<string, string>) => {
token: Token | null;
newIndex: number;
};
}
declare const clearRenderCache: () => void;
declare const safeUrl: (url: string | null | undefined) => string;
declare const slugify: (text: string) => string;
declare const registerBlockHandler: (handler: BlockHandler) => void;
declare const parseTokens: (md: string | null | undefined) => ParseResult;
declare const renderTokens: (tokens: Token[], env?: RenderEnv, footnotes?: Record<string, string>) => string;
declare const parseMarkdown: (md: string | null | undefined, env?: RenderEnv) => string;
/**
* MetonaEditor Core — MarkdownEditor class (TypeScript)
* @module core
* @version 0.2.0
*/
declare class MarkdownEditor {
static _hooks: Map<string, ((editor: MarkdownEditor) => void)[]>;
static on(name: string, fn: (editor: MarkdownEditor) => void): () => void;
static off(name: string, fn: (editor: MarkdownEditor) => void): void;
static trigger(name: string, instance: MarkdownEditor): void;
id: string;
container: HTMLElement;
config: EditorOptions;
el: HTMLElement;
toolbarEl: HTMLElement;
bodyEl: HTMLElement;
editorPane: HTMLElement;
editorInner: HTMLElement;
previewPane: HTMLElement;
dividerEl: HTMLElement;
textarea: HTMLTextAreaElement;
previewEl: HTMLElement;
gutter: HTMLElement;
statusEl: HTMLElement | null;
_value: string;
_mode: EditMode;
_history: string[];
_historyIndex: number;
_cleanups: Array<() => void>;
_plugins: any[];
_listeners: Record<string, Array<(...args: any[]) => void>>;
_renderRaf: number | null;
_historyTimer: ReturnType<typeof setTimeout> | null;
_fullscreen: boolean;
_destroyed: boolean;
_lastRenderedValue: string | null;
_shortcuts: any[];
_contextMenuItems: any[];
_customActions: Record<string, (...args: any[]) => void>;
_outlineTimer: ReturnType<typeof setTimeout> | null;
_zenMode: boolean;
_wordWrap: boolean;
_syncing: boolean;
_statsCache: {
value: string;
stats: any;
} | null;
_pendingCursor: {
start: number;
end: number;
} | null;
_lastSelStart: number;
_lastSelEnd: number;
_zenMouseHandler: ((e: MouseEvent) => void) | null;
_ariaLive: HTMLElement;
_renderFn: (md: string, env: RenderEnv) => string;
_highlightFn: ((code: string, lang: string) => string) | null;
_themeCtx: any;
_i18nCtx: InstanceI18n;
_floatingToolbar: HTMLElement | null;
_floatingEnabled: boolean;
_wrapSelection: (before: string, after: string) => void;
_toggleLinePrefix: (prefix: string) => void;
_insertBlock: (text: string) => void;
_insertLink: () => void;
_insertImage: () => void;
_insertTable: (rows?: number, cols?: number) => void;
_formatTable: () => void;
_initFloatingToolbar: () => void;
toggleFloatingToolbar: () => this;
isFloatingToolbar: () => boolean;
_buildFloatingToolbar: () => void;
_hideFloatingToolbar: () => void;
registerContextMenu: (items: any[]) => this;
_bindContextMenu: () => void;
_showContextMenu: (e: MouseEvent) => void;
_hideContextMenu: () => void;
_execContextAction: (action: string) => void;
_buildOutline: () => void;
_updateOutline: () => void;
_trackOutlineScroll: () => void;
constructor(container: string | HTMLElement, options?: EditorOptions);
_buildDOM(): void;
_buildToolbar(): void;
_createBtn(item: string): HTMLButtonElement;
_bindEvents(): void;
_handleKeydown(e: KeyboardEvent): void;
_handleTab(shift: boolean): void;
_bindDividerDrag(e: PointerEvent): void;
_saveDividerPosition(): void;
_restoreDividerPosition(): void;
_scheduleRender(): void;
_render(): void;
_renderGutter(): void;
_updateCurrentLine(): void;
/** 选区/光标事件:与浮动工具栏解耦,任何实例都会触发 */
_emitCursorEvents(): void;
_handleSmartEnter(e: KeyboardEvent): void;
_handleBracketAutoClose(e: KeyboardEvent): void;
_bindDragDrop(): void;
_scheduleHistory(): void;
_pushHistory(): void;
undo(): this;
redo(): this;
canUndo(): boolean;
canRedo(): boolean;
_applyHistory(): void;
_captureCursor(): void;
_restoreCapturedCursor(): void;
exec(action: string, ...args: any[]): this;
setMode(mode: EditMode): this;
getMode(): EditMode;
_updateModeButtons(): void;
toggleFullscreen(): this;
isFullscreen(): boolean;
exitFullscreen(): this;
toggleZen(): this;
_setZen(on: boolean): void;
isZen(): boolean;
_applyZenWidth(): void;
setZenMaxWidth(width: number | string | false): this;
getZenMaxWidth(): number | string | false;
toggleWordWrap(): this;
setWordWrap(on: boolean): this;
isWordWrap(): boolean;
_bindToolbarKeyboard(): void;
_initAriaLive(): void;
_announce(msg: string): void;
_syncScroll(): void;
_updateWordCount(): void;
getStats(): any;
/**
* 增量统计:基于上一次统计 + 差异区间(共同前缀/后缀之间的片段)计算,
* 避免每次击键对全文做 O(n) 正则。差异区间左右扩展至单词边界,
* 保证英文单词 / 中文串不会被边界切断,diff 结果与全量计算一致。
*/
_computeStats(text: string): any;
getSelectedText(): string;
getCursorPosition(): {
line: number;
column: number;
};
setCursorPosition(line: number, column?: number): this;
scrollToLine(line: number): this;
selectLine(line: number): this;
selectAll(): this;
replaceAll(search: string, replace: string, caseSensitive?: boolean): number;
replaceAllRegex(pattern: RegExp, replace: string): number;
lineCount(): number;
getLine(line: number): string;
_limitLength(value: string): string;
getValue(): string;
setValue(md: string, opts?: {
silent?: boolean;
}): this;
getHTML(): string;
refresh(): this;
copyAsMarkdown(): this;
copyAsHTML(): this;
insert(text: string, opts?: {
replace?: boolean;
}): this;
wrap(before: string, after: string): this;
focus(): this;
blur(): this;
enable(): this;
disable(): this;
isDisabled(): boolean;
setReadOnly(readOnly: boolean): this;
isReadOnly(): boolean;
on(name: string, fn: (...args: any[]) => void): () => void;
off(name: string, fn: (...args: any[]) => void): this;
_emit(name: string, ...args: any[]): void;
use(plugin: string | any, options?: any): this;
unuse(name: string): this;
getPlugins(): any[];
addToolbarButton(config: any): this;
registerShortcut(combo: string, handler: Function | string, description?: string): this;
unregisterShortcut(combo: string): this;
getShortcuts(): any[];
configureToolbar(tools: ToolbarItem[]): this;
removeToolbarButton(action: string): this;
toast(message: string, opts?: {
type?: string;
duration?: number;
animation?: string;
}): this;
setLocale(locale: string): this;
getLocale(): string;
t(key: string, params?: Record<string, any>): string;
setTheme(theme: ThemeName): this;
getTheme(): string;
getThemeContext(): any;
getStatus(): {
id: string;
mode: EditMode;
theme: string;
locale: string;
fullscreen: boolean;
readOnly: boolean;
disabled: boolean;
destroyed: boolean;
plugins: any[];
};
destroy(): void;
isDestroyed(): boolean;
}
/**
* MetonaEditor Themes — theme system
* @module themes
* @version 0.2.0
*/
declare const exportCSSVars: (el?: HTMLElement) => Record<string, string>;
declare const getCSSVariable: (name: string, el?: HTMLElement) => string;
declare const followExternalTheme: (options: {
element?: HTMLElement;
attr?: string;
classMap?: Record<string, string>;
callback?: (el: HTMLElement) => string | null;
}, onThemeChange: (theme: string) => void) => () => void;
declare const adoptFromParent: (container: HTMLElement, onThemeDetected: (theme: string) => void) => () => void;
declare const createInstanceTheme: (editor: any) => any;
declare const themeUtils: {
getSystemTheme: () => "light" | "dark";
resolveTheme: (theme: string) => string;
getThemeConfig: (theme: string) => ThemeConfig;
watchSystemTheme: () => void;
unwatchSystemTheme: () => void;
applyTheme: (theme: string) => void;
getCurrentTheme: () => string;
getResolvedTheme: () => string;
switchTheme: (theme: string) => void;
toggleTheme: () => void;
resetToAuto: () => void;
initTheme: () => void;
saveTheme: (theme: string) => void;
loadTheme: () => string;
addThemeListener: (fn: (theme: string, resolved: string) => void) => () => void;
removeThemeListener: (fn: (theme: string, resolved: string) => void) => void;
clearThemeListeners: () => void;
registerTheme: (name: string, config?: Partial<ThemeConfig> & {
extends?: string;
}) => void;
unregisterTheme: (name: string) => void;
getAllThemes: () => Record<string, ThemeConfig | string>;
getThemeNames: () => string[];
hasTheme: (name: string) => boolean;
setThemeVariables: (config: ThemeConfig, target?: HTMLElement) => void;
exportCSSVars: (el?: HTMLElement) => Record<string, string>;
getCSSVariable: (name: string, el?: HTMLElement) => string;
applyThemeToElement: (theme: string, target: HTMLElement) => void;
followExternalTheme: (options: {
element?: HTMLElement;
attr?: string;
classMap?: Record<string, string>;
callback?: (el: HTMLElement) => string | null;
}, onThemeChange: (theme: string) => void) => () => void;
adoptFromParent: (container: HTMLElement, onThemeDetected: (theme: string) => void) => () => void;
watch: (source: Function | string, onChange: (theme: string) => void) => () => void;
createInstanceTheme: (editor: any) => any;
};
/**
* MetonaEditor Animations — animation metadata
* @module animations
* @version 0.2.0
*/
declare const animationUtils: {
register(name: string, config: Partial<AnimationConfig> & {
enter?: Record<string, string>;
leave?: Record<string, string>;
}): void;
unregister(name: string): void;
get(name: string): AnimationConfig | null;
getAnimationNames(): string[];
getActiveCount(): number;
cancelAll(): void;
reset(): void;
destroy(): void;
};
declare const VERSION = "0.4.1";
declare function create(container: string | HTMLElement, options?: EditorOptions): MarkdownEditor;
declare function use(plugin: string | any, options?: any): typeof api;
declare function on(name: string, fn: (editor: MarkdownEditor) => void): () => void;
declare function off(name: string, fn: (editor: MarkdownEditor) => void): typeof api;
declare function setTheme(theme: ThemeName, _options?: any): typeof api;
declare function setLocale(locale: string): typeof api;
declare function destroy(): void;
declare function getStatus(): {
version: string;
theme: string;
locale: string;
globalPlugins: any[];
presetPlugins: string[];
};
declare const api: {
VERSION: string;
version: string;
MarkdownEditor: typeof MarkdownEditor;
Editor: typeof MarkdownEditor;
create: typeof create;
use: typeof use;
on: typeof on;
off: typeof off;
setTheme: typeof setTheme;
setLocale: typeof setLocale;
destroy: typeof destroy;
getStatus: typeof getStatus;
parseMarkdown: (md: string | null | undefined, env?: RenderEnv) => string;
parseTokens: (md: string | null | undefined) => ParseResult;
renderTokens: (tokens: Token[], env?: RenderEnv, footnotes?: Record<string, string>) => string;
safeUrl: (url: string | null | undefined) => string;
slugify: (text: string) => string;
clearRenderCache: () => void;
registerBlockHandler: (handler: BlockHandler) => void;
highlight: (code: string, lang: string) => string;
normalizeLanguage: (lang: string) => string;
registerLanguage: (name: string, def: LanguageDef) => void;
getSupportedLanguages: () => string[];
themes: {
getSystemTheme: () => "light" | "dark";
resolveTheme: (theme: string) => string;
getThemeConfig: (theme: string) => ThemeConfig;
watchSystemTheme: () => void;
unwatchSystemTheme: () => void;
applyTheme: (theme: string) => void;
getCurrentTheme: () => string;
getResolvedTheme: () => string;
switchTheme: (theme: string) => void;
toggleTheme: () => void;
resetToAuto: () => void;
initTheme: () => void;
saveTheme: (theme: string) => void;
loadTheme: () => string;
addThemeListener: (fn: (theme: string, resolved: string) => void) => () => void;
removeThemeListener: (fn: (theme: string, resolved: string) => void) => void;
clearThemeListeners: () => void;
registerTheme: (name: string, config?: Partial<ThemeConfig> & {
extends?: string;
}) => void;
unregisterTheme: (name: string) => void;
getAllThemes: () => Record<string, ThemeConfig | string>;
getThemeNames: () => string[];
hasTheme: (name: string) => boolean;
setThemeVariables: (config: ThemeConfig, target?: HTMLElement) => void;
exportCSSVars: (el?: HTMLElement) => Record<string, string>;
getCSSVariable: (name: string, el?: HTMLElement) => string;
applyThemeToElement: (theme: string, target: HTMLElement) => void;
followExternalTheme: (options: {
element?: HTMLElement;
attr?: string;
classMap?: Record<string, string>;
callback?: (el: HTMLElement) => string | null;
}, onThemeChange: (theme: string) => void) => () => void;
adoptFromParent: (container: HTMLElement, onThemeDetected: (theme: string) => void) => () => void;
watch: (source: Function | string, onChange: (theme: string) => void) => () => void;
createInstanceTheme: (editor: any) => any;
};
i18n: {
t: (key: string, params?: Record<string, any>, locale?: string) => string;
getCurrentLocale: () => string;
setCurrentLocale: (locale: string) => void;
switchLocale: (locale: string) => void;
getFallbackLocale: () => string;
setFallbackLocale: (locale: string) => void;
hasTranslation: (key: string) => boolean;
getTranslations: (locale: string) => Record<string, any>;
addTranslations: (locale: string, translations: Record<string, any>) => void;
loadRemote: (url: string, locale: string) => Promise<boolean>;
getSupportedLocales: () => string[];
isLocaleSupported: (locale: string) => boolean;
getLocaleName: (locale: string) => string;
getLocaleDirection: (locale: string) => "ltr" | "rtl";
formatNumber: (number: number, options?: Intl.NumberFormatOptions) => string;
formatCurrency: (amount: number, currency?: string, options?: Intl.NumberFormatOptions) => string;
formatDate: (date: Date | string, options?: Intl.DateTimeFormatOptions) => string;
addLocaleListener: (fn: (locale: string) => void) => () => void;
removeLocaleListener: (fn: (locale: string) => void) => void;
clearLocaleListeners: () => void;
initI18n: () => void;
saveLocale: (locale: string) => void;
loadLocale: () => string;
getDefaultLocale: () => string;
createInstanceI18n: (editor: any) => InstanceI18n;
};
animations: {
register(name: string, config: Partial<AnimationConfig> & {
enter?: Record<string, string>;
leave?: Record<string, string>;
}): void;
unregister(name: string): void;
get(name: string): AnimationConfig | null;
getAnimationNames(): string[];
getActiveCount(): number;
cancelAll(): void;
reset(): void;
destroy(): void;
};
plugins: {
createManager: () => PluginManager;
manager: PluginManager;
register: (name: string, plugin: Plugin) => PluginManager;
unregister: (name: string) => PluginManager;
get: (name: string) => Plugin | null;
has: (name: string) => boolean;
getAll: () => Plugin[];
getNames: () => string[];
enable: (name: string) => PluginManager;
disable: (name: string) => PluginManager;
isEnabled: (name: string) => boolean;
getPreset: (name: string) => Plugin | null;
getAllPresets: () => Record<string, Plugin>;
createPlugin: (config?: Partial<Plugin>) => Plugin;
validatePlugin: (plugin: any) => {
valid: boolean;
errors: string[];
};
topologicalSort: (plugins: Plugin[]) => Plugin[];
validateConfig: (schema?: PluginSchema, config?: Record<string, any>) => {
valid: boolean;
errors: string[];
patched: Record<string, any>;
};
};
presetPlugins: Record<string, Plugin>;
topologicalSort: (plugins: Plugin[]) => Plugin[];
validateConfig: (schema?: PluginSchema, config?: Record<string, any>) => {
valid: boolean;
errors: string[];
patched: Record<string, any>;
};
createInstanceI18n: (editor: any) => InstanceI18n;
loadRemote: (url: string, locale: string) => Promise<boolean>;
exportCSSVars: (el?: HTMLElement) => Record<string, string>;
getCSSVariable: (name: string, el?: HTMLElement) => string;
followExternalTheme: (options: {
element?: HTMLElement;
attr?: string;
classMap?: Record<string, string>;
callback?: (el: HTMLElement) => string | null;
}, onThemeChange: (theme: string) => void) => () => void;
adoptFromParent: (container: HTMLElement, onThemeDetected: (theme: string) => void) => () => void;
createInstanceTheme: (editor: any) => any;
DEFAULTS: Readonly<EditorOptions>;
ICONS: Record<string, string>;
THEMES: Record<string, string | ThemeConfig>;
EDIT_MODES: EditMode[];
DEFAULT_TOOLBAR: string[];
TOOLBAR_ACTIONS: string[];
};
export { DEFAULTS, DEFAULT_TOOLBAR, EDIT_MODES, MarkdownEditor as Editor, ICONS, MarkdownEditor, api as MeEditor, THEMES, TOOLBAR_ACTIONS, VERSION, adoptFromParent, animationUtils, api, clearRenderCache, create, createInstanceI18n, createInstanceTheme, api as default, destroy, exportCSSVars, followExternalTheme, getCSSVariable, getStatus, getSupportedLanguages, highlight, i18nUtils, loadRemote, api as meEditor, normalizeLanguage, off, on, parseMarkdown, parseTokens, pluginUtils, presetPlugins, registerBlockHandler, registerLanguage, renderTokens, safeUrl, setLocale, setTheme, slugify, themeUtils, topologicalSort, use, validateConfig };