UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

38 lines 1.44 kB
import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator'; import { blockContentGroup } from '../groups/blockContentGroup'; import { blockGroup } from '../groups/blockGroup'; import { unsupportedMark } from '../marks/unsupportedMark'; import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute'; import { unsupportedBlock } from '../nodes/unsupportedBlock'; import { panel } from './panel'; var layoutColumnAttributes = { width: { type: 'number', minimum: 0, maximum: 100, default: undefined }, localId: { type: 'string', default: null, optional: true }, valign: { type: 'enum', values: ['top', 'middle', 'bottom'], default: null, optional: true } }; export var layoutColumn = adfNode('layoutColumn').define({ isolating: true, selectable: false, marks: [unsupportedMark, unsupportedNodeAttribute], attrs: layoutColumnAttributes, // panel_c1 (table-in-panel) is also valid inside a layout column. It must come before // `blockContentGroup`, which contributes the bare `panel` name: the validator's repairing loop // takes the first valid candidate, and base `panel` "succeeds" by wrapping a nested table as // `unsupportedBlock`. Kept after `blockGroup` so `block` stays the leading PM alternative. // See the same note in full-schema.adf.ts. content: [$onePlus($or(blockGroup, panel.use('c1'), blockContentGroup, unsupportedBlock))] });