Back to Trilium

Interface TextEditor

docs/Script API/interfaces/Frontend_Script_API._internal_.TextEditor.html

0.102.26.7 KB
Original Source

Interface TextEditor

interface TextEditor {
conversion: {
for(
filter: string,
): {
markerToHighlight(
data: { model: string; view: (data: { markerName: string }) => void },
): any;
};
};
data: {
processor: { toView(html: string): any };
toModel(viewFeragment: any): any;
};
editing: {
view: {
document: {
getRoot(): CKNode;
on(
event: string,
cb: (event: CKEvent, data: { preventDefault(): any }) => void,
opts?: { priority: "high" },
): any;
};
domRoots: { values: () => { next: () => { value: string } } };
change(cb: (writer: Writer) => void): any;
focus(): void;
scrollToTheSelection(): void;
};
};
model: {
document: {
differ: {
getChanges(): {
name: string;
position?: { nodeAfter?: CKNode; parent: CKNode; toJSON(): Object };
type: string;
}[];
};
selection: {
isCollapsed: boolean;
getAttribute(attribute: string): string;
getFirstPosition(): undefined | TextPosition;
getFirstRange(): Range;
getLastPosition(): undefined | TextPosition;
getSelectedElement(): CKNode;
hasAttribute(attribute: string): boolean;
};
getRoot(): CKNode;
on(event: string, cb: () => void): any;
registerPostFixer(callback: (writer: Writer) => boolean): any;
};
change(cb: (writer: Writer) => void): any;
insertContent(modelFragment: any, selection?: any): any;
};
plugins: { get(command: string): any };
sourceElement: HTMLElement;
create(
el: HTMLElement,
config: {
mention: MentionConfig;
placeholder: string;
removePlugins?: string[];
toolbar: { items: any[] };
},
): any;
enableReadOnlyMode(reason: string): any;
execute<T>(action: string, ...args: unknown[]): T;
focus(): void;
getData(): string;
getSelectedHtml(): string;
removeSelection(): void;
setData(data: string): void;
}

Index

Properties

conversiondataeditingmodelpluginssourceElement

Methods

createenableReadOnlyModeexecutefocusgetDatagetSelectedHtmlremoveSelectionsetData

Properties

conversion

conversion: {
for(
filter: string,
): {
markerToHighlight(
data: { model: string; view: (data: { markerName: string }) => void },
): any;
};
}

data

data: {
processor: { toView(html: string): any };
toModel(viewFeragment: any): any;
}

editing

editing: {
view: {
document: {
getRoot(): CKNode;
on(
event: string,
cb: (event: CKEvent, data: { preventDefault(): any }) => void,
opts?: { priority: "high" },
): any;
};
domRoots: { values: () => { next: () => { value: string } } };
change(cb: (writer: Writer) => void): any;
focus(): void;
scrollToTheSelection(): void;
};
}

model

model: {
document: {
differ: {
getChanges(): {
name: string;
position?: { nodeAfter?: CKNode; parent: CKNode; toJSON(): Object };
type: string;
}[];
};
selection: {
isCollapsed: boolean;
getAttribute(attribute: string): string;
getFirstPosition(): undefined | TextPosition;
getFirstRange(): Range;
getLastPosition(): undefined | TextPosition;
getSelectedElement(): CKNode;
hasAttribute(attribute: string): boolean;
};
getRoot(): CKNode;
on(event: string, cb: () => void): any;
registerPostFixer(callback: (writer: Writer) => boolean): any;
};
change(cb: (writer: Writer) => void): any;
insertContent(modelFragment: any, selection?: any): any;
}

plugins

plugins: { get(command: string): any }

sourceElement

sourceElement: HTMLElement

Methods

create

create(
el: HTMLElement,
config: {
mention: MentionConfig;
placeholder: string;
removePlugins?: string[];
toolbar: { items: any[] };
},
): any

Parameters

  • el: HTMLElement
  • config: {
    mention: MentionConfig;
    placeholder: string;
    removePlugins?: string[];
    toolbar: { items: any[] };
    }

Returns any

enableReadOnlyMode

enableReadOnlyMode(reason: string): any

Parameters

  • reason: string

Returns any

execute

execute<T>(action: string, ...args: unknown[]): T

Type Parameters

  • T

Parameters

  • action: string
  • ...args: unknown[]

Returns T

focus

focus(): void

Returns void

getData

getData(): string

Returns string

getSelectedHtml

getSelectedHtml(): string

Returns string

removeSelection

removeSelection(): void

Returns void

setData

setData(data: string): void

Parameters

  • data: string

Returns void

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Properties conversiondataeditingmodelpluginssourceElement Methods createenableReadOnlyModeexecutefocusgetDatagetSelectedHtmlremoveSelectionsetData