@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
40 lines • 1.22 kB
JavaScript
import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
import { inlineContentGroup } from '../groups/inlineContentGroup';
import { inlineGroup } from '../groups/inlineGroup';
import { alignment, indentation } from '../marks/alignmentAndIndentation';
import { unsupportedMark } from '../marks/unsupportedMark';
import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
export const heading = adfNode('heading').define({
defining: true,
selectable: false,
marks: [unsupportedMark, unsupportedNodeAttribute],
hasEmptyMarks: true,
attrs: {
level: {
type: 'number',
default: 1,
minimum: 1,
maximum: 6
},
localId: {
type: 'string',
optional: true,
default: null
}
},
content: [$zeroPlus($or(inlineGroup, inlineContentGroup))]
}).variant('with_alignment', {
marks: [alignment, unsupportedMark, unsupportedNodeAttribute],
content: [],
ignore: []
}).variant('with_indentation', {
marks: [indentation, unsupportedMark, unsupportedNodeAttribute],
content: [],
ignore: []
}).variant('with_no_marks', {
content: [],
marks: [],
noMarks: true,
ignore: []
});
export const headingWithMarks = heading;