@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
39 lines • 1.18 kB
JavaScript
import { $onePlus, $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
import { inlineContentGroup } from '../groups/inlineContentGroup';
import { inlineGroup } from '../groups/inlineGroup';
import { unsupportedMark } from '../marks/unsupportedMark';
import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
import { unsupportedBlock } from './unsupportedBlock';
export var taskItem = adfNode('taskItem');
export var taskList = adfNode('taskList');
taskItem.define({
defining: true,
selectable: false,
marks: [unsupportedMark, unsupportedNodeAttribute],
allowAnyChildMark: true,
attrs: {
localId: {
type: 'string',
default: ''
},
state: {
type: 'enum',
values: ['TODO', 'DONE'],
default: 'TODO'
}
},
content: [$zeroPlus($or(inlineGroup, inlineContentGroup))]
});
taskList.define({
defining: true,
selectable: false,
marks: [unsupportedMark, unsupportedNodeAttribute],
attrs: {
localId: {
type: 'string',
default: ''
}
},
contentMinItems: 1,
content: [$onePlus($or(taskItem, unsupportedBlock)), $zeroPlus($or(taskItem, taskList, unsupportedBlock))]
});