@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,81 @@
|
|
|
1
|
+
export let USER_TYPES;
|
|
2
|
+
|
|
3
|
+
(function (USER_TYPES) {
|
|
4
|
+
USER_TYPES["DEFAULT"] = "DEFAULT";
|
|
5
|
+
USER_TYPES["SPECIAL"] = "SPECIAL";
|
|
6
|
+
USER_TYPES["APP"] = "APP";
|
|
7
|
+
})(USER_TYPES || (USER_TYPES = {}));
|
|
8
|
+
|
|
9
|
+
export const mention = {
|
|
10
|
+
inline: true,
|
|
11
|
+
group: 'inline',
|
|
12
|
+
selectable: true,
|
|
13
|
+
attrs: {
|
|
14
|
+
id: {
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
default: ''
|
|
19
|
+
},
|
|
20
|
+
accessLevel: {
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
userType: {
|
|
24
|
+
default: null
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
parseDOM: [{
|
|
28
|
+
tag: 'span[data-mention-id]',
|
|
29
|
+
getAttrs: domNode => {
|
|
30
|
+
const dom = domNode;
|
|
31
|
+
const attrs = {
|
|
32
|
+
id: dom.getAttribute('data-mention-id') || mention.attrs.id.default,
|
|
33
|
+
text: dom.textContent || mention.attrs.text.default,
|
|
34
|
+
accessLevel: dom.getAttribute('data-access-level') || mention.attrs.accessLevel.default
|
|
35
|
+
};
|
|
36
|
+
const userType = dom.getAttribute('data-user-type');
|
|
37
|
+
|
|
38
|
+
if (USER_TYPES[userType]) {
|
|
39
|
+
attrs.userType = userType;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return attrs;
|
|
43
|
+
}
|
|
44
|
+
}],
|
|
45
|
+
|
|
46
|
+
toDOM(node) {
|
|
47
|
+
const {
|
|
48
|
+
id,
|
|
49
|
+
accessLevel,
|
|
50
|
+
text,
|
|
51
|
+
userType
|
|
52
|
+
} = node.attrs;
|
|
53
|
+
const attrs = {
|
|
54
|
+
'data-mention-id': id,
|
|
55
|
+
'data-access-level': accessLevel,
|
|
56
|
+
contenteditable: 'false'
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (userType) {
|
|
60
|
+
attrs['data-user-type'] = userType;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return ['span', attrs, text];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const isOptional = key => {
|
|
69
|
+
return ['userType'].indexOf(key) > -1;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const toJSON = node => ({
|
|
73
|
+
attrs: Object.keys(node.attrs).reduce((obj, key) => {
|
|
74
|
+
if (isOptional(key) && !node.attrs[key]) {
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
obj[key] = node.attrs[key];
|
|
79
|
+
return obj;
|
|
80
|
+
}, {})
|
|
81
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name nestedExpand_content
|
|
3
|
+
* @minItems 1
|
|
4
|
+
* @allowUnsupportedBlock true
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name nestedExpand_node
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @name nestedExpand_with_no_marks_node
|
|
13
|
+
*/
|
|
14
|
+
export const nestedExpand = {
|
|
15
|
+
inline: false,
|
|
16
|
+
marks: 'link unsupportedMark unsupportedNodeAttribute',
|
|
17
|
+
content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
|
|
18
|
+
isolating: true,
|
|
19
|
+
selectable: true,
|
|
20
|
+
attrs: {
|
|
21
|
+
title: {
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
__expanded: {
|
|
25
|
+
default: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
parseDOM: [{
|
|
29
|
+
context: 'nestedExpand//',
|
|
30
|
+
tag: '[data-node-type="nestedExpand"]',
|
|
31
|
+
skip: true
|
|
32
|
+
}, {
|
|
33
|
+
tag: '[data-node-type="nestedExpand"] button',
|
|
34
|
+
ignore: true
|
|
35
|
+
}, {
|
|
36
|
+
tag: '[data-node-type="expand"] button',
|
|
37
|
+
ignore: true
|
|
38
|
+
}, {
|
|
39
|
+
tag: 'div[data-node-type="nestedExpand"]',
|
|
40
|
+
getAttrs: domNode => {
|
|
41
|
+
const dom = domNode;
|
|
42
|
+
return {
|
|
43
|
+
title: dom.getAttribute('data-title'),
|
|
44
|
+
__expanded: true
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}],
|
|
48
|
+
|
|
49
|
+
toDOM(node) {
|
|
50
|
+
const attrs = {
|
|
51
|
+
'data-node-type': 'nestedExpand',
|
|
52
|
+
'data-title': node.attrs.title,
|
|
53
|
+
'data-expanded': node.attrs.__expanded
|
|
54
|
+
};
|
|
55
|
+
return ['div', attrs, 0];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-cycle
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @name orderedList_node
|
|
5
|
+
*/
|
|
6
|
+
export const orderedListSelector = '.ak-ol';
|
|
7
|
+
export const orderedList = {
|
|
8
|
+
group: 'block',
|
|
9
|
+
content: 'listItem+',
|
|
10
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
11
|
+
selectable: false,
|
|
12
|
+
parseDOM: [{
|
|
13
|
+
tag: 'ol'
|
|
14
|
+
}],
|
|
15
|
+
|
|
16
|
+
toDOM() {
|
|
17
|
+
const attrs = {
|
|
18
|
+
class: orderedListSelector.substr(1)
|
|
19
|
+
};
|
|
20
|
+
return ['ol', attrs, 0];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export let PanelType;
|
|
2
|
+
|
|
3
|
+
(function (PanelType) {
|
|
4
|
+
PanelType["INFO"] = "info";
|
|
5
|
+
PanelType["NOTE"] = "note";
|
|
6
|
+
PanelType["TIP"] = "tip";
|
|
7
|
+
PanelType["WARNING"] = "warning";
|
|
8
|
+
PanelType["ERROR"] = "error";
|
|
9
|
+
PanelType["SUCCESS"] = "success";
|
|
10
|
+
PanelType["CUSTOM"] = "custom";
|
|
11
|
+
})(PanelType || (PanelType = {}));
|
|
12
|
+
|
|
13
|
+
//TODO: ED-10445 rename to panel and merge with the other panel node spec, after emoji panels moved to full schema
|
|
14
|
+
export const customPanel = {
|
|
15
|
+
group: 'block',
|
|
16
|
+
content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
|
|
17
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
18
|
+
attrs: {
|
|
19
|
+
panelType: {
|
|
20
|
+
default: 'info'
|
|
21
|
+
},
|
|
22
|
+
panelIcon: {
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
panelColor: {
|
|
26
|
+
default: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
parseDOM: [{
|
|
30
|
+
tag: 'div[data-panel-type]',
|
|
31
|
+
getAttrs: dom => ({
|
|
32
|
+
panelType: dom.getAttribute('data-panel-type'),
|
|
33
|
+
panelIcon: dom.getAttribute('data-panel-icon'),
|
|
34
|
+
panelColor: dom.getAttribute('data-panel-color')
|
|
35
|
+
})
|
|
36
|
+
}],
|
|
37
|
+
|
|
38
|
+
toDOM(node) {
|
|
39
|
+
const {
|
|
40
|
+
panelType,
|
|
41
|
+
panelIcon,
|
|
42
|
+
panelColor
|
|
43
|
+
} = node.attrs;
|
|
44
|
+
const attrs = {
|
|
45
|
+
'data-panel-type': panelType,
|
|
46
|
+
'data-panel-icon': panelIcon,
|
|
47
|
+
'data-panel-color': panelColor
|
|
48
|
+
};
|
|
49
|
+
return ['div', attrs, ['div', {}, 0]];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
};
|
|
53
|
+
export const panel = {
|
|
54
|
+
group: 'block',
|
|
55
|
+
content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
|
|
56
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
57
|
+
attrs: {
|
|
58
|
+
panelType: {
|
|
59
|
+
default: 'info'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
parseDOM: [{
|
|
63
|
+
tag: 'div[data-panel-type]',
|
|
64
|
+
getAttrs: dom => ({
|
|
65
|
+
panelType: dom.getAttribute('data-panel-type')
|
|
66
|
+
})
|
|
67
|
+
}],
|
|
68
|
+
|
|
69
|
+
toDOM(node) {
|
|
70
|
+
const {
|
|
71
|
+
panelType
|
|
72
|
+
} = node.attrs;
|
|
73
|
+
const attrs = {
|
|
74
|
+
'data-panel-type': panelType
|
|
75
|
+
};
|
|
76
|
+
return ['div', attrs, ['div', {}, 0]];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name paragraph_node
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @name paragraph_with_no_marks_node
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* NOTE: Need this because TS is too smart and inline everything.
|
|
11
|
+
* So we need to give them separate identity.
|
|
12
|
+
* Probably there's a way to solve it but that will need time and exploration.
|
|
13
|
+
* // http://bit.ly/2raXFX5
|
|
14
|
+
* type T1 = X | Y
|
|
15
|
+
* type T2 = A | T1 | B // T2 = A | X | Y | B
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @name paragraph_with_alignment_node
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @name paragraph_with_indentation_node
|
|
24
|
+
*/
|
|
25
|
+
const pDOM = ['p', 0];
|
|
26
|
+
export const paragraph = {
|
|
27
|
+
selectable: false,
|
|
28
|
+
content: 'inline*',
|
|
29
|
+
group: 'block',
|
|
30
|
+
marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer',
|
|
31
|
+
parseDOM: [{
|
|
32
|
+
tag: 'p'
|
|
33
|
+
}],
|
|
34
|
+
|
|
35
|
+
toDOM() {
|
|
36
|
+
return pDOM;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name placeholder_node
|
|
3
|
+
*/
|
|
4
|
+
export const placeholder = {
|
|
5
|
+
inline: true,
|
|
6
|
+
group: 'inline',
|
|
7
|
+
selectable: false,
|
|
8
|
+
marks: '',
|
|
9
|
+
attrs: {
|
|
10
|
+
text: {
|
|
11
|
+
default: ''
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
parseDOM: [{
|
|
15
|
+
tag: 'span[data-placeholder]',
|
|
16
|
+
getAttrs: dom => ({
|
|
17
|
+
text: dom.getAttribute('data-placeholder') || placeholder.attrs.text.default
|
|
18
|
+
})
|
|
19
|
+
}],
|
|
20
|
+
|
|
21
|
+
toDOM(node) {
|
|
22
|
+
const {
|
|
23
|
+
text
|
|
24
|
+
} = node.attrs;
|
|
25
|
+
const attrs = {
|
|
26
|
+
'data-placeholder': text,
|
|
27
|
+
// Needs to be edtiable for mobile to not close keyboard
|
|
28
|
+
contenteditable: 'true'
|
|
29
|
+
};
|
|
30
|
+
return ['span', attrs, text];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { uuid } from '../../utils/uuid';
|
|
2
|
+
/**
|
|
3
|
+
* @name status_node
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const status = {
|
|
7
|
+
inline: true,
|
|
8
|
+
group: 'inline',
|
|
9
|
+
selectable: true,
|
|
10
|
+
attrs: {
|
|
11
|
+
text: {
|
|
12
|
+
default: ''
|
|
13
|
+
},
|
|
14
|
+
color: {
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
localId: {
|
|
18
|
+
default: uuid.generate()
|
|
19
|
+
},
|
|
20
|
+
style: {
|
|
21
|
+
default: ''
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
parseDOM: [{
|
|
25
|
+
tag: 'span[data-node-type="status"]',
|
|
26
|
+
getAttrs: domNode => {
|
|
27
|
+
const dom = domNode;
|
|
28
|
+
return {
|
|
29
|
+
text: dom.textContent.replace(/\n/, '').trim(),
|
|
30
|
+
color: dom.getAttribute('data-color'),
|
|
31
|
+
localId: uuid.generate(),
|
|
32
|
+
style: dom.getAttribute('data-style')
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}],
|
|
36
|
+
|
|
37
|
+
toDOM(node) {
|
|
38
|
+
const {
|
|
39
|
+
text,
|
|
40
|
+
color,
|
|
41
|
+
localId,
|
|
42
|
+
style
|
|
43
|
+
} = node.attrs;
|
|
44
|
+
const attrs = {
|
|
45
|
+
'data-node-type': 'status',
|
|
46
|
+
'data-color': color,
|
|
47
|
+
'data-local-id': localId,
|
|
48
|
+
'data-style': style,
|
|
49
|
+
contenteditable: 'false'
|
|
50
|
+
};
|
|
51
|
+
return ['span', attrs, text];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { B100, B50, B75, G200, G50, G75, hexToRgba, isRgb, N0, N20, N60, N800, P100, P50, P75, R100, R50, R75, rgbToHex, T100, T50, T75, Y200, Y50, Y75 } from '../../utils/colors';
|
|
2
|
+
import { uuid } from '../../utils/uuid';
|
|
3
|
+
export const tablePrefixSelector = 'pm-table';
|
|
4
|
+
export const tableCellSelector = `${tablePrefixSelector}-cell-content-wrap`;
|
|
5
|
+
export const tableHeaderSelector = `${tablePrefixSelector}-header-content-wrap`;
|
|
6
|
+
export const tableCellContentWrapperSelector = `${tablePrefixSelector}-cell-nodeview-wrapper`;
|
|
7
|
+
export const tableCellContentDomSelector = `${tablePrefixSelector}-cell-nodeview-content-dom`;
|
|
8
|
+
const DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
|
|
9
|
+
export const getCellAttrs = (dom, defaultValues = {}) => {
|
|
10
|
+
const widthAttr = dom.getAttribute('data-colwidth');
|
|
11
|
+
const width = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(str => Number(str)) : null;
|
|
12
|
+
const colspan = Number(dom.getAttribute('colspan') || 1);
|
|
13
|
+
let {
|
|
14
|
+
backgroundColor
|
|
15
|
+
} = dom.style;
|
|
16
|
+
|
|
17
|
+
if (backgroundColor && isRgb(backgroundColor)) {
|
|
18
|
+
const result = rgbToHex(backgroundColor);
|
|
19
|
+
|
|
20
|
+
if (result !== null) {
|
|
21
|
+
backgroundColor = result;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
colspan,
|
|
27
|
+
rowspan: Number(dom.getAttribute('rowspan') || 1),
|
|
28
|
+
colwidth: width && width.length === colspan ? width : null,
|
|
29
|
+
background: backgroundColor && backgroundColor !== defaultValues['background'] ? backgroundColor : null
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* gets cell dom attributes based on node attributes
|
|
35
|
+
* @returns CellDomAttrs
|
|
36
|
+
*/
|
|
37
|
+
export const getCellDomAttrs = node => {
|
|
38
|
+
const attrs = {};
|
|
39
|
+
const nodeType = node.type.name;
|
|
40
|
+
|
|
41
|
+
if (node.attrs.colspan !== 1) {
|
|
42
|
+
attrs.colspan = node.attrs.colspan;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (node.attrs.rowspan !== 1) {
|
|
46
|
+
attrs.rowspan = node.attrs.rowspan;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (node.attrs.colwidth) {
|
|
50
|
+
attrs['data-colwidth'] = node.attrs.colwidth.join(',');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (node.attrs.background) {
|
|
54
|
+
const {
|
|
55
|
+
background
|
|
56
|
+
} = node.attrs; // to ensure that we don't overwrite product's style:
|
|
57
|
+
// - it clears background color for <th> if its set to gray
|
|
58
|
+
// - it clears background color for <td> if its set to white
|
|
59
|
+
|
|
60
|
+
const ignored = nodeType === 'tableHeader' && background === tableBackgroundColorNames.get('light gray') || nodeType === 'tableCell' && background === tableBackgroundColorNames.get('white');
|
|
61
|
+
|
|
62
|
+
if (ignored) {
|
|
63
|
+
attrs.style = '';
|
|
64
|
+
} else {
|
|
65
|
+
const color = isRgb(background) ? rgbToHex(background) : background;
|
|
66
|
+
attrs.style = `${attrs.style || ''}background-color: ${color};`;
|
|
67
|
+
attrs.colorname = tableBackgroundColorPalette.get(color);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (nodeType === 'tableHeader') {
|
|
72
|
+
attrs.class = tableHeaderSelector;
|
|
73
|
+
} else {
|
|
74
|
+
attrs.class = tableCellSelector;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return attrs;
|
|
78
|
+
};
|
|
79
|
+
export const tableBackgroundColorPalette = new Map();
|
|
80
|
+
export const tableBackgroundBorderColor = hexToRgba(N800, 0.12) || N0;
|
|
81
|
+
export const tableBackgroundColorNames = new Map();
|
|
82
|
+
[[N0, 'White'], [B50, 'Light blue'], [T50, 'Light teal'], [G50, 'Light green'], [Y50, 'Light yellow'], [R50, 'Light red'], [P50, 'Light purple'], [N20, 'Light gray'], [B75, 'Blue'], [T75, 'Teal'], [G75, 'Green'], [Y75, 'Yellow'], [R75, 'Red'], [P75, 'Purple'], [N60, 'Gray'], [B100, 'Dark blue'], [T100, 'Dark teal'], [G200, 'Dark green'], [Y200, 'Dark yellow'], [R100, 'Dark red'], [P100, 'Dark purple']].forEach(([colorValue, colorName]) => {
|
|
83
|
+
tableBackgroundColorPalette.set(colorValue.toLowerCase(), colorName);
|
|
84
|
+
tableBackgroundColorNames.set(colorName.toLowerCase(), colorValue.toLowerCase());
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// TODO: Fix any, potential issue. ED-5048
|
|
88
|
+
const createTableSpec = () => {
|
|
89
|
+
const attrs = {
|
|
90
|
+
isNumberColumnEnabled: {
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
layout: {
|
|
94
|
+
default: 'default'
|
|
95
|
+
},
|
|
96
|
+
__autoSize: {
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
localId: {
|
|
100
|
+
default: ''
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const tableNodeSpec = {
|
|
104
|
+
content: 'tableRow+',
|
|
105
|
+
attrs: attrs,
|
|
106
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
107
|
+
tableRole: 'table',
|
|
108
|
+
isolating: true,
|
|
109
|
+
selectable: false,
|
|
110
|
+
group: 'block',
|
|
111
|
+
parseDOM: [{
|
|
112
|
+
tag: 'table',
|
|
113
|
+
getAttrs: node => {
|
|
114
|
+
var _dom$parentElement;
|
|
115
|
+
|
|
116
|
+
const dom = node;
|
|
117
|
+
const breakoutWrapper = (_dom$parentElement = dom.parentElement) === null || _dom$parentElement === void 0 ? void 0 : _dom$parentElement.parentElement;
|
|
118
|
+
return {
|
|
119
|
+
isNumberColumnEnabled: dom.getAttribute('data-number-column') === 'true' ? true : false,
|
|
120
|
+
layout: // copying from editor
|
|
121
|
+
dom.getAttribute('data-layout') || ( // copying from renderer
|
|
122
|
+
breakoutWrapper === null || breakoutWrapper === void 0 ? void 0 : breakoutWrapper.getAttribute('data-layout')) || 'default',
|
|
123
|
+
__autoSize: dom.getAttribute('data-autosize') === 'true' ? true : false,
|
|
124
|
+
localId: dom.getAttribute('data-table-local-id') || uuid.generate()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}],
|
|
128
|
+
|
|
129
|
+
toDOM(node) {
|
|
130
|
+
const attrs = {
|
|
131
|
+
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
132
|
+
'data-layout': node.attrs.layout,
|
|
133
|
+
'data-autosize': node.attrs.__autoSize,
|
|
134
|
+
'data-table-local-id': node.attrs.localId
|
|
135
|
+
};
|
|
136
|
+
return ['table', attrs, ['tbody', 0]];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
};
|
|
140
|
+
return tableNodeSpec;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const table = createTableSpec();
|
|
144
|
+
|
|
145
|
+
const shouldIncludeAttribute = (key, value) => !key.startsWith('__') && (key !== 'localId' || !!value);
|
|
146
|
+
|
|
147
|
+
export const tableToJSON = node => ({
|
|
148
|
+
attrs: Object.keys(node.attrs).filter(key => shouldIncludeAttribute(key, node.attrs[key])).reduce((obj, key) => {
|
|
149
|
+
obj[key] = node.attrs[key];
|
|
150
|
+
return obj;
|
|
151
|
+
}, {})
|
|
152
|
+
});
|
|
153
|
+
export const tableRow = {
|
|
154
|
+
selectable: false,
|
|
155
|
+
content: '(tableCell | tableHeader)+',
|
|
156
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
157
|
+
tableRole: 'row',
|
|
158
|
+
parseDOM: [{
|
|
159
|
+
tag: 'tr'
|
|
160
|
+
}],
|
|
161
|
+
|
|
162
|
+
toDOM() {
|
|
163
|
+
return ['tr', 0];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
};
|
|
167
|
+
const cellAttrs = {
|
|
168
|
+
colspan: {
|
|
169
|
+
default: 1
|
|
170
|
+
},
|
|
171
|
+
rowspan: {
|
|
172
|
+
default: 1
|
|
173
|
+
},
|
|
174
|
+
colwidth: {
|
|
175
|
+
default: null
|
|
176
|
+
},
|
|
177
|
+
background: {
|
|
178
|
+
default: null
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
export const tableCell = {
|
|
182
|
+
selectable: false,
|
|
183
|
+
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
|
|
184
|
+
attrs: cellAttrs,
|
|
185
|
+
tableRole: 'cell',
|
|
186
|
+
marks: 'link alignment dataConsumer unsupportedMark unsupportedNodeAttribute',
|
|
187
|
+
isolating: true,
|
|
188
|
+
parseDOM: [// Ignore number cell copied from renderer
|
|
189
|
+
{
|
|
190
|
+
tag: '.ak-renderer-table-number-column',
|
|
191
|
+
ignore: true
|
|
192
|
+
}, {
|
|
193
|
+
tag: 'td',
|
|
194
|
+
getAttrs: dom => getCellAttrs(dom)
|
|
195
|
+
}],
|
|
196
|
+
toDOM: node => ['td', getCellDomAttrs(node), 0]
|
|
197
|
+
};
|
|
198
|
+
export const toJSONTableCell = node => ({
|
|
199
|
+
attrs: Object.keys(node.attrs).reduce((obj, key) => {
|
|
200
|
+
if (cellAttrs[key].default !== node.attrs[key]) {
|
|
201
|
+
obj[key] = node.attrs[key];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return obj;
|
|
205
|
+
}, {})
|
|
206
|
+
});
|
|
207
|
+
export const tableHeader = {
|
|
208
|
+
selectable: false,
|
|
209
|
+
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand)+',
|
|
210
|
+
attrs: cellAttrs,
|
|
211
|
+
tableRole: 'header_cell',
|
|
212
|
+
isolating: true,
|
|
213
|
+
marks: 'link alignment dataConsumer unsupportedMark unsupportedNodeAttribute',
|
|
214
|
+
parseDOM: [{
|
|
215
|
+
tag: 'th',
|
|
216
|
+
getAttrs: dom => getCellAttrs(dom, {
|
|
217
|
+
background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND
|
|
218
|
+
})
|
|
219
|
+
}],
|
|
220
|
+
toDOM: node => ['th', getCellDomAttrs(node), 0]
|
|
221
|
+
};
|
|
222
|
+
export const toJSONTableHeader = toJSONTableCell;
|