UNPKG

@atlaskit/adf-schema

Version:

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

32 lines 864 B
import { uuid } from '../../utils'; import { bulletList as bulletListFactory } from '../../next-schema/generated/nodeTypes'; export const bulletListSelector = '.ak-ul'; export const bulletList = bulletListFactory({ parseDOM: [{ tag: 'ul' }], toDOM() { const attrs = { class: bulletListSelector.substr(1) }; return ['ul', attrs, 0]; } }); export const bulletListWithLocalId = bulletListFactory({ parseDOM: [{ tag: 'ul', getAttrs: () => { return { localId: uuid.generate() }; } }], toDOM(node) { var _node$attrs; const attrs = { class: bulletListSelector.substr(1), '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 }; return ['ul', attrs, 0]; } });