UNPKG

@atlaskit/adf-schema

Version:

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

32 lines (30 loc) 729 B
import { rule as ruleFactory } from '../../next-schema/generated/nodeTypes'; import { uuid } from '../../utils/uuid'; /** * @name rule_node */ var hrDOM = ['hr']; export var rule = ruleFactory({ parseDOM: [{ tag: 'hr' }], toDOM: function toDOM() { return hrDOM; } }); export var ruleWithLocalId = ruleFactory({ parseDOM: [{ tag: 'hr', getAttrs: function getAttrs() { return { localId: uuid.generate() }; } }], toDOM: function toDOM(node) { var _node$attrs; return ['hr', { '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 }]; } });