@atlaskit/adf-schema 19.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1524 -0
- package/LICENSE +13 -0
- package/build/tsconfig.json +17 -0
- package/dist/cjs/index.js +1089 -0
- package/dist/cjs/schema/bitbucket-schema.js +14 -0
- package/dist/cjs/schema/confluence-schema.js +21 -0
- package/dist/cjs/schema/create-schema.js +354 -0
- package/dist/cjs/schema/default-schema.js +52 -0
- package/dist/cjs/schema/groups.js +35 -0
- package/dist/cjs/schema/index.js +755 -0
- package/dist/cjs/schema/inline-nodes.js +20 -0
- package/dist/cjs/schema/jira-schema.js +118 -0
- package/dist/cjs/schema/marks/alignment.js +39 -0
- package/dist/cjs/schema/marks/annotation.js +96 -0
- package/dist/cjs/schema/marks/breakout.js +32 -0
- package/dist/cjs/schema/marks/code.js +46 -0
- package/dist/cjs/schema/marks/confluence-inline-comment.js +30 -0
- package/dist/cjs/schema/marks/data-consumer.js +71 -0
- package/dist/cjs/schema/marks/em.js +25 -0
- package/dist/cjs/schema/marks/indentation.js +32 -0
- package/dist/cjs/schema/marks/index.js +189 -0
- package/dist/cjs/schema/marks/link.js +128 -0
- package/dist/cjs/schema/marks/strike.js +29 -0
- package/dist/cjs/schema/marks/strong.js +37 -0
- package/dist/cjs/schema/marks/subsup.js +61 -0
- package/dist/cjs/schema/marks/text-color.js +93 -0
- package/dist/cjs/schema/marks/type-ahead-query.js +31 -0
- package/dist/cjs/schema/marks/underline.js +25 -0
- package/dist/cjs/schema/marks/unsupported-mark.js +15 -0
- package/dist/cjs/schema/marks/unsupported-node-attributes.js +16 -0
- package/dist/cjs/schema/nodes/block-card.js +56 -0
- package/dist/cjs/schema/nodes/blockquote.js +23 -0
- package/dist/cjs/schema/nodes/bodied-extension.js +66 -0
- package/dist/cjs/schema/nodes/bullet-list.js +29 -0
- package/dist/cjs/schema/nodes/caption.js +27 -0
- package/dist/cjs/schema/nodes/code-block.js +160 -0
- package/dist/cjs/schema/nodes/confluence-jira-issue.js +54 -0
- package/dist/cjs/schema/nodes/confluence-unsupported-block.js +33 -0
- package/dist/cjs/schema/nodes/confluence-unsupported-inline.js +34 -0
- package/dist/cjs/schema/nodes/date.js +36 -0
- package/dist/cjs/schema/nodes/decision-item.js +45 -0
- package/dist/cjs/schema/nodes/decision-list.js +45 -0
- package/dist/cjs/schema/nodes/doc.js +15 -0
- package/dist/cjs/schema/nodes/embed-card.js +62 -0
- package/dist/cjs/schema/nodes/emoji.js +73 -0
- package/dist/cjs/schema/nodes/expand.js +86 -0
- package/dist/cjs/schema/nodes/extension.js +59 -0
- package/dist/cjs/schema/nodes/hard-break.js +22 -0
- package/dist/cjs/schema/nodes/heading.js +69 -0
- package/dist/cjs/schema/nodes/image.js +40 -0
- package/dist/cjs/schema/nodes/index.js +539 -0
- package/dist/cjs/schema/nodes/inline-card.js +64 -0
- package/dist/cjs/schema/nodes/inline-extension.js +54 -0
- package/dist/cjs/schema/nodes/layout-column.js +53 -0
- package/dist/cjs/schema/nodes/layout-section.js +61 -0
- package/dist/cjs/schema/nodes/list-item.js +25 -0
- package/dist/cjs/schema/nodes/media-group.js +29 -0
- package/dist/cjs/schema/nodes/media-inline.js +11 -0
- package/dist/cjs/schema/nodes/media-single.js +101 -0
- package/dist/cjs/schema/nodes/media.js +196 -0
- package/dist/cjs/schema/nodes/mention.js +90 -0
- package/dist/cjs/schema/nodes/nested-expand.js +64 -0
- package/dist/cjs/schema/nodes/ordered-list.js +29 -0
- package/dist/cjs/schema/nodes/panel.js +85 -0
- package/dist/cjs/schema/nodes/paragraph.js +45 -0
- package/dist/cjs/schema/nodes/placeholder.js +39 -0
- package/dist/cjs/schema/nodes/rule.js +21 -0
- package/dist/cjs/schema/nodes/status.js +56 -0
- package/dist/cjs/schema/nodes/tableNodes.js +276 -0
- package/dist/cjs/schema/nodes/task-item.js +46 -0
- package/dist/cjs/schema/nodes/task-list.js +45 -0
- package/dist/cjs/schema/nodes/text.js +17 -0
- package/dist/cjs/schema/nodes/types/block-content.js +5 -0
- package/dist/cjs/schema/nodes/types/extensions.js +5 -0
- package/dist/cjs/schema/nodes/types/inline-content.js +5 -0
- package/dist/cjs/schema/nodes/types/mark.js +5 -0
- package/dist/cjs/schema/nodes/types/non-nestable-block-content.js +5 -0
- package/dist/cjs/schema/nodes/types/rich-media-common.js +5 -0
- package/dist/cjs/schema/nodes/unknown-block.js +21 -0
- package/dist/cjs/schema/nodes/unsupported-block.js +33 -0
- package/dist/cjs/schema/nodes/unsupported-inline.js +32 -0
- package/dist/cjs/schema/unsupported.js +8 -0
- package/dist/cjs/steps/analytics.js +183 -0
- package/dist/cjs/steps/set-attrs.js +106 -0
- package/dist/cjs/steps/table/add-column.js +453 -0
- package/dist/cjs/steps/table/constants.js +13 -0
- package/dist/cjs/steps/table/sort-column.js +87 -0
- package/dist/cjs/steps/table/types.js +5 -0
- package/dist/cjs/steps/table/utils/cell-step.js +233 -0
- package/dist/cjs/steps/table/utils/cells-at-column.js +94 -0
- package/dist/cjs/steps/table/utils/find-column.js +94 -0
- package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +38 -0
- package/dist/cjs/steps/table/utils/side-effects/rows.js +370 -0
- package/dist/cjs/steps/table/utils/side-effects/side-effects.js +106 -0
- package/dist/cjs/steps/table/utils/side-effects/table.js +126 -0
- package/dist/cjs/steps/table/utils/side-effects/types.js +5 -0
- package/dist/cjs/steps/table/utils/table-map.js +36 -0
- package/dist/cjs/steps/type-ahead.js +134 -0
- package/dist/cjs/steps.js +59 -0
- package/dist/cjs/utils/colors.js +234 -0
- package/dist/cjs/utils/confluence/emoji.js +97 -0
- package/dist/cjs/utils/extensions.js +39 -0
- package/dist/cjs/utils/index.js +373 -0
- package/dist/cjs/utils/parseDOM.js +12 -0
- package/dist/cjs/utils/url.js +38 -0
- package/dist/cjs/utils/uuid.js +28 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +2 -0
- package/dist/es2019/schema/bitbucket-schema.js +5 -0
- package/dist/es2019/schema/confluence-schema.js +11 -0
- package/dist/es2019/schema/create-schema.js +325 -0
- package/dist/es2019/schema/default-schema.js +35 -0
- package/dist/es2019/schema/groups.js +23 -0
- package/dist/es2019/schema/index.js +9 -0
- package/dist/es2019/schema/inline-nodes.js +3 -0
- package/dist/es2019/schema/jira-schema.js +88 -0
- package/dist/es2019/schema/marks/alignment.js +32 -0
- package/dist/es2019/schema/marks/annotation.js +80 -0
- package/dist/es2019/schema/marks/breakout.js +29 -0
- package/dist/es2019/schema/marks/code.js +43 -0
- package/dist/es2019/schema/marks/confluence-inline-comment.js +24 -0
- package/dist/es2019/schema/marks/data-consumer.js +61 -0
- package/dist/es2019/schema/marks/em.js +22 -0
- package/dist/es2019/schema/marks/indentation.js +27 -0
- package/dist/es2019/schema/marks/index.js +17 -0
- package/dist/es2019/schema/marks/link.js +105 -0
- package/dist/es2019/schema/marks/strike.js +24 -0
- package/dist/es2019/schema/marks/strong.js +40 -0
- package/dist/es2019/schema/marks/subsup.js +51 -0
- package/dist/es2019/schema/marks/text-color.js +67 -0
- package/dist/es2019/schema/marks/type-ahead-query.js +23 -0
- package/dist/es2019/schema/marks/underline.js +20 -0
- package/dist/es2019/schema/marks/unsupported-mark.js +9 -0
- package/dist/es2019/schema/marks/unsupported-node-attributes.js +10 -0
- package/dist/es2019/schema/nodes/block-card.js +50 -0
- package/dist/es2019/schema/nodes/blockquote.js +17 -0
- package/dist/es2019/schema/nodes/bodied-extension.js +58 -0
- package/dist/es2019/schema/nodes/bullet-list.js +23 -0
- package/dist/es2019/schema/nodes/caption.js +21 -0
- package/dist/es2019/schema/nodes/code-block.js +143 -0
- package/dist/es2019/schema/nodes/confluence-jira-issue.js +49 -0
- package/dist/es2019/schema/nodes/confluence-unsupported-block.js +30 -0
- package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +31 -0
- package/dist/es2019/schema/nodes/date.js +28 -0
- package/dist/es2019/schema/nodes/decision-item.js +37 -0
- package/dist/es2019/schema/nodes/decision-list.js +41 -0
- package/dist/es2019/schema/nodes/doc.js +7 -0
- package/dist/es2019/schema/nodes/embed-card.js +55 -0
- package/dist/es2019/schema/nodes/emoji.js +67 -0
- package/dist/es2019/schema/nodes/expand.js +73 -0
- package/dist/es2019/schema/nodes/extension.js +51 -0
- package/dist/es2019/schema/nodes/hard-break.js +16 -0
- package/dist/es2019/schema/nodes/heading.js +63 -0
- package/dist/es2019/schema/nodes/image.js +37 -0
- package/dist/es2019/schema/nodes/index.js +44 -0
- package/dist/es2019/schema/nodes/inline-card.js +58 -0
- package/dist/es2019/schema/nodes/inline-extension.js +46 -0
- package/dist/es2019/schema/nodes/layout-column.js +49 -0
- package/dist/es2019/schema/nodes/layout-section.js +56 -0
- package/dist/es2019/schema/nodes/list-item.js +20 -0
- package/dist/es2019/schema/nodes/media-group.js +23 -0
- package/dist/es2019/schema/nodes/media-inline.js +2 -0
- package/dist/es2019/schema/nodes/media-single.js +77 -0
- package/dist/es2019/schema/nodes/media.js +165 -0
- package/dist/es2019/schema/nodes/mention.js +81 -0
- package/dist/es2019/schema/nodes/nested-expand.js +58 -0
- package/dist/es2019/schema/nodes/ordered-list.js +23 -0
- package/dist/es2019/schema/nodes/panel.js +79 -0
- package/dist/es2019/schema/nodes/paragraph.js +39 -0
- package/dist/es2019/schema/nodes/placeholder.js +33 -0
- package/dist/es2019/schema/nodes/rule.js +15 -0
- package/dist/es2019/schema/nodes/status.js +54 -0
- package/dist/es2019/schema/nodes/tableNodes.js +222 -0
- package/dist/es2019/schema/nodes/task-item.js +38 -0
- package/dist/es2019/schema/nodes/task-list.js +37 -0
- package/dist/es2019/schema/nodes/text.js +7 -0
- package/dist/es2019/schema/nodes/types/block-content.js +1 -0
- package/dist/es2019/schema/nodes/types/extensions.js +1 -0
- package/dist/es2019/schema/nodes/types/inline-content.js +1 -0
- package/dist/es2019/schema/nodes/types/mark.js +1 -0
- package/dist/es2019/schema/nodes/types/non-nestable-block-content.js +1 -0
- package/dist/es2019/schema/nodes/types/rich-media-common.js +1 -0
- package/dist/es2019/schema/nodes/unknown-block.js +16 -0
- package/dist/es2019/schema/nodes/unsupported-block.js +26 -0
- package/dist/es2019/schema/nodes/unsupported-inline.js +25 -0
- package/dist/es2019/schema/unsupported.js +1 -0
- package/dist/es2019/steps/analytics.js +122 -0
- package/dist/es2019/steps/set-attrs.js +57 -0
- package/dist/es2019/steps/table/add-column.js +349 -0
- package/dist/es2019/steps/table/constants.js +6 -0
- package/dist/es2019/steps/table/sort-column.js +41 -0
- package/dist/es2019/steps/table/types.js +1 -0
- package/dist/es2019/steps/table/utils/cell-step.js +204 -0
- package/dist/es2019/steps/table/utils/cells-at-column.js +57 -0
- package/dist/es2019/steps/table/utils/find-column.js +86 -0
- package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +30 -0
- package/dist/es2019/steps/table/utils/side-effects/rows.js +297 -0
- package/dist/es2019/steps/table/utils/side-effects/side-effects.js +81 -0
- package/dist/es2019/steps/table/utils/side-effects/table.js +99 -0
- package/dist/es2019/steps/table/utils/side-effects/types.js +1 -0
- package/dist/es2019/steps/table/utils/table-map.js +19 -0
- package/dist/es2019/steps/type-ahead.js +85 -0
- package/dist/es2019/steps.js +6 -0
- package/dist/es2019/utils/colors.js +148 -0
- package/dist/es2019/utils/confluence/emoji.js +83 -0
- package/dist/es2019/utils/extensions.js +26 -0
- package/dist/es2019/utils/index.js +4 -0
- package/dist/es2019/utils/parseDOM.js +1 -0
- package/dist/es2019/utils/url.js +19 -0
- package/dist/es2019/utils/uuid.js +18 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/schema/bitbucket-schema.js +5 -0
- package/dist/esm/schema/confluence-schema.js +11 -0
- package/dist/esm/schema/create-schema.js +338 -0
- package/dist/esm/schema/default-schema.js +36 -0
- package/dist/esm/schema/groups.js +23 -0
- package/dist/esm/schema/index.js +9 -0
- package/dist/esm/schema/inline-nodes.js +5 -0
- package/dist/esm/schema/jira-schema.js +88 -0
- package/dist/esm/schema/marks/alignment.js +30 -0
- package/dist/esm/schema/marks/annotation.js +82 -0
- package/dist/esm/schema/marks/breakout.js +25 -0
- package/dist/esm/schema/marks/code.js +41 -0
- package/dist/esm/schema/marks/confluence-inline-comment.js +22 -0
- package/dist/esm/schema/marks/data-consumer.js +63 -0
- package/dist/esm/schema/marks/em.js +20 -0
- package/dist/esm/schema/marks/indentation.js +23 -0
- package/dist/esm/schema/marks/index.js +17 -0
- package/dist/esm/schema/marks/link.js +113 -0
- package/dist/esm/schema/marks/strike.js +24 -0
- package/dist/esm/schema/marks/strong.js +32 -0
- package/dist/esm/schema/marks/subsup.js +53 -0
- package/dist/esm/schema/marks/text-color.js +78 -0
- package/dist/esm/schema/marks/type-ahead-query.js +21 -0
- package/dist/esm/schema/marks/underline.js +20 -0
- package/dist/esm/schema/marks/unsupported-mark.js +8 -0
- package/dist/esm/schema/marks/unsupported-node-attributes.js +9 -0
- package/dist/esm/schema/nodes/block-card.js +48 -0
- package/dist/esm/schema/nodes/blockquote.js +15 -0
- package/dist/esm/schema/nodes/bodied-extension.js +58 -0
- package/dist/esm/schema/nodes/bullet-list.js +21 -0
- package/dist/esm/schema/nodes/caption.js +19 -0
- package/dist/esm/schema/nodes/code-block.js +149 -0
- package/dist/esm/schema/nodes/confluence-jira-issue.js +47 -0
- package/dist/esm/schema/nodes/confluence-unsupported-block.js +26 -0
- package/dist/esm/schema/nodes/confluence-unsupported-inline.js +27 -0
- package/dist/esm/schema/nodes/date.js +28 -0
- package/dist/esm/schema/nodes/decision-item.js +36 -0
- package/dist/esm/schema/nodes/decision-list.js +39 -0
- package/dist/esm/schema/nodes/doc.js +7 -0
- package/dist/esm/schema/nodes/embed-card.js +54 -0
- package/dist/esm/schema/nodes/emoji.js +68 -0
- package/dist/esm/schema/nodes/expand.js +75 -0
- package/dist/esm/schema/nodes/extension.js +51 -0
- package/dist/esm/schema/nodes/hard-break.js +14 -0
- package/dist/esm/schema/nodes/heading.js +61 -0
- package/dist/esm/schema/nodes/image.js +33 -0
- package/dist/esm/schema/nodes/index.js +44 -0
- package/dist/esm/schema/nodes/inline-card.js +56 -0
- package/dist/esm/schema/nodes/inline-extension.js +46 -0
- package/dist/esm/schema/nodes/layout-column.js +45 -0
- package/dist/esm/schema/nodes/layout-section.js +52 -0
- package/dist/esm/schema/nodes/list-item.js +18 -0
- package/dist/esm/schema/nodes/media-group.js +21 -0
- package/dist/esm/schema/nodes/media-inline.js +2 -0
- package/dist/esm/schema/nodes/media-single.js +84 -0
- package/dist/esm/schema/nodes/media.js +174 -0
- package/dist/esm/schema/nodes/mention.js +80 -0
- package/dist/esm/schema/nodes/nested-expand.js +56 -0
- package/dist/esm/schema/nodes/ordered-list.js +21 -0
- package/dist/esm/schema/nodes/panel.js +76 -0
- package/dist/esm/schema/nodes/paragraph.js +37 -0
- package/dist/esm/schema/nodes/placeholder.js +31 -0
- package/dist/esm/schema/nodes/rule.js +13 -0
- package/dist/esm/schema/nodes/status.js +51 -0
- package/dist/esm/schema/nodes/tableNodes.js +238 -0
- package/dist/esm/schema/nodes/task-item.js +37 -0
- package/dist/esm/schema/nodes/task-list.js +35 -0
- package/dist/esm/schema/nodes/text.js +9 -0
- package/dist/esm/schema/nodes/types/block-content.js +1 -0
- package/dist/esm/schema/nodes/types/extensions.js +1 -0
- package/dist/esm/schema/nodes/types/inline-content.js +1 -0
- package/dist/esm/schema/nodes/types/mark.js +1 -0
- package/dist/esm/schema/nodes/types/non-nestable-block-content.js +1 -0
- package/dist/esm/schema/nodes/types/rich-media-common.js +1 -0
- package/dist/esm/schema/nodes/unknown-block.js +14 -0
- package/dist/esm/schema/nodes/unsupported-block.js +26 -0
- package/dist/esm/schema/nodes/unsupported-inline.js +25 -0
- package/dist/esm/schema/unsupported.js +1 -0
- package/dist/esm/steps/analytics.js +166 -0
- package/dist/esm/steps/set-attrs.js +89 -0
- package/dist/esm/steps/table/add-column.js +431 -0
- package/dist/esm/steps/table/constants.js +6 -0
- package/dist/esm/steps/table/sort-column.js +69 -0
- package/dist/esm/steps/table/types.js +1 -0
- package/dist/esm/steps/table/utils/cell-step.js +216 -0
- package/dist/esm/steps/table/utils/cells-at-column.js +84 -0
- package/dist/esm/steps/table/utils/find-column.js +87 -0
- package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +30 -0
- package/dist/esm/steps/table/utils/side-effects/rows.js +360 -0
- package/dist/esm/steps/table/utils/side-effects/side-effects.js +93 -0
- package/dist/esm/steps/table/utils/side-effects/table.js +113 -0
- package/dist/esm/steps/table/utils/side-effects/types.js +1 -0
- package/dist/esm/steps/table/utils/table-map.js +19 -0
- package/dist/esm/steps/type-ahead.js +117 -0
- package/dist/esm/steps.js +6 -0
- package/dist/esm/utils/colors.js +160 -0
- package/dist/esm/utils/confluence/emoji.js +85 -0
- package/dist/esm/utils/extensions.js +27 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/parseDOM.js +3 -0
- package/dist/esm/utils/url.js +21 -0
- package/dist/esm/utils/uuid.js +18 -0
- package/dist/esm/version.json +5 -0
- package/dist/json-schema/v1/full.json +2536 -0
- package/dist/json-schema/v1/stage-0.json +2737 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/schema/bitbucket-schema.d.ts +2 -0
- package/dist/types/schema/confluence-schema.d.ts +3 -0
- package/dist/types/schema/create-schema.d.ts +31 -0
- package/dist/types/schema/default-schema.d.ts +7 -0
- package/dist/types/schema/groups.d.ts +6 -0
- package/dist/types/schema/index.d.ts +11 -0
- package/dist/types/schema/inline-nodes.d.ts +1 -0
- package/dist/types/schema/jira-schema.d.ts +26 -0
- package/dist/types/schema/marks/alignment.d.ts +16 -0
- package/dist/types/schema/marks/annotation.d.ts +32 -0
- package/dist/types/schema/marks/breakout.d.ts +12 -0
- package/dist/types/schema/marks/code.d.ts +8 -0
- package/dist/types/schema/marks/confluence-inline-comment.d.ts +12 -0
- package/dist/types/schema/marks/data-consumer.d.ts +41 -0
- package/dist/types/schema/marks/em.d.ts +8 -0
- package/dist/types/schema/marks/indentation.d.ts +16 -0
- package/dist/types/schema/marks/index.d.ts +30 -0
- package/dist/types/schema/marks/link.d.ts +32 -0
- package/dist/types/schema/marks/strike.d.ts +8 -0
- package/dist/types/schema/marks/strong.d.ts +8 -0
- package/dist/types/schema/marks/subsup.d.ts +15 -0
- package/dist/types/schema/marks/text-color.d.ts +21 -0
- package/dist/types/schema/marks/type-ahead-query.d.ts +2 -0
- package/dist/types/schema/marks/underline.d.ts +8 -0
- package/dist/types/schema/marks/unsupported-mark.d.ts +2 -0
- package/dist/types/schema/marks/unsupported-node-attributes.d.ts +2 -0
- package/dist/types/schema/nodes/block-card.d.ts +19 -0
- package/dist/types/schema/nodes/blockquote.d.ts +14 -0
- package/dist/types/schema/nodes/bodied-extension.d.ts +27 -0
- package/dist/types/schema/nodes/bullet-list.d.ts +14 -0
- package/dist/types/schema/nodes/caption.d.ts +21 -0
- package/dist/types/schema/nodes/code-block.d.ts +31 -0
- package/dist/types/schema/nodes/confluence-jira-issue.d.ts +2 -0
- package/dist/types/schema/nodes/confluence-unsupported-block.d.ts +2 -0
- package/dist/types/schema/nodes/confluence-unsupported-inline.d.ts +2 -0
- package/dist/types/schema/nodes/date.d.ts +14 -0
- package/dist/types/schema/nodes/decision-item.d.ts +17 -0
- package/dist/types/schema/nodes/decision-list.d.ts +18 -0
- package/dist/types/schema/nodes/doc.d.ts +18 -0
- package/dist/types/schema/nodes/embed-card.d.ts +15 -0
- package/dist/types/schema/nodes/emoji.d.ts +14 -0
- package/dist/types/schema/nodes/expand.d.ts +33 -0
- package/dist/types/schema/nodes/extension.d.ts +21 -0
- package/dist/types/schema/nodes/hard-break.d.ts +11 -0
- package/dist/types/schema/nodes/heading.d.ts +36 -0
- package/dist/types/schema/nodes/image.d.ts +2 -0
- package/dist/types/schema/nodes/index.d.ts +93 -0
- package/dist/types/schema/nodes/inline-card.d.ts +19 -0
- package/dist/types/schema/nodes/inline-extension.d.ts +21 -0
- package/dist/types/schema/nodes/layout-column.d.ts +21 -0
- package/dist/types/schema/nodes/layout-section.d.ts +44 -0
- package/dist/types/schema/nodes/list-item.d.ts +20 -0
- package/dist/types/schema/nodes/media-group.d.ts +14 -0
- package/dist/types/schema/nodes/media-inline.d.ts +16 -0
- package/dist/types/schema/nodes/media-single.d.ts +59 -0
- package/dist/types/schema/nodes/media.d.ts +60 -0
- package/dist/types/schema/nodes/mention.d.ts +26 -0
- package/dist/types/schema/nodes/nested-expand.d.ts +27 -0
- package/dist/types/schema/nodes/ordered-list.d.ts +20 -0
- package/dist/types/schema/nodes/panel.d.ts +46 -0
- package/dist/types/schema/nodes/paragraph.d.ts +37 -0
- package/dist/types/schema/nodes/placeholder.d.ts +11 -0
- package/dist/types/schema/nodes/rule.d.ts +8 -0
- package/dist/types/schema/nodes/status.d.ts +20 -0
- package/dist/types/schema/nodes/tableNodes.d.ts +111 -0
- package/dist/types/schema/nodes/task-item.d.ts +17 -0
- package/dist/types/schema/nodes/task-list.d.ts +21 -0
- package/dist/types/schema/nodes/text.d.ts +15 -0
- package/dist/types/schema/nodes/types/block-content.d.ts +22 -0
- package/dist/types/schema/nodes/types/extensions.d.ts +34 -0
- package/dist/types/schema/nodes/types/inline-content.d.ts +32 -0
- package/dist/types/schema/nodes/types/mark.d.ts +15 -0
- package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +20 -0
- package/dist/types/schema/nodes/types/rich-media-common.d.ts +9 -0
- package/dist/types/schema/nodes/unknown-block.d.ts +3 -0
- package/dist/types/schema/nodes/unsupported-block.d.ts +2 -0
- package/dist/types/schema/nodes/unsupported-inline.d.ts +2 -0
- package/dist/types/schema/unsupported.d.ts +1 -0
- package/dist/types/steps/analytics.d.ts +59 -0
- package/dist/types/steps/set-attrs.d.ts +23 -0
- package/dist/types/steps/table/add-column.d.ts +88 -0
- package/dist/types/steps/table/constants.d.ts +4 -0
- package/dist/types/steps/table/sort-column.d.ts +18 -0
- package/dist/types/steps/table/types.d.ts +39 -0
- package/dist/types/steps/table/utils/cell-step.d.ts +47 -0
- package/dist/types/steps/table/utils/cells-at-column.d.ts +20 -0
- package/dist/types/steps/table/utils/find-column.d.ts +8 -0
- package/dist/types/steps/table/utils/get-table-rect-from-doc.d.ts +8 -0
- package/dist/types/steps/table/utils/side-effects/rows.d.ts +25 -0
- package/dist/types/steps/table/utils/side-effects/side-effects.d.ts +15 -0
- package/dist/types/steps/table/utils/side-effects/table.d.ts +16 -0
- package/dist/types/steps/table/utils/side-effects/types.d.ts +33 -0
- package/dist/types/steps/table/utils/table-map.d.ts +6 -0
- package/dist/types/steps/type-ahead.d.ts +35 -0
- package/dist/types/steps.d.ts +8 -0
- package/dist/types/utils/colors.d.ts +71 -0
- package/dist/types/utils/confluence/emoji.d.ts +50 -0
- package/dist/types/utils/extensions.d.ts +3 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/parseDOM.d.ts +1 -0
- package/dist/types/utils/url.d.ts +15 -0
- package/dist/types/utils/uuid.d.ts +5 -0
- package/document-fixtures/unsupported-content.json +526 -0
- package/json-schema/v1/full.json +2536 -0
- package/json-schema/v1/stage-0.json +2737 -0
- package/package.json +63 -0
- package/steps/package.json +7 -0
- package/test-helpers/html-helpers.ts +40 -0
- package/test-helpers/matches.ts +8 -0
- package/test-helpers/schema-builder.ts +329 -0
- package/test-helpers/schema.ts +79 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDOMElement = void 0;
|
|
7
|
+
|
|
8
|
+
var isDOMElement = function isDOMElement(maybeNode) {
|
|
9
|
+
return maybeNode instanceof Node && maybeNode.nodeType === Node.ELEMENT_NODE;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.isDOMElement = isDOMElement;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getLinkMatch = getLinkMatch;
|
|
9
|
+
exports.normalizeUrl = normalizeUrl;
|
|
10
|
+
exports.isSafeUrl = void 0;
|
|
11
|
+
|
|
12
|
+
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
|
13
|
+
|
|
14
|
+
var whitelistedURLPatterns = [/^https?:\/\//im, /^ftps?:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:/im, /^facetime:/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^#/im];
|
|
15
|
+
|
|
16
|
+
var isSafeUrl = function isSafeUrl(url) {
|
|
17
|
+
return whitelistedURLPatterns.some(function (p) {
|
|
18
|
+
return p.test(url.trim()) === true;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.isSafeUrl = isSafeUrl;
|
|
23
|
+
var linkify = (0, _linkifyIt.default)();
|
|
24
|
+
linkify.add('sourcetree:', 'http:');
|
|
25
|
+
|
|
26
|
+
function getLinkMatch(str) {
|
|
27
|
+
var match = str && linkify.match(str);
|
|
28
|
+
return match && match[0];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Adds protocol to url if needed.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function normalizeUrl(url) {
|
|
36
|
+
var match = getLinkMatch(url);
|
|
37
|
+
return match && match.url || url;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.uuid = exports.generateUuid = void 0;
|
|
7
|
+
|
|
8
|
+
/* eslint-disable no-bitwise */
|
|
9
|
+
var generateUuid = function generateUuid() {
|
|
10
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11
|
+
var r = Math.random() * 16 | 0;
|
|
12
|
+
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
/* eslint-enable no-bitwise */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.generateUuid = generateUuid;
|
|
19
|
+
var staticValue = false;
|
|
20
|
+
var uuid = {
|
|
21
|
+
setStatic: function setStatic(value) {
|
|
22
|
+
staticValue = value;
|
|
23
|
+
},
|
|
24
|
+
generate: function generate() {
|
|
25
|
+
return staticValue || generateUuid();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.uuid = uuid;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
|
2
|
+
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSchema } from './create-schema';
|
|
2
|
+
export const bitbucketSchema = createSchema({
|
|
3
|
+
nodes: ['doc', 'caption', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'hardBreak', 'rule', 'image', 'media', 'mediaSingle', 'mention', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'],
|
|
4
|
+
marks: ['em', 'strong', 'strike', 'link', 'code', 'unsupportedMark', 'unsupportedNodeAttribute']
|
|
5
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createSchema } from './create-schema';
|
|
2
|
+
const nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
|
|
3
|
+
const marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
|
|
4
|
+
export const confluenceSchema = createSchema({
|
|
5
|
+
nodes,
|
|
6
|
+
marks
|
|
7
|
+
});
|
|
8
|
+
export const confluenceSchemaWithMediaSingle = createSchema({
|
|
9
|
+
nodes: nodes.concat('mediaSingle'),
|
|
10
|
+
marks
|
|
11
|
+
});
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
|
2
|
+
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
|
3
|
+
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer } from './marks';
|
|
4
|
+
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedList, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaGroup, mediaSingle, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
|
5
|
+
|
|
6
|
+
function addItems(builtInItems, config, customSpecs = {}) {
|
|
7
|
+
if (!config) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Add built-in Node / Mark specs
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const items = builtInItems.reduce((items, {
|
|
16
|
+
name,
|
|
17
|
+
spec
|
|
18
|
+
}) => {
|
|
19
|
+
if (config.indexOf(name) !== -1) {
|
|
20
|
+
items[name] = customSpecs[name] || spec;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return items;
|
|
24
|
+
}, {});
|
|
25
|
+
/**
|
|
26
|
+
* Add Custom Node / Mark specs
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
return Object.keys(customSpecs).reduce((items, name) => {
|
|
30
|
+
if (items[name]) {
|
|
31
|
+
return items;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
items[name] = customSpecs[name];
|
|
35
|
+
return items;
|
|
36
|
+
}, items);
|
|
37
|
+
} // We use groups to allow schemas to be constructed in different shapes without changing node/mark
|
|
38
|
+
// specs, but this means nodes/marks are defined with groups that might never be used in the schema.
|
|
39
|
+
// In this scenario ProseMirror will complain and prevent the schema from being constructed.
|
|
40
|
+
//
|
|
41
|
+
// To avoid the problem, we include items that serve to "declare" the groups in the schema. This
|
|
42
|
+
// approach unfortunately leaves unused items in the schema, but has the benefit of avoiding the
|
|
43
|
+
// need to manipulate `exclude` or content expression values for potentially every schema item.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function groupDeclaration(name) {
|
|
47
|
+
return {
|
|
48
|
+
name: `__${name}GroupDeclaration`,
|
|
49
|
+
spec: {
|
|
50
|
+
group: name
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const markGroupDeclarations = [groupDeclaration(COLOR), groupDeclaration(FONT_STYLE), groupDeclaration(SEARCH_QUERY), groupDeclaration(LINK)];
|
|
56
|
+
const markGroupDeclarationsNames = markGroupDeclarations.map(groupMark => groupMark.name);
|
|
57
|
+
const nodesInOrder = [{
|
|
58
|
+
name: 'doc',
|
|
59
|
+
spec: doc
|
|
60
|
+
}, {
|
|
61
|
+
name: 'paragraph',
|
|
62
|
+
spec: paragraph
|
|
63
|
+
}, {
|
|
64
|
+
name: 'text',
|
|
65
|
+
spec: text
|
|
66
|
+
}, {
|
|
67
|
+
name: 'bulletList',
|
|
68
|
+
spec: bulletList
|
|
69
|
+
}, {
|
|
70
|
+
name: 'orderedList',
|
|
71
|
+
spec: orderedList
|
|
72
|
+
}, {
|
|
73
|
+
name: 'listItem',
|
|
74
|
+
spec: listItem
|
|
75
|
+
}, {
|
|
76
|
+
name: 'heading',
|
|
77
|
+
spec: heading
|
|
78
|
+
}, {
|
|
79
|
+
name: 'blockquote',
|
|
80
|
+
spec: blockquote
|
|
81
|
+
}, {
|
|
82
|
+
name: 'codeBlock',
|
|
83
|
+
spec: codeBlock
|
|
84
|
+
}, {
|
|
85
|
+
name: 'panel',
|
|
86
|
+
spec: panel
|
|
87
|
+
}, {
|
|
88
|
+
name: 'rule',
|
|
89
|
+
spec: rule
|
|
90
|
+
}, {
|
|
91
|
+
name: 'image',
|
|
92
|
+
spec: image
|
|
93
|
+
}, {
|
|
94
|
+
name: 'mention',
|
|
95
|
+
spec: mention
|
|
96
|
+
}, {
|
|
97
|
+
name: 'caption',
|
|
98
|
+
spec: caption
|
|
99
|
+
}, {
|
|
100
|
+
name: 'media',
|
|
101
|
+
spec: media
|
|
102
|
+
}, {
|
|
103
|
+
name: 'mediaGroup',
|
|
104
|
+
spec: mediaGroup
|
|
105
|
+
}, {
|
|
106
|
+
name: 'mediaSingle',
|
|
107
|
+
spec: mediaSingle
|
|
108
|
+
}, {
|
|
109
|
+
name: 'mediaInline',
|
|
110
|
+
spec: mediaInline
|
|
111
|
+
}, {
|
|
112
|
+
name: 'placeholder',
|
|
113
|
+
spec: placeholder
|
|
114
|
+
}, {
|
|
115
|
+
name: 'layoutSection',
|
|
116
|
+
spec: layoutSection
|
|
117
|
+
}, {
|
|
118
|
+
name: 'layoutColumn',
|
|
119
|
+
spec: layoutColumn
|
|
120
|
+
}, {
|
|
121
|
+
name: 'hardBreak',
|
|
122
|
+
spec: hardBreak
|
|
123
|
+
}, {
|
|
124
|
+
name: 'emoji',
|
|
125
|
+
spec: emoji
|
|
126
|
+
}, {
|
|
127
|
+
name: 'table',
|
|
128
|
+
spec: table
|
|
129
|
+
}, {
|
|
130
|
+
name: 'tableCell',
|
|
131
|
+
spec: tableCell
|
|
132
|
+
}, {
|
|
133
|
+
name: 'tableRow',
|
|
134
|
+
spec: tableRow
|
|
135
|
+
}, {
|
|
136
|
+
name: 'tableHeader',
|
|
137
|
+
spec: tableHeader
|
|
138
|
+
}, {
|
|
139
|
+
name: 'confluenceJiraIssue',
|
|
140
|
+
spec: confluenceJiraIssue
|
|
141
|
+
}, {
|
|
142
|
+
name: 'confluenceUnsupportedInline',
|
|
143
|
+
spec: confluenceUnsupportedInline
|
|
144
|
+
}, {
|
|
145
|
+
name: 'confluenceUnsupportedBlock',
|
|
146
|
+
spec: confluenceUnsupportedBlock
|
|
147
|
+
}, {
|
|
148
|
+
name: 'decisionList',
|
|
149
|
+
spec: decisionList
|
|
150
|
+
}, {
|
|
151
|
+
name: 'decisionItem',
|
|
152
|
+
spec: decisionItem
|
|
153
|
+
}, {
|
|
154
|
+
name: 'taskList',
|
|
155
|
+
spec: taskList
|
|
156
|
+
}, {
|
|
157
|
+
name: 'taskItem',
|
|
158
|
+
spec: taskItem
|
|
159
|
+
}, {
|
|
160
|
+
name: 'date',
|
|
161
|
+
spec: date
|
|
162
|
+
}, {
|
|
163
|
+
name: 'status',
|
|
164
|
+
spec: status
|
|
165
|
+
}, {
|
|
166
|
+
name: 'expand',
|
|
167
|
+
spec: expand
|
|
168
|
+
}, {
|
|
169
|
+
name: 'nestedExpand',
|
|
170
|
+
spec: nestedExpand
|
|
171
|
+
}, {
|
|
172
|
+
name: 'extension',
|
|
173
|
+
spec: extension
|
|
174
|
+
}, {
|
|
175
|
+
name: 'inlineExtension',
|
|
176
|
+
spec: inlineExtension
|
|
177
|
+
}, {
|
|
178
|
+
name: 'bodiedExtension',
|
|
179
|
+
spec: bodiedExtension
|
|
180
|
+
}, {
|
|
181
|
+
name: 'inlineCard',
|
|
182
|
+
spec: inlineCard
|
|
183
|
+
}, {
|
|
184
|
+
name: 'blockCard',
|
|
185
|
+
spec: blockCard
|
|
186
|
+
}, {
|
|
187
|
+
name: 'embedCard',
|
|
188
|
+
spec: embedCard
|
|
189
|
+
}, {
|
|
190
|
+
name: 'unknownBlock',
|
|
191
|
+
spec: unknownBlock
|
|
192
|
+
}, {
|
|
193
|
+
name: 'unsupportedBlock',
|
|
194
|
+
spec: unsupportedBlock
|
|
195
|
+
}, {
|
|
196
|
+
name: 'unsupportedInline',
|
|
197
|
+
spec: unsupportedInline
|
|
198
|
+
}];
|
|
199
|
+
const marksInOrder = [{
|
|
200
|
+
name: 'link',
|
|
201
|
+
spec: link
|
|
202
|
+
}, {
|
|
203
|
+
name: 'em',
|
|
204
|
+
spec: em
|
|
205
|
+
}, {
|
|
206
|
+
name: 'strong',
|
|
207
|
+
spec: strong
|
|
208
|
+
}, {
|
|
209
|
+
name: 'textColor',
|
|
210
|
+
spec: textColor
|
|
211
|
+
}, {
|
|
212
|
+
name: 'strike',
|
|
213
|
+
spec: strike
|
|
214
|
+
}, {
|
|
215
|
+
name: 'subsup',
|
|
216
|
+
spec: subsup
|
|
217
|
+
}, {
|
|
218
|
+
name: 'underline',
|
|
219
|
+
spec: underline
|
|
220
|
+
}, {
|
|
221
|
+
name: 'code',
|
|
222
|
+
spec: code
|
|
223
|
+
}, {
|
|
224
|
+
name: 'typeAheadQuery',
|
|
225
|
+
spec: typeAheadQuery
|
|
226
|
+
}, {
|
|
227
|
+
name: 'alignment',
|
|
228
|
+
spec: alignment
|
|
229
|
+
}, {
|
|
230
|
+
name: 'annotation',
|
|
231
|
+
spec: annotation
|
|
232
|
+
}, {
|
|
233
|
+
name: 'confluenceInlineComment',
|
|
234
|
+
spec: confluenceInlineComment
|
|
235
|
+
}, ...markGroupDeclarations, {
|
|
236
|
+
name: 'breakout',
|
|
237
|
+
spec: breakout
|
|
238
|
+
}, {
|
|
239
|
+
name: 'dataConsumer',
|
|
240
|
+
spec: dataConsumer
|
|
241
|
+
}, {
|
|
242
|
+
name: 'indentation',
|
|
243
|
+
spec: indentation
|
|
244
|
+
}, {
|
|
245
|
+
name: 'unsupportedMark',
|
|
246
|
+
spec: unsupportedMark
|
|
247
|
+
}, {
|
|
248
|
+
name: 'unsupportedNodeAttribute',
|
|
249
|
+
spec: unsupportedNodeAttribute
|
|
250
|
+
}];
|
|
251
|
+
/**
|
|
252
|
+
* Creates a schema preserving order of marks and nodes.
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
export function createSchema(config) {
|
|
256
|
+
const {
|
|
257
|
+
customNodeSpecs,
|
|
258
|
+
customMarkSpecs
|
|
259
|
+
} = config;
|
|
260
|
+
const nodesConfig = Object.keys(customNodeSpecs || {}).concat(config.nodes);
|
|
261
|
+
const marksConfig = Object.keys(customMarkSpecs || {}).concat(config.marks || []).concat(markGroupDeclarationsNames);
|
|
262
|
+
let nodes = addItems(nodesInOrder, nodesConfig, customNodeSpecs);
|
|
263
|
+
let marks = addItems(marksInOrder, marksConfig, customMarkSpecs);
|
|
264
|
+
nodes = sanitizeNodes(nodes, marks);
|
|
265
|
+
return new Schema({
|
|
266
|
+
nodes,
|
|
267
|
+
marks
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
export function sanitizeNodes(nodes, supportedMarks) {
|
|
271
|
+
const nodeNames = Object.keys(nodes);
|
|
272
|
+
nodeNames.forEach(nodeKey => {
|
|
273
|
+
const nodeSpec = { ...nodes[nodeKey]
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
|
277
|
+
nodeSpec.marks = nodeSpec.marks.split(' ').filter(mark => !!supportedMarks[mark]).join(' ');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (nodeSpec.content) {
|
|
281
|
+
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
nodes[nodeKey] = nodeSpec;
|
|
285
|
+
});
|
|
286
|
+
return nodes;
|
|
287
|
+
}
|
|
288
|
+
export function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
289
|
+
const content = rawContent.replace(/\W/g, ' ');
|
|
290
|
+
const contentKeys = content.split(' ');
|
|
291
|
+
const unsupportedContentKeys = contentKeys.filter(contentKey => !isContentSupported(nodes, contentKey));
|
|
292
|
+
return unsupportedContentKeys.reduce((newContent, nodeName) => sanitizedContent(newContent, nodeName), rawContent);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function sanitizedContent(content, invalidContent) {
|
|
296
|
+
if (!invalidContent.length) {
|
|
297
|
+
return content || '';
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (!content || !content.match(/\w/)) {
|
|
301
|
+
return '';
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const pattern = `(${invalidContent}((\\s)*\\|)+)|((\\|(\\s)*)+${invalidContent})|(${invalidContent}$)|(${invalidContent}(\\+|\\*))`;
|
|
305
|
+
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function isContentSupported(nodes, contentKey) {
|
|
309
|
+
const nodeKeys = Object.keys(nodes); // content is with valid node
|
|
310
|
+
|
|
311
|
+
if (nodeKeys.indexOf(contentKey) > -1) {
|
|
312
|
+
return true;
|
|
313
|
+
} // content is with valid group
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
for (const supportedKey in nodes) {
|
|
317
|
+
const nodeSpec = nodes[supportedKey];
|
|
318
|
+
|
|
319
|
+
if (nodeSpec && nodeSpec.group === contentKey) {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { customPanel } from './nodes/panel';
|
|
2
|
+
import { layoutSectionWithSingleColumn } from './nodes/layout-section';
|
|
3
|
+
import { dataConsumer } from './marks/data-consumer';
|
|
4
|
+
import { createSchema } from './create-schema';
|
|
5
|
+
import { mediaSingleWithCaption } from './nodes';
|
|
6
|
+
|
|
7
|
+
const getDefaultSchemaConfig = () => {
|
|
8
|
+
let defaultSchemaConfig = {
|
|
9
|
+
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', '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'],
|
|
10
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
return defaultSchemaConfig;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const defaultSchemaConfig = getDefaultSchemaConfig();
|
|
17
|
+
export const getSchemaBasedOnStage = (stage = 'final') => {
|
|
18
|
+
const defaultSchemaConfig = getDefaultSchemaConfig(); // TODO: ED-10445 remove stage0 check after panels with emoji are on full schema AND image captions are on full schema
|
|
19
|
+
|
|
20
|
+
if (stage === 'stage0') {
|
|
21
|
+
defaultSchemaConfig.customNodeSpecs = {
|
|
22
|
+
panel: customPanel,
|
|
23
|
+
mediaSingle: mediaSingleWithCaption,
|
|
24
|
+
layoutSection: layoutSectionWithSingleColumn
|
|
25
|
+
};
|
|
26
|
+
defaultSchemaConfig.customMarkSpecs = {
|
|
27
|
+
dataConsumer: dataConsumer
|
|
28
|
+
};
|
|
29
|
+
defaultSchemaConfig.nodes.push('caption');
|
|
30
|
+
defaultSchemaConfig.nodes.push('mediaInline');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return createSchema(defaultSchemaConfig);
|
|
34
|
+
};
|
|
35
|
+
export const defaultSchema = getSchemaBasedOnStage();
|