UNPKG

@atlaskit/adf-schema

Version:

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

56 lines (54 loc) 1.55 kB
import { uuid } from '../../utils'; import { listItem as listItemFactory, listItemWithNestedDecisionStage0 as listItemWithNestedDecisionStage0Factory } from '../../next-schema/generated/nodeTypes'; /** * @name list_item * @description this node allows task-list to be nested inside list-item */ export const listItem = listItemFactory({ parseDOM: [{ tag: 'li' }], toDOM() { return ['li', 0]; } }); export const listItemWithLocalId = listItemFactory({ parseDOM: [{ tag: 'li', getAttrs: () => ({ localId: uuid.generate() }) }], toDOM(node) { var _node$attrs; return ['li', { 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined }, 0]; } }); /** * @name list_item_with_decision_stage0 * @description this node allows decisions to be nested inside list-item */ export const listItemWithDecisionStage0 = listItemWithNestedDecisionStage0Factory({ parseDOM: [{ tag: 'li' }], toDOM() { return ['li', 0]; } }); export const listItemWithNestedDecisionAndLocalIdStage0 = listItemWithNestedDecisionStage0Factory({ parseDOM: [{ tag: 'li', getAttrs: () => ({ localId: uuid.generate() }) }], toDOM(node) { var _node$attrs2; return ['li', { 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined }, 0]; } });