UNPKG

@atlaskit/editor-plugin-code-block-advanced

Version:

CodeBlockAdvanced plugin for @atlaskit/editor-core

69 lines (68 loc) 2.79 kB
import type { Extension } from '@codemirror/state'; import type { ViewUpdate } from '@codemirror/view'; import type { IntlShape } from 'react-intl'; import type { getPosHandler, getPosHandlerNode, ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model'; import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view'; import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType'; export interface ConfigProps { allowCodeFolding: boolean; api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined; extensions: Extension[]; getIntl: () => IntlShape; } declare class CodeBlockAdvancedNodeView implements NodeView { dom: Node; private updating; private view; private lineWrappingCompartment; private lineNumbersCompartment; private languageCompartment; private readOnlyCompartment; private pmDecorationsCompartment; private themeCompartment; private node; private getPos; private cm; private contentMode; private selectionAPI; private maybeTryingToReachNodeSelection; private cleanupDisabledState; private languageLoader; private pmFacet; private ro?; private unsubscribeContentFormat; private invisibleAriaDescription?; private config; constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, innerDecorations: DecorationSource, config: ConfigProps); destroy(): void; forwardUpdate(update: ViewUpdate): void; setSelection(anchor: number, head: number): void; private updateReadonlyState; private updateLanguage; private updateAriaDescription; private updateLocalIdAttribute; private selectCodeBlockNode; private wordWrappingEnabled; private lineNumbersHidden; private selectCodeBlockNodeAndFocus; private getLineNumberExtensions; private getLineNumberVisibilityExtensions; private getLineNumbersEffects; private getWordWrapEffects; private restoreFoldState; private applyContentModeTheme; update(node: PMNode, _: readonly Decoration[], innerDecorations: DecorationSource): boolean; /** * Updates a facet which stores information on the prosemirror decorations * * This then gets translated to codemirror decorations in `prosemirrorDecorationPlugin` * @param decorationSource * @example */ private getProseMirrorDecorationEffects; private clearProseMirrorDecorations; stopEvent(e: Event): boolean; } export declare const getCodeBlockAdvancedNodeView: (props: ConfigProps) => (node: PMNode, view: EditorView, getPos: getPosHandler, innerDecorations: DecorationSource) => CodeBlockAdvancedNodeView; export {};