@atlaskit/editor-plugin-tasks-and-decisions
Version:
Tasks and decisions plugin for @atlaskit/editor-core
55 lines (54 loc) • 2.33 kB
TypeScript
import type { IntlShape } from 'react-intl';
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import type { NodeView } from '@atlaskit/editor-prosemirror/view';
/**
* NodeView for the DecisionItem node.
* It renders the decision item with its content and exposes the contentDOM to prosemirror.
*/
export declare class DecisionItemNodeView implements NodeView {
dom: Node;
contentDOM?: HTMLElement;
private icon;
private intl;
private hasChildren;
/**
* Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
* @param node - The ProseMirror node to check for children.
* @private
*/
private updateHasChildren;
private setIcon;
private setIconAriaLabel;
/**
* Creates a new DecisionItemNodeView.
* @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
* @import type {IntlShape} from 'react-intl';
* @param {PMNode} node - The ProseMirror node representing the decision item.
* @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
* @example
* const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
*/
constructor(node: PMNode, intl: IntlShape);
/**
* Updates the node view when the ProseMirror node changes.
* @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
* @param {PMNode} node - The ProseMirror node to update the view with.
* @example
* decisionItemNodeView.update(node);
* @returns {boolean} - Returns true if the view was updated successfully.
*/
update(node: PMNode): boolean;
/**
* Determines whether a mutation should be ignored by ProseMirror.
* This prevents unnecessary node view destruction during DOM changes that don't affect our content.
* @param mutation - The DOM mutation record or selection change
* @returns true if the mutation should be ignored, false if it should be processed
* @example
* // Mutation outside contentDOM will be ignored
* const shouldIgnore = decisionItemNodeView.ignoreMutation(mutationRecord);
*/
ignoreMutation(mutation: MutationRecord | {
target: Node;
type: 'selection';
}): boolean;
}