@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
60 lines (58 loc) • 1.69 kB
JavaScript
import { uuid } from '../../utils';
import { listItem as listItemFactory, listItemWithNestedDecisionStage0 as listItemWithNestedDecisionStage0Factory } from '../../next-schema/generated/nodeTypes';
/**
* @name list_item
* @description this node allows task-list to be nested inside list-item
*/
export var listItem = listItemFactory({
parseDOM: [{
tag: 'li'
}],
toDOM: function toDOM() {
return ['li', 0];
}
});
export var listItemWithLocalId = listItemFactory({
parseDOM: [{
tag: 'li',
getAttrs: function getAttrs() {
return {
localId: uuid.generate()
};
}
}],
toDOM: function toDOM(node) {
var _node$attrs;
return ['li', {
'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
}, 0];
}
});
/**
* @name list_item_with_decision_stage0
* @description this node allows decisions to be nested inside list-item
*/
export var listItemWithDecisionStage0 = listItemWithNestedDecisionStage0Factory({
parseDOM: [{
tag: 'li'
}],
toDOM: function toDOM() {
return ['li', 0];
}
});
export var listItemWithNestedDecisionAndLocalIdStage0 = listItemWithNestedDecisionStage0Factory({
parseDOM: [{
tag: 'li',
getAttrs: function getAttrs() {
return {
localId: uuid.generate()
};
}
}],
toDOM: function toDOM(node) {
var _node$attrs2;
return ['li', {
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined
}, 0];
}
});