UNPKG

@atlaskit/adf-schema

Version:

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

41 lines (39 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.status = void 0; var _uuid = require("../../utils/uuid"); var _nodeTypes = require("../../next-schema/generated/nodeTypes"); /** * @name status_node */ var status = exports.status = (0, _nodeTypes.status)({ parseDOM: [{ tag: 'span[data-node-type="status"]', getAttrs: function getAttrs(domNode) { var dom = domNode; return { text: dom.textContent.replace(/\n/, '').trim(), color: dom.getAttribute('data-color'), localId: _uuid.uuid.generate(), style: dom.getAttribute('data-style') }; } }], toDOM: function toDOM(node) { var _node$attrs = node.attrs, text = _node$attrs.text, color = _node$attrs.color, localId = _node$attrs.localId, style = _node$attrs.style; var attrs = { 'data-node-type': 'status', 'data-color': color, 'data-local-id': localId, 'data-style': style, contenteditable: 'false' }; return ['span', attrs, text]; } });