UNPKG

@atlaskit/editor-plugin-block-controls

Version:

Block controls plugin for @atlaskit/editor-core

28 lines (27 loc) 652 B
import { selectionPreservationPluginKey } from './plugin-key'; /** * Start preserving the selection when a UI interaction requires it * * e.g., block menu open, drag-and-drop in progress */ export const startPreservingSelection = ({ tr }) => { const meta = { type: 'startPreserving' }; return tr.setMeta(selectionPreservationPluginKey, meta); }; /** * Stop preserving the selection when a UI interaction completes * * e.g., block menu closed, drag-and-drop ended */ export const stopPreservingSelection = ({ tr }) => { const meta = { type: 'stopPreserving' }; return tr.setMeta(selectionPreservationPluginKey, meta); };