UNPKG

@atlaskit/editor-plugin-tasks-and-decisions

Version:

Tasks and decisions plugin for @atlaskit/editor-core

33 lines (32 loc) 1.6 kB
import type { Command } from '@atlaskit/editor-common/types'; import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model'; export declare const liftSelection: Command; /** * Wraps the current selection in a task list, respecting a maximum indentation depth of 6 levels. * * - Normalizes the selection to ensure it covers complete task items. * - Determines the maximum depth of task list nesting within the selection. * - If the selection is already nested at or beyond the maximum depth, the command does nothing. * - Calculates the block range to wrap, handling both regular and block task items. * - Wraps the block in a task list to increase indentation or create a new task list if necessary. * * @param state - The current editor state. * @param dispatch - The dispatch function to apply the transaction. * @returns `true` if the command was handled (even if no changes were made), otherwise `false`. * @example * ```typescript * autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch); * ``` */ export declare const wrapSelectionInTaskList: Command; /** * Tries to move the paragraph content near the given position into the taskItem or decisionItem * before it. * * Looks backwards from the given position to find the "cut point" between the last taskItem and the * following paragraph. Then tries to move the content from that paragraph into the taskItem. * * @param $pos Position at the end of, or anywhere in paragraph following, the last taskItem * @see {joinToPreviousListItem} */ export declare const joinAtCut: ($pos: ResolvedPos) => Command;