UNPKG

@atlaskit/adf-schema

Version:

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

36 lines (33 loc) 954 B
import { taskList as taskListFactory } from '../../next-schema/generated/nodeTypes'; import { uuid } from '../../utils/uuid'; /** * @name taskList_node */ const name = 'actionList'; export const taskListSelector = `[data-node-type="${name}"]`; const taskListParseDOMAndToDOM = { parseDOM: [{ tag: `div${taskListSelector}`, // Default priority is 50. We normally don't change this but since this node type is // also used by ordered-list we need to make sure that we run this parser first. priority: 100, getAttrs: () => ({ localId: uuid.generate() }) }], toDOM(node) { const { localId } = node.attrs; const attrs = { 'data-node-type': name, 'data-task-list-local-id': localId || 'local-task-list', style: 'list-style: none; padding-left: 0' }; return ['div', attrs, 0]; } }; /** * @name taskList */ export const taskList = taskListFactory(taskListParseDOMAndToDOM);