2 export interface MarkdownEditorInputSelection {
7 export interface MarkdownEditorInput {
14 * Get the current selection range.
16 getSelection(): MarkdownEditorInputSelection;
19 * Get the text of the given (or current) selection range.
21 getSelectionText(selection?: MarkdownEditorInputSelection): string;
24 * Set the selection range of the editor.
26 setSelection(selection: MarkdownEditorInputSelection, scrollIntoView: boolean): void;
29 * Get the full text of the input.
34 * Get just the text which is above (out) the current view range.
35 * This is used for position estimation.
37 getTextAboveView(): string;
40 * Set the full text of the input.
41 * Optionally can provide a selection to restore after setting text.
43 setText(text: string, selection?: MarkdownEditorInputSelection): void;
46 * Splice in/out text within the input.
47 * Optionally can provide a selection to restore after setting text.
49 spliceText(from: number, to: number, newText: string, selection: Partial<MarkdownEditorInputSelection>|null): void;
52 * Append text to the end of the editor.
54 appendText(text: string): void;
57 * Get the text of the given line number otherwise the text
58 * of the current selected line.
60 getLineText(lineIndex:number): string;
63 * Get a selection representing the line range from the given position.
65 getLineRangeFromPosition(position: number): MarkdownEditorInputSelection;
68 * Convert the given screen coords to a selection position within the input.
70 coordsToSelection(x: number, y: number): MarkdownEditorInputSelection;
73 * Search and return a line range which includes the provided text.
75 searchForLineContaining(text: string): MarkdownEditorInputSelection|null;
78 * Tear down the input.