UNPKG

@atlaskit/adf-schema

Version:

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

133 lines (131 loc) 4.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = makeSchema; exports.isSchemaWithAdvancedTextFormattingMarks = isSchemaWithAdvancedTextFormattingMarks; exports.isSchemaWithBlockQuotes = isSchemaWithBlockQuotes; exports.isSchemaWithCodeBlock = isSchemaWithCodeBlock; exports.isSchemaWithEmojis = isSchemaWithEmojis; exports.isSchemaWithLinks = isSchemaWithLinks; exports.isSchemaWithLists = isSchemaWithLists; exports.isSchemaWithMedia = isSchemaWithMedia; exports.isSchemaWithMentions = isSchemaWithMentions; exports.isSchemaWithSubSupMark = isSchemaWithSubSupMark; exports.isSchemaWithTables = isSchemaWithTables; exports.isSchemaWithTextColor = isSchemaWithTextColor; var _createSchema = require("./create-schema"); /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function makeSchema(config) { var nodes = ['doc', 'paragraph', 'text', 'hardBreak', 'heading', 'rule']; var marks = ['strong', 'em', 'underline', 'typeAheadQuery', 'unsupportedMark', 'unsupportedNodeAttribute']; if (config.allowLinks) { marks.push('link'); } if (config.allowLists) { nodes.push('orderedList', 'bulletList', 'listItem'); } if (config.allowMentions) { nodes.push('mention'); marks.push('mentionQuery'); } if (config.allowEmojis) { nodes.push('emoji'); } if (config.allowAdvancedTextFormatting) { marks.push('strike', 'code'); } if (config.allowSubSup) { marks.push('subsup'); } if (config.allowCodeBlock) { nodes.push('codeBlock'); } if (config.allowBlockQuote) { nodes.push('blockquote'); } if (config.allowMedia) { nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline'); } if (config.allowTextColor) { marks.push('textColor'); } if (config.allowTables) { nodes.push('table', 'tableCell', 'tableHeader', 'tableRow'); } return (0, _createSchema.createSchema)({ nodes: nodes, marks: marks }); } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithLists(schema) { return !!schema.nodes.bulletList; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithMentions(schema) { return !!schema.nodes.mention; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithEmojis(schema) { return !!schema.nodes.emoji; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithLinks(schema) { return !!schema.marks.link; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithAdvancedTextFormattingMarks(schema) { return !!schema.marks.code && !!schema.marks.strike; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithSubSupMark(schema) { return !!schema.marks.subsup; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithCodeBlock(schema) { return !!schema.nodes.codeBlock; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithBlockQuotes(schema) { return !!schema.nodes.blockquote; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithMedia(schema) { return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithTextColor(schema) { return !!schema.marks.textColor; } /** * @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead. **/ function isSchemaWithTables(schema) { return !!schema.nodes.table && !!schema.nodes.tableCell && !!schema.nodes.tableHeader && !!schema.nodes.tableRow; }