UNPKG

1.66 kBTypeScriptView Raw
1import { Disposable, PixelPosition, PointLike, TextEditor, TextEditorComponent } from "../index";
2
3/**
4 * Undocumented: Custom HTML elemnent for TextEditor, atom-text-editor
5 */
6export interface TextEditorElement extends HTMLElement {
7 getModel(): TextEditor;
8 getComponent(): TextEditorComponent;
9 /**
10 * Extended: Get a promise that resolves the next time the element's
11 * DOM is updated in any way.
12 */
13 getNextUpdatePromise(): Promise<void>;
14
15 /** Extended: get the width of an `x` character displayed in this element. */
16 getBaseCharacterWidth(): number;
17
18 /** Essential: Scrolls the editor to the top. */
19 scrollToTop(): void;
20
21 /** Essential: Scrolls the editor to the bottom. */
22 scrollToBottom(): void;
23
24 hasFocus(): boolean;
25
26 setScrollTop(scrollTop: number): void;
27 getScrollTop(): number;
28
29 setScrollLeft(scrollLeft: number): void;
30 getScrollLeft(): number;
31
32 getScrollHeight(): number;
33
34 /** Extended: Converts a buffer position to a pixel position. */
35 pixelPositionForBufferPosition(bufferPosition: PointLike): PixelPosition;
36
37 /** Extended: Converts a screen position to a pixel position. */
38 pixelPositionForScreenPosition(screenPosition: PointLike): PixelPosition;
39
40 // Event subscription
41 onDidChangeScrollTop(callback: (scrollTop: number) => void): Disposable;
42 onDidChangeScrollLeft(callback: (scrollLeft: number) => void): Disposable;
43 /** Called when the editor is attached to the DOM. */
44 onDidAttach(callback: () => void): Disposable;
45 /** Called when the editor is detached from the DOM. */
46 onDidDetach(callback: () => void): Disposable;
47}