fei-editor
Version:
基于vue的代码编辑器插件
146 lines (134 loc) • 4.24 kB
TypeScript
import { App } from 'vue';
import { ComponentOptionsMixin } from 'vue';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { PropType } from 'vue';
import { PublicProps } from 'vue';
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
declare type __VLS_Prettify<T> = {
[K in keyof T]: T[K];
} & {};
declare type __VLS_TypePropsToRuntimeProps<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? {
type: PropType<__VLS_NonUndefinedable<T[K]>>;
} : {
type: PropType<T[K]>;
required: true;
};
};
declare type __VLS_WithDefaults<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
default: D[K];
}> : P[K];
};
declare const _default: {
version: string;
install: (app: App, options?: InstallOptions) => App;
};
export default _default;
export declare const Editor: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
lang: string;
theme: string;
height: string;
width: string;
fontSize: number;
readonly: boolean;
wrap: boolean;
snippets: boolean;
}>, {
getValue: () => string;
setValue: (value: string, cursor?: number) => void;
setTheme: (theme: string) => void;
setLang: (lang: string) => void;
setMode: (lang: string) => void;
setReadOnly: (readonly: boolean) => void | undefined;
setFontSize: (size: number) => void | undefined;
resize: () => void | undefined;
destroy: () => void;
focus: () => void;
blur: () => void;
getEditor: () => EditorInstance | null;
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
blur: (event: Event) => void;
focus: (event: Event) => void;
init: (editor: any) => void;
"update:modelValue": (value: string) => void;
change: (value: string) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
lang: string;
theme: string;
height: string;
width: string;
fontSize: number;
readonly: boolean;
wrap: boolean;
snippets: boolean;
}>>> & {
onBlur?: ((event: Event) => any) | undefined;
onFocus?: ((event: Event) => any) | undefined;
onInit?: ((editor: any) => any) | undefined;
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
onChange?: ((value: string) => any) | undefined;
}, {
lang: string;
theme: string;
height: string;
width: string;
fontSize: number;
readonly: boolean;
wrap: boolean;
snippets: boolean;
}, {}>;
declare interface EditorInstance {
getValue(): string;
setValue(value: string, cursor?: number): void;
setTheme(theme: string): void;
setReadOnly(readonly: boolean): void;
setFontSize(size: string | number): void;
setOptions(options: Record<string, any>): void;
focus(): void;
blur(): void;
resize(): void;
destroy(): void;
on(event: string, callback: Function): void;
getSession(): {
setMode(mode: string): void;
setValue(value: string, cursor?: number): void;
setUseWrapMode(use: boolean): void;
setTabSize(size: number): void;
};
container: HTMLElement;
$blockScrolling: number;
setShowPrintMargin(show: boolean): void;
gotoLine(line: number, column: number, animate: boolean): void;
}
declare interface EditorProps {
modelValue?: string;
lang?: string;
theme?: string;
height?: string;
width?: string;
fontSize?: number;
options?: Record<string, any>;
readonly?: boolean;
wrap?: boolean;
snippets?: boolean;
styles?: Record<string, any>;
}
export declare interface InstallOptions {
disabledDoc?: boolean;
}
declare interface Props extends EditorProps {
modelValue?: string;
lang?: string;
theme?: string;
height?: string;
width?: string;
fontSize?: number;
options?: Record<string, any>;
readonly?: boolean;
wrap?: boolean;
snippets?: boolean;
styles?: Record<string, any>;
}
export { }