UNPKG

@atlaskit/editor-plugin-block-controls

Version:

Block controls plugin for @atlaskit/editor-core

65 lines (64 loc) 3.22 kB
import type { IntlShape } from 'react-intl'; import type { PortalProviderAPI } from '@atlaskit/editor-common/portal'; import { SafePlugin } from '@atlaskit/editor-common/safe-plugin'; import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state'; import { PluginKey } from '@atlaskit/editor-prosemirror/state'; import { DecorationSet } from '@atlaskit/editor-prosemirror/view'; import type { ActiveDropTargetNode, BlockControlsMeta, BlockControlsPlugin, MultiSelectDnD, NodeDecorationFactory, PluginState } from '../blockControlsPluginType'; import { AnchorRectCache } from './utils/anchor-utils'; export declare const key: PluginKey<PluginState>; export interface FlagType { isMultiSelectEnabled: boolean; toolbarFlagsEnabled: boolean; } export declare const getDecorations: (state: EditorState) => DecorationSet | undefined; export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | { activeDropTargetNode: ActiveDropTargetNode | undefined; activeNode: any; blockMenuOptions: { canMoveDown: any; canMoveUp: any; openedViaKeyboard: any; } | undefined; decorations: DecorationSet; editorHeight: any; editorWidthLeft: any; editorWidthRight: any; isDocSizeLimitEnabled: boolean | null; isDragging: any; isMenuOpen: boolean | undefined; isPMDragging: any; isResizerResizing: boolean; isSelectedViaDragHandle: any; isShiftDown: any; lastDragCancelled: any; menuTriggerBy: any; menuTriggerByNode: any; multiSelectDnD: MultiSelectDnD | undefined; }; export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState | { activeDropTargetNode: ActiveDropTargetNode | undefined; activeNode: any; blockMenuOptions: { canMoveDown: any; canMoveUp: any; openedViaKeyboard: any; } | undefined; decorations: DecorationSet; editorHeight: any; editorWidthLeft: any; editorWidthRight: any; isDocSizeLimitEnabled: boolean | null; isDragging: any; isMenuOpen: boolean | undefined; isPMDragging: any; isResizerResizing: boolean; isSelectedViaDragHandle: any; isShiftDown: any; lastDragCancelled: any; menuTriggerBy: any; menuTriggerByNode: any; multiSelectDnD: MultiSelectDnD | undefined; }>; export declare const getBlockControlsMeta: (tr: Transaction | ReadonlyTransaction) => BlockControlsMeta | undefined;