@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
30 lines (28 loc) • 665 B
JavaScript
import { rule as ruleFactory } from '../../next-schema/generated/nodeTypes';
import { uuid } from '../../utils/uuid';
/**
* @name rule_node
*/
const hrDOM = ['hr'];
export const rule = ruleFactory({
parseDOM: [{
tag: 'hr'
}],
toDOM() {
return hrDOM;
}
});
export const ruleWithLocalId = ruleFactory({
parseDOM: [{
tag: 'hr',
getAttrs: () => ({
localId: uuid.generate()
})
}],
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
}];
}
});