@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
40 lines (38 loc) • 1.07 kB
JavaScript
import { uuid } from '../../utils/uuid';
/**
* @name taskList_node
*/
var name = 'actionList';
export var taskListSelector = "[data-node-type=\"".concat(name, "\"]");
export var taskList = {
group: 'block',
defining: true,
selectable: false,
content: '(taskItem|unsupportedBlock)+ (taskItem|taskList|unsupportedBlock)*',
marks: 'unsupportedMark unsupportedNodeAttribute',
attrs: {
localId: {
default: ''
}
},
parseDOM: [{
tag: "div".concat(taskListSelector),
// Default priority is 50. We normally don't change this but since this node type is
// also used by ordered-list we need to make sure that we run this parser first.
priority: 100,
getAttrs: function getAttrs() {
return {
localId: uuid.generate()
};
}
}],
toDOM: function toDOM(node) {
var localId = node.attrs.localId;
var attrs = {
'data-node-type': name,
'data-task-list-local-id': localId || 'local-task-list',
style: 'list-style: none; padding-left: 0'
};
return ['div', attrs, 0];
}
};