UNPKG

1.85 kBTypeScriptView Raw
1import '../../';
2
3declare module '../../' {
4 interface Panel {
5 /** Removes the panel from the editor */
6 clear(): void;
7 /** Notifies panel that height of DOM node has changed */
8 changed(height?: number): void;
9 }
10
11 interface ShowPanelOptions {
12 /**
13 * Controls the position of the newly added panel. The following values are recognized:
14 * `top` (default): Adds the panel at the very top.
15 * `after-top`: Adds the panel at the bottom of the top panels.
16 * `bottom`: Adds the panel at the very bottom.
17 * `before-bottom`: Adds the panel at the top of the bottom panels.
18 */
19 position?: 'top' | 'after-top' | 'bottom' | 'before-bottom' | undefined;
20 /** The new panel will be added before the given panel. */
21 before?: Panel | undefined;
22 /** The new panel will be added after the given panel. */
23 after?: Panel | undefined;
24 /** The new panel will replace the given panel. */
25 replace?: Panel | undefined;
26 /** Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */
27 stable?: boolean | undefined;
28 /** The initial height of the panel. Defaults to the offsetHeight of the node. */
29 height?: number | undefined;
30 }
31
32 interface Editor {
33 /**
34 * Places a DOM node above or below an editor and shrinks the editor to make room for the node.
35 * When using the `after`, `before` or `replace` options, if the panel doesn't exists or has been removed, the value of the `position` option will be used as a fallback.
36 * @param node the DOM node
37 * @param options optional options object
38 */
39 addPanel(node: HTMLElement, options?: ShowPanelOptions): Panel;
40 }
41}