UNPKG

@atlaskit/adf-schema

Version:

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

57 lines (54 loc) 1.65 kB
import { listItem as listItemFactory, listItemWithFlexibleFirstChildStage0 as listItemWithFlexibleFirstChildStage0Factory } from '../../next-schema/generated/nodeTypes'; import { uuid } from '../../utils'; /** * @name list_item * @description this node allows task-list to be nested inside list-item */ export var listItem = listItemFactory({ parseDOM: [{ tag: 'li' }], toDOM: function toDOM() { return ['li', 0]; } }); /** * @name list_item_with_local_id * @description this node allows list items to have a localId attribute */ export var listItemWithLocalId = listItemFactory({ parseDOM: [{ tag: 'li', getAttrs: function getAttrs() { return { localId: uuid.generate() }; } }], toDOM: function 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_flexible_first_child_stage0 * @description stage0 listItem with flexible first child (see EDITOR-5417) */ export var listItemWithFlexibleFirstChildStage0 = listItemWithFlexibleFirstChildStage0Factory({ parseDOM: [{ tag: 'li', getAttrs: function getAttrs() { return { localId: uuid.generate() }; } }], toDOM: function 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]; } });