UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

40 lines (38 loc) 861 B
import { uuid } from '../../utils/uuid'; /** * @name decisionItem_node */ export const decisionItem = { content: 'inline*', defining: true, marks: '_', attrs: { localId: { default: '' }, state: { default: 'DECIDED' } }, parseDOM: [{ tag: 'li[data-decision-local-id]', // Default priority is 50. We normally don't change this but since this node type is // also used by list-item we need to make sure that we run this parser first. priority: 100, getAttrs: dom => ({ localId: uuid.generate(), state: dom.getAttribute('data-decision-state') }) }], toDOM(node) { const { localId, state } = node.attrs; const attrs = { 'data-decision-local-id': localId || 'local-decision', 'data-decision-state': state }; return ['li', attrs, 0]; } };