Editor
A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
#
Constructorconstructor();
#
Methods#
getDocgetDoc(): this;
#
refreshabstract refresh(): void;
#
getValueabstract getValue(): string;
#
setValueabstract setValue(content: string): void;
#
getLineabstract getLine(line: number): string;
Get the text at line (0-indexed)
#
setLinesetLine(n: number, text: string): void;
#
lineCountabstract lineCount(): number;
Gets the number of lines in the document
#
lastLineabstract lastLine(): number;
#
getSelectionabstract getSelection(): string;
#
somethingSelectedsomethingSelected(): boolean;
#
getRangeabstract getRange(from: EditorPosition, to: EditorPosition): string;
#
replaceSelectionabstract replaceSelection(replacement: string, origin?: string): void;
#
replaceRangeabstract replaceRange(replacement: string, from: EditorPosition, to?: EditorPosition, origin?: string): void;
#
getCursorabstract getCursor(string?: 'from' | 'to' | 'head' | 'anchor'): EditorPosition;
#
listSelectionsabstract listSelections(): EditorSelection[];
#
setCursorsetCursor(pos: EditorPosition | number, ch?: number): void;
#
setSelectionabstract setSelection(anchor: EditorPosition, head?: EditorPosition): void;
#
setSelectionsabstract setSelections(ranges: EditorSelectionOrCaret[], main?: number): void;
#
focusabstract focus(): void;
#
blurabstract blur(): void;
#
hasFocusabstract hasFocus(): boolean;
#
getScrollInfoabstract getScrollInfo(): { top: number; left: number;};
#
scrollToabstract scrollTo(x?: number | null, y?: number | null): void;
#
scrollIntoViewabstract scrollIntoView(range: EditorRange, center?: boolean): void;
#
undoabstract undo(): void;
#
redoabstract redo(): void;
#
execabstract exec(command: EditorCommandName): void;
#
transactionabstract transaction(tx: EditorTransaction, origin?: string): void;
#
wordAtabstract wordAt(pos: EditorPosition): EditorRange | null;
#
posToOffsetabstract posToOffset(pos: EditorPosition): number;
#
offsetToPosabstract offsetToPos(offset: number): EditorPosition;
#
processLinesprocessLines<T>(read: (line: number, lineText: string) => T | null, write: (line: number, lineText: string, value: T | null) => EditorChange | void, ignoreEmpty?: boolean): void;