lexical-vue
Version:
An extensible Vue 3 web text-editor based on Lexical.
40 lines (39 loc) • 1.94 kB
TypeScript
import * as __VLS_VINE from 'vue-vine/internals';
import type { CommandListenerPriority, LexicalCommand, LexicalEditor, LexicalNode } from 'lexical';
import type { MenuRenderProps } from './shared/LexicalMenu.vine';
import { MenuOption } from './shared/LexicalMenu.vine';
export interface EmbedMatchResult<TEmbedMatchResult = unknown> {
url: string;
id: string;
data?: TEmbedMatchResult;
}
export interface EmbedConfig<TEmbedMatchResultData = unknown, TEmbedMatchResult = EmbedMatchResult<TEmbedMatchResultData>> {
type: string;
parseUrl: (text: string) => Promise<TEmbedMatchResult | null> | TEmbedMatchResult | null;
insertNode: (editor: LexicalEditor, result: TEmbedMatchResult) => void;
}
export declare const URL_MATCHER: RegExp;
export declare const INSERT_EMBED_COMMAND: LexicalCommand<EmbedConfig['type']>;
export declare class AutoEmbedOption extends MenuOption {
title: string;
onSelect: (targetNode: LexicalNode | null) => void;
constructor(title: string, options: {
onSelect: (targetNode: LexicalNode | null) => void;
});
}
interface LexicalAutoEmbedPluginProps<TEmbedConfig extends EmbedConfig> {
embedConfigs: TEmbedConfig[];
getMenuOptions: (activeEmbedConfig: TEmbedConfig, embedFn: () => void, dismissFn: () => void) => AutoEmbedOption[];
menuCommandPriority?: CommandListenerPriority;
}
type __VLS_VINE_LexicalAutoEmbedPlugin_emits__ = __VLS_NormalizeEmits<__VLS_VINE.VueDefineEmits<{
openEmbedModalForConfig: [embedConfig: TEmbedConfig];
}>>;
export declare function LexicalAutoEmbedPlugin<TEmbedConfig extends EmbedConfig>(props: __VLS_VINE.VineComponentCommonProps & LexicalAutoEmbedPluginProps<TEmbedConfig> & {
onOpenEmbedModalForConfig: __VLS_VINE_LexicalAutoEmbedPlugin_emits__['openEmbedModalForConfig'];
}, context: {
slots: {
default: (props: MenuRenderProps<AutoEmbedOption>) => any;
};
}): __VLS_VINE.VueVineComponent;
export {};