@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
36 lines (34 loc) • 1.02 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.taskItem = void 0;
var _uuid = require("../../utils/uuid");
var _nodeTypes = require("../../next-schema/generated/nodeTypes");
/**
* @name taskItem_node
*/
var taskItem = exports.taskItem = (0, _nodeTypes.taskItem)({
parseDOM: [{
tag: 'div[data-task-local-id]',
// Default priority is 50. We normally don't change this but since this node type is
// also used by list-item we need to make sure that we run this parser first.
priority: 100,
getAttrs: function getAttrs(dom) {
return {
localId: _uuid.uuid.generate(),
state: dom.getAttribute('data-task-state') || 'TODO'
};
}
}],
toDOM: function toDOM(node) {
var _node$attrs = node.attrs,
localId = _node$attrs.localId,
state = _node$attrs.state;
var attrs = {
'data-task-local-id': localId || 'local-task',
'data-task-state': state || 'TODO'
};
return ['div', attrs, 0];
}
});
;