UNPKG

@atlaskit/editor-plugin-status

Version:

Status plugin for @atlaskit/editor-core

12 lines 570 B
import { NodeSelection } from '@atlaskit/editor-prosemirror/state'; export const mayGetStatusAtSelection = selection => { if (selection && selection instanceof NodeSelection) { const nodeSelection = selection; if (nodeSelection.node.type.name === 'status') { return selection.node.attrs || null; } } return null; }; export const isEmptyStatus = node => node && (node.text && node.text.trim().length === 0 || node.text === ''); export const setNodeSelectionNearPos = (tr, pos) => tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(pos)));