Back to Trilium

Interface CodeMirrorInstance

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

0.102.23.4 KB
Original Source

Interface CodeMirrorInstance

interface CodeMirrorInstance {
doc: {
getValue(): string;
markText(
from: number | { ch: number; line: number },
to: number | { ch: number; line: number },
opts: { className: string },
): any;
replaceRange(text: string, from: number, to: number): any;
setSelection(from: number, to: number): any;
};
clearHistory(): any;
focus(): any;
getCursor(): { ch: number; col: number; line: number };
getSelection(): string;
getValue(): string;
lineCount(): number;
on(event: string, callback: () => void): any;
operation(callback: () => void): any;
refresh(): any;
scrollIntoView(pos: number): any;
setCursor(line: number, col: number): any;
setOption(name: string, value: string): any;
setValue(val: string): any;
}

Index

Properties

doc

Methods

clearHistoryfocusgetCursorgetSelectiongetValuelineCountonoperationrefreshscrollIntoViewsetCursorsetOptionsetValue

Properties

doc

doc: {
getValue(): string;
markText(
from: number | { ch: number; line: number },
to: number | { ch: number; line: number },
opts: { className: string },
): any;
replaceRange(text: string, from: number, to: number): any;
setSelection(from: number, to: number): any;
}

Methods

clearHistory

clearHistory(): any

Returns any

focus

focus(): any

Returns any

getCursor

getCursor(): { ch: number; col: number; line: number }

Returns { ch: number; col: number; line: number }

getSelection

getSelection(): string

Returns string

getValue

getValue(): string

Returns string

lineCount

lineCount(): number

Returns number

on

on(event: string, callback: () => void): any

Parameters

  • event: string
  • callback: () => void

Returns any

operation

operation(callback: () => void): any

Parameters

  • callback: () => void

Returns any

refresh

refresh(): any

Returns any

scrollIntoView

scrollIntoView(pos: number): any

Parameters

  • pos: number

Returns any

setCursor

setCursor(line: number, col: number): any

Parameters

  • line: number
  • col: number

Returns any

setOption

setOption(name: string, value: string): any

Parameters

  • name: string
  • value: string

Returns any

setValue

setValue(val: string): any

Parameters

  • val: string

Returns any

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Properties doc Methods clearHistoryfocusgetCursorgetSelectiongetValuelineCountonoperationrefreshscrollIntoViewsetCursorsetOptionsetValue