@atlaskit/editor-plugin-block-controls
Version:
Block controls plugin for @atlaskit/editor-core
26 lines (25 loc) • 737 B
JavaScript
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 var startPreservingSelection = function startPreservingSelection(_ref) {
var tr = _ref.tr;
var 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 var stopPreservingSelection = function stopPreservingSelection(_ref2) {
var tr = _ref2.tr;
var meta = {
type: 'stopPreserving'
};
return tr.setMeta(selectionPreservationPluginKey, meta);
};