import { LitElement, PropertyValues, TemplateResult } from '../base'; import { EditorState, Transaction, Plugin } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import { MdMenuItemType } from './menuItems'; export interface MarkdownEditorElementProps { menuItems?: Array; minHeight?: string; } /** * Element for editing markdown. * * @example * * ```html * **some** markdown *text* * ``` * * ```ts * const md = '#my heading'; * html`` * ``` * */ export declare class MarkdownEditorElement extends LitElement implements MarkdownEditorElementProps { static styles: import("lit-element/lib/css-tag").CSSResult[]; menuItems: Array; minHeight: string; value: string; _focused: boolean; protected view: EditorView; editor: Promise; menu: Promise; protected _value: string; /** * update editor state with new markdown * @todo move to function for setState and create a clearState */ set markdown(value: string); /** * get markdown from the current state of the editor */ get markdown(): string; get state(): EditorState; firstUpdated(props: PropertyValues): void; protected updated(props: PropertyValues): void; /** * create editor when element connects to dom */ connectedCallback(): void; /** * teardown editor when element disconnects from dom */ disconnectedCallback(): void; private initializeEditor; focusPlugin(element: any, handleActiveState: any): Plugin; handleActiveState(element: this, state: boolean): void; protected createEditorState(): Promise; protected createEditorView(state: EditorState): Promise; /** * handle editor transitions */ protected handleTransaction(tr: Transaction): void; /** * this should actually only be handle on blur * throttle incase some one two-way binds this component * cache the current markdown, to compare with incoming values * * @todo this value might need to be increased */ protected handleChange(tr: Transaction): void; private setMinHeight; protected render(): TemplateResult; } declare global { interface HTMLElementTagNameMap { 'fusion-markdown-editor': MarkdownEditorElement; } } export default MarkdownEditorElement;