UNPKG

@atlaskit/adf-schema

Version:

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

31 lines 2.23 kB
import memoizeOne from 'memoize-one'; import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, listItemWithDecisionStage0 } from './nodes'; import { createSchema } from './create-schema'; const getDefaultSchemaConfig = () => { const defaultSchemaConfig = { nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'unsupportedBlock', 'unsupportedInline'], marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'backgroundColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'border', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery', // https://product-fabric.atlassian.net/browse/ED-10214, 'fragment'] }; return defaultSchemaConfig; }; export const defaultSchemaConfig = getDefaultSchemaConfig(); export const getSchemaBasedOnStage = memoizeOne((stage = 'final') => { const defaultSchemaConfig = getDefaultSchemaConfig(); if (stage === 'stage0') { defaultSchemaConfig.customNodeSpecs = { layoutSection: layoutSectionWithSingleColumn, multiBodiedExtension: multiBodiedExtension, extensionFrame: extensionFrame, expand: expandWithNestedExpand, listItem: listItemWithDecisionStage0, table: tableWithNestedTable, tableRow: tableRowWithNestedTable, tableCell: tableCellWithNestedTable, tableHeader: tableHeaderWithNestedTable }; } return createSchema(defaultSchemaConfig); }); export const defaultSchema = getSchemaBasedOnStage();