@hey-web-components/monaco-editor
Version:
A web component wrapper for monaco-editor.
39 lines (38 loc) • 1.46 kB
TypeScript
import { LitElement } from 'lit';
import * as monaco from 'monaco-editor';
export type EditorInstance = monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;
/**
* @fires {CustomEvent<{monaco?: Monaco; editor?: EditorInstance}>} editorInitialized - Fires when the editor is initialized.
*/
export declare abstract class EditorBase<T extends EditorInstance> extends LitElement {
static styles: import("lit").CSSResult[];
/**
* @internal
*/
protected abstract readonly PROPERTY_CHANGE_HANDLER_DICT: {
[propertyName: string]: (value: unknown) => void;
};
/**
* @internal
*/
protected readonly innerContainerRef: import("lit/directives/ref.js").Ref<HTMLDivElement>;
/**
* After component loaded, the `Monaco` instance can be obtained using this property.
*/
get monaco(): typeof monaco;
/**
* After component loaded, the editor instance can be obtained using this property.
*/
editor?: T;
/**
* The `options` for the editor.
*/
abstract options?: monaco.editor.IEditorOptions;
firstUpdated(): void;
shouldUpdate(changedProperties: Map<string, unknown>): boolean;
render(): import("lit").TemplateResult<1>;
protected initializeEditor(): Promise<void>;
protected loadMonaco(): Promise<void>;
protected defineEvents(): void;
protected abstract loadEditor(editorContainer?: HTMLDivElement): Promise<void>;
}