UNPKG

@atlaskit/editor-plugin-expand

Version:

Expand plugin for @atlaskit/editor-core

32 lines (31 loc) 1.99 kB
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics'; import type { Command, EditorCommand } from '@atlaskit/editor-common/types'; import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model'; import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state'; import { Selection } from '@atlaskit/editor-prosemirror/state'; import type { ExpandPlugin, InsertMethod } from '../types'; export declare const createExpandNode: (state: EditorState, setExpandedState?: boolean, addLocalId?: boolean) => PMNode | null; /** * When cleaning up platform_editor_adf_with_localid we can reuse this function * in insertExpandWithInputMethod. */ export declare const wrapSelectionAndSetExpandedState: (state: EditorState, node: PMNode) => Transaction; export declare const insertExpandWithInputMethod: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => (inputMethod: InsertMethod) => Command; export declare const insertExpand: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => Command; export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command; export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command; export declare const setSelectionInsideExpand: (expandPos: number) => Command; export declare const toggleExpandExpanded: ({ editorAnalyticsAPI, pos, node, }: { editorAnalyticsAPI: EditorAnalyticsAPI | undefined; node: PMNode; pos: number; }) => Command; export declare const updateExpandTitle: ({ title, nodeType, pos }: { nodeType: NodeType; pos: number; title: string; }) => Command; export declare const focusTitle: (pos: number) => Command; export declare const focusIcon: (expand: Node) => Command; export declare const toggleExpandWithMatch: (selection: Selection) => EditorCommand;