UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

37 lines (36 loc) 1.62 kB
import { EditorState, EditorView, Schema, Node, Plugin, PluginKey, NodeViewDesc } from '../../prosemirror'; export declare type CodeMirrorFocusSubscriber = (uniqueId: string | undefined) => any; export declare type CodeBlockStateSubscriber = (state: CodeBlockState) => any; export declare type StateChangeHandler = (state: CodeBlockState) => any; export declare class CodeBlockState { element?: HTMLElement; language: string | undefined; supportedLanguages: string[]; toolbarVisible: boolean; domEvent: boolean; uniqueId: string | undefined; activeCodeBlock?: Node; editorFocused: boolean; private state; private changeHandlers; private focusHandlers; constructor(state: EditorState<any>); subscribe(cb: CodeBlockStateSubscriber): void; unsubscribe(cb: CodeBlockStateSubscriber): void; subscribeFocusHandlers(cb: CodeMirrorFocusSubscriber): void; unsubscribeFocusHandlers(cb: CodeMirrorFocusSubscriber): void; updateLanguage(language: string | undefined, view: EditorView): void; removeCodeBlock(view: EditorView): void; updateEditorFocused(editorFocused: boolean): void; setLanguages(supportedLanguages: string[]): void; update(state: EditorState<any>, docView: NodeViewDesc, domEvent?: boolean): void; private triggerOnChange(); private triggerFocus(); private activeCodeBlockElement(docView); private nodeStartPos(); private activeCodeBlockNode(); } export declare const stateKey: PluginKey; export declare const plugin: Plugin; declare const plugins: (schema: Schema<any, any>) => Plugin[]; export default plugins;