This commit is contained in:
Michael Yang 2024-06-21 18:21:27 +08:00
parent f23296ad12
commit 5bcb001e09
1 changed files with 7 additions and 6 deletions

View File

@ -60,16 +60,18 @@ export type AiEditorOptions = {
theme?: "light" | "dark", theme?: "light" | "dark",
onMentionQuery?: (query: string) => any[] | Promise<any[]>, onMentionQuery?: (query: string) => any[] | Promise<any[]>,
onCreateBefore?: (editor: AiEditor, extensions: Extensions) => void | Extensions, onCreateBefore?: (editor: AiEditor, extensions: Extensions) => void | Extensions,
onDestroy?: (editor: AiEditor) => void,
onCreated?: (editor: AiEditor) => void, onCreated?: (editor: AiEditor) => void,
onChange?: (editor: AiEditor) => void, onChange?: (editor: AiEditor) => void,
onFocus?: (editor: AiEditor) => void,
onBlur?: (editor: AiEditor) => void,
onDestroy?: (editor: AiEditor) => void,
onSave?: (editor: AiEditor) => boolean, onSave?: (editor: AiEditor) => boolean,
toolbarKeys?: (string | CustomMenu)[], toolbarKeys?: (string | CustomMenu)[],
draggable?: boolean, draggable?: boolean,
textSelectionBubbleMenu?: { textSelectionBubbleMenu?: {
enable?: boolean, enable?: boolean,
elementTagName?: string, elementTagName?: string,
items?:(string)[], items?: (string)[],
}, },
link?: { link?: {
autolink?: boolean, autolink?: boolean,
@ -246,7 +248,9 @@ export class AiEditor {
extensions: extensions, extensions: extensions,
onCreate: (props) => this.onCreate(props), onCreate: (props) => this.onCreate(props),
onTransaction: (props) => this.onTransaction(props), onTransaction: (props) => this.onTransaction(props),
onDestroy: () => this.onDestroy, onFocus: () => this.options?.onFocus?.(this),
onBlur: () => this.options?.onBlur?.(this),
onDestroy: () => this.options?.onDestroy?.(this),
editorProps: { editorProps: {
attributes: { attributes: {
class: "aie-content" class: "aie-content"
@ -302,9 +306,6 @@ export class AiEditor {
} }
} }
private onDestroy() {
}
getHtml() { getHtml() {
return this.innerEditor.getHTML(); return this.innerEditor.getHTML();
} }