@atlaskit/adf-schema 28.1.6 → 28.1.7
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 +6 -0
- package/index.ts +275 -0
- package/package.json +5 -5
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-attrs.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-marks.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockquote-with-list-inside.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-with-nested-bodiedExtension.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-content.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-extensionKey.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-extensionType.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-attrs.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-marks.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-not-listItem-content.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-em.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-strike.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-strong.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-subsup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-underline.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-non-text.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-strong.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-unknown-attribute.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-unsupported-marks.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decision-with-blockquote.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decisionList-with-empty-decision.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decisionList-with-no-decision.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-with-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-with-marks.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-without-content.json +4 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-without-version.json +4 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/em-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-as-top-level-node.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-marks.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-unknown-attr.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/expand-nested-with-marks.json +60 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/expand-with-breakout-inside-of-layout.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-with-content.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-with-empty-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-without-extensionKey.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-without-extensionType.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/hardBreak-with-marks.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/hardBreak-with-wrong-text.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-invalid-level-attr.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-non-text-block.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-non-text-inline.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-unknown-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-unsupported-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-without-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-with-content.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-without-extensionKey.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-without-extensionType.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-missing-layoutColumn.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-one-column.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-overflow-width.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-two-columns-and-breakout-code-block.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-with-empty-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-with-unknown-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/list-with-blockquote.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-empty-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-list-as-first-child.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-marks.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-as-top-level-node.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-invalid-alt-text.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-invalid-occurrence-key-attr.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-unknown-attr.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-id-attr.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-type-attr.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaInline-with-subsup-mark.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-empty-attrs.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-invalid-caption.json +46 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-invalid-layout-attr.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-negative-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-overflow-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-zero-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-extra-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-invalid-user-type.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mono-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-with-extra-attrs.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-with-marks.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-without-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-blockquote.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-codeBlock.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-empty-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-marks.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-panel.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-unknown-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-without-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-text-with-unknown-mark.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-top-level-content.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-unsupported-marks.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/placeholder-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/placeholder-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-marks.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-with-extra-attr.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-color-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-text-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/strike-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/strong-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-with-extra-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-with-invalid-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-without-type-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-breakout-code-block.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-fragment-mark-with-empty-local-id.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-fragment-mark-without-local-id.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-nested-table.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-without-cells.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-without-rows.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/task-with-blockquote.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/task-with-invalid-state.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskItem-with-nested-taskItem.json +70 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-empty-task.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-no-task.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-taskList-as-first-child.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/text-empty.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-with-extra-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-with-invalid-color-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-without-color-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/underline-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/annotation.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/blockQuote-with-content.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-Extension-with-rich-body.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-empty-content.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-media-link.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-nested-extension.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-parameters.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodiedExtension-with-data-consumer-mark.json +47 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bulletList-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-empty-attrs.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-breakout-mark.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-empty-marks.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-language.json +482 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-multiple-text.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-text.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-unknown-language.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/decision-with-mention.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/decisionList-with-decision.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-all-content.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-empty-content.json +5 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/embed-card.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji-with-fallback.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji-with-variation.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-embed-card.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-marks.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-nestedExpand.json +136 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-data-consumer-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-empty-marks.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-named-fragment-mark.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-parameters.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak-with-text.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-code-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-content.json +78 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-em-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-empty-content.json +78 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-empty-marks.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-link-text.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-strike-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-strong-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-subsup-text.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-supported-mark.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-underline-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-data-consumer-mark.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-fragment-mark.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-parameters.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-without-parameters.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layout-with-embed.json +51 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-three-columns.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-two-columns-and-breakout.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-two-columns.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/link-with-href-title.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/link-with-href.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-bullet-list-and-media-single.json +47 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-media-single-and-bullet-list.json +57 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-ordered-list.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-paragraph.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-with-codeBlock.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/listItem-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-external-with-alt-text-value.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-layout-column.json +57 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-list-item.json +88 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-nested-expand.json +64 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-table.json +56 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-an-expand.json +44 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-alt-text-value.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-alt-text.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-link-mark.json +36 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-occurrence-key.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-type-link.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaGroup-with-multiple-media.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-file-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-link-mark.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-link-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-caption-inside-list-item.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-caption.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-link-mark.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-parameters.json +86 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-width.json +74 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-without-parameters.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mention-with-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mention-with-user-type.json +35 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nested-extensions-with-data-consumer-mark.json +226 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nested-extensions-without-mark.json +176 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nestedExpand.json +128 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/orderedList-with-content.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/orderedList-with-order.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-info.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-note.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-tip.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-warning.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-blockCard.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-list.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-paragraph.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-empty-marks.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-supported-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/placeholder.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/rule.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-nested-in-list.json +43 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-with-all-attrs.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-with-default-attrs.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/subsup-as-sub.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/subsup-as-sup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-empty-cell.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-fragment-mark.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-header-row.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-layout.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-nested-nodes.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/task-with-mention.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/taskList-with-nested-taskLists.json +74 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/taskList-with-tasks.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-code-and-link.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-code.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-em.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-link.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-strong.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-subsup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-textColor.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-underline.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/.gitkeep +0 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-empty-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-empty-datasource.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-empty-views.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-layout.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-views-type.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/bodiedExtension-with-source-as-string-data-consumer-mark.json +46 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/extension-with-invalid-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/extension-with-nonsense-marks.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/inlineExtension-with-source-as-string-data-consumer-mark.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/mediaSingle-with-invalid-percentage-width.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/mediaSingle-with-invalid-pixel-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/nested-extensions-with-link-mark.json +216 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-empty-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-invalid-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-invalid-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/.gitkeep +0 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-with-datasources.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-with-empty-datasource-parameters.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-without-optional-fields.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/layoutSection-with-one-column.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/mediaSingle-with-percentage-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/mediaSingle-with-pixel-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/table-with-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1.ts +53 -0
- package/src/__tests__/unit/schema/create-schema.ts +214 -0
- package/src/__tests__/unit/schema/default-schema.ts +192 -0
- package/src/__tests__/unit/schema/marks/annotation.ts +46 -0
- package/src/__tests__/unit/schema/marks/border.ts +76 -0
- package/src/__tests__/unit/schema/marks/breakout.ts +24 -0
- package/src/__tests__/unit/schema/marks/code.ts +44 -0
- package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +25 -0
- package/src/__tests__/unit/schema/marks/data-consumer.ts +52 -0
- package/src/__tests__/unit/schema/marks/em.ts +37 -0
- package/src/__tests__/unit/schema/marks/link.ts +188 -0
- package/src/__tests__/unit/schema/marks/strike.ts +37 -0
- package/src/__tests__/unit/schema/marks/strong.ts +43 -0
- package/src/__tests__/unit/schema/marks/subsup.ts +50 -0
- package/src/__tests__/unit/schema/marks/text-color.ts +61 -0
- package/src/__tests__/unit/schema/marks/underline.ts +36 -0
- package/src/__tests__/unit/schema/nodes/_consts.ts +964 -0
- package/src/__tests__/unit/schema/nodes/block-card.ts +184 -0
- package/src/__tests__/unit/schema/nodes/blockquote.ts +44 -0
- package/src/__tests__/unit/schema/nodes/bodied-extension.ts +101 -0
- package/src/__tests__/unit/schema/nodes/code-block.ts +221 -0
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +36 -0
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +35 -0
- package/src/__tests__/unit/schema/nodes/date.ts +51 -0
- package/src/__tests__/unit/schema/nodes/decision-item.ts +46 -0
- package/src/__tests__/unit/schema/nodes/decision-list.ts +52 -0
- package/src/__tests__/unit/schema/nodes/embed-card.ts +60 -0
- package/src/__tests__/unit/schema/nodes/emoji.ts +71 -0
- package/src/__tests__/unit/schema/nodes/expand.ts +51 -0
- package/src/__tests__/unit/schema/nodes/extension.ts +101 -0
- package/src/__tests__/unit/schema/nodes/hard-break.ts +24 -0
- package/src/__tests__/unit/schema/nodes/heading.ts +56 -0
- package/src/__tests__/unit/schema/nodes/image.ts +32 -0
- package/src/__tests__/unit/schema/nodes/inline-card.ts +106 -0
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +79 -0
- package/src/__tests__/unit/schema/nodes/layout-column.ts +54 -0
- package/src/__tests__/unit/schema/nodes/layout-section.ts +95 -0
- package/src/__tests__/unit/schema/nodes/list-item.ts +49 -0
- package/src/__tests__/unit/schema/nodes/media-group.ts +67 -0
- package/src/__tests__/unit/schema/nodes/media-single.ts +171 -0
- package/src/__tests__/unit/schema/nodes/media.ts +388 -0
- package/src/__tests__/unit/schema/nodes/mention.ts +115 -0
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +72 -0
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +49 -0
- package/src/__tests__/unit/schema/nodes/panel.ts +180 -0
- package/src/__tests__/unit/schema/nodes/paragraph.ts +25 -0
- package/src/__tests__/unit/schema/nodes/placeholder.ts +46 -0
- package/src/__tests__/unit/schema/nodes/rule.ts +24 -0
- package/src/__tests__/unit/schema/nodes/status.ts +120 -0
- package/src/__tests__/unit/schema/nodes/tableNodes.ts +555 -0
- package/src/__tests__/unit/schema/nodes/task-item.ts +39 -0
- package/src/__tests__/unit/schema/nodes/task-list.ts +45 -0
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +42 -0
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +42 -0
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +38 -0
- package/src/__tests__/unit/utils/colors.ts +42 -0
- package/src/__tests__/unit/utils/url.ts +209 -0
- package/src/index.ts +297 -0
- package/src/json-schema/index.ts +2 -0
- package/src/schema/bitbucket-schema.ts +43 -0
- package/src/schema/confluence-schema.ts +76 -0
- package/src/schema/create-schema.ts +337 -0
- package/src/schema/default-schema.ts +180 -0
- package/src/schema/groups.ts +30 -0
- package/src/schema/index.ts +238 -0
- package/src/schema/inline-nodes.ts +9 -0
- package/src/schema/jira-schema.ts +158 -0
- package/src/schema/marks/__tests__/unit/annotation.ts +18 -0
- package/src/schema/marks/alignment.ts +48 -0
- package/src/schema/marks/annotation.ts +107 -0
- package/src/schema/marks/border.ts +74 -0
- package/src/schema/marks/breakout.ts +42 -0
- package/src/schema/marks/code.ts +45 -0
- package/src/schema/marks/confluence-inline-comment.ts +32 -0
- package/src/schema/marks/data-consumer.ts +100 -0
- package/src/schema/marks/em.ts +19 -0
- package/src/schema/marks/fragment.ts +77 -0
- package/src/schema/marks/indentation.ts +47 -0
- package/src/schema/marks/index.ts +61 -0
- package/src/schema/marks/link.ts +139 -0
- package/src/schema/marks/strike.ts +26 -0
- package/src/schema/marks/strong.ts +45 -0
- package/src/schema/marks/subsup.ts +53 -0
- package/src/schema/marks/text-color.ts +172 -0
- package/src/schema/marks/type-ahead-query.ts +22 -0
- package/src/schema/marks/underline.ts +24 -0
- package/src/schema/marks/unsupported-mark.ts +9 -0
- package/src/schema/marks/unsupported-node-attributes.ts +8 -0
- package/src/schema/nodes/block-card.ts +121 -0
- package/src/schema/nodes/blockquote.ts +25 -0
- package/src/schema/nodes/bodied-extension.ts +75 -0
- package/src/schema/nodes/bullet-list.ts +17 -0
- package/src/schema/nodes/caption.ts +51 -0
- package/src/schema/nodes/code-block.ts +176 -0
- package/src/schema/nodes/confluence-jira-issue.ts +43 -0
- package/src/schema/nodes/confluence-unsupported-block.ts +29 -0
- package/src/schema/nodes/confluence-unsupported-inline.ts +30 -0
- package/src/schema/nodes/date.ts +38 -0
- package/src/schema/nodes/decision-item.ts +50 -0
- package/src/schema/nodes/decision-list.ts +56 -0
- package/src/schema/nodes/doc.ts +30 -0
- package/src/schema/nodes/embed-card.ts +62 -0
- package/src/schema/nodes/emoji.ts +89 -0
- package/src/schema/nodes/expand.ts +101 -0
- package/src/schema/nodes/extension.ts +60 -0
- package/src/schema/nodes/hard-break.ts +21 -0
- package/src/schema/nodes/heading.ts +64 -0
- package/src/schema/nodes/image.ts +32 -0
- package/src/schema/nodes/index.ts +184 -0
- package/src/schema/nodes/inline-card.ts +70 -0
- package/src/schema/nodes/inline-extension.ts +57 -0
- package/src/schema/nodes/layout-column.ts +68 -0
- package/src/schema/nodes/layout-section.ts +93 -0
- package/src/schema/nodes/list-item.ts +13 -0
- package/src/schema/nodes/media-group.ts +44 -0
- package/src/schema/nodes/media-inline.ts +19 -0
- package/src/schema/nodes/media-single.ts +179 -0
- package/src/schema/nodes/media.ts +249 -0
- package/src/schema/nodes/mention.ts +86 -0
- package/src/schema/nodes/nested-expand.ts +77 -0
- package/src/schema/nodes/ordered-list.ts +62 -0
- package/src/schema/nodes/panel.ts +133 -0
- package/src/schema/nodes/paragraph.ts +79 -0
- package/src/schema/nodes/placeholder.ts +40 -0
- package/src/schema/nodes/rule.ts +17 -0
- package/src/schema/nodes/status.ts +58 -0
- package/src/schema/nodes/tableNodes.ts +480 -0
- package/src/schema/nodes/task-item.ts +51 -0
- package/src/schema/nodes/task-list.ts +61 -0
- package/src/schema/nodes/text.ts +19 -0
- package/src/schema/nodes/types/block-content.ts +51 -0
- package/src/schema/nodes/types/extensions.ts +36 -0
- package/src/schema/nodes/types/inline-content.ts +56 -0
- package/src/schema/nodes/types/list.ts +54 -0
- package/src/schema/nodes/types/mark.ts +16 -0
- package/src/schema/nodes/types/non-nestable-block-content.ts +39 -0
- package/src/schema/nodes/types/rich-media-common.ts +51 -0
- package/src/schema/nodes/unknown-block.ts +13 -0
- package/src/schema/nodes/unsupported-block.ts +28 -0
- package/src/schema/nodes/unsupported-inline.ts +27 -0
- package/src/schema/unsupported.ts +4 -0
- package/src/steps/__tests__/unit/analytics.ts +72 -0
- package/src/steps/__tests__/unit/link-meta-step.ts +64 -0
- package/src/steps/__tests__/unit/override-document-step.ts +174 -0
- package/src/steps/__tests__/unit/set-attrs.ts +71 -0
- package/src/steps/analytics.ts +189 -0
- package/src/steps/link-meta-step.ts +105 -0
- package/src/steps/override-document-step.ts +97 -0
- package/src/steps/set-attrs.tsx +74 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +98 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +71 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +63 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +64 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +22 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +63 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +52 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +38 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +52 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +38 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +25 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +11 -0
- package/src/steps/table/__tests__/_utils.ts +103 -0
- package/src/steps/table/__tests__/add-column-merge-columns.ts +491 -0
- package/src/steps/table/__tests__/add-column-merge-rows.ts +450 -0
- package/src/steps/table/__tests__/add-column.ts +610 -0
- package/src/steps/table/add-column.ts +440 -0
- package/src/steps/table/constants.ts +4 -0
- package/src/steps/table/sort-column.ts +57 -0
- package/src/steps/table/types.ts +48 -0
- package/src/steps/table/utils/cell-step.ts +239 -0
- package/src/steps/table/utils/cells-at-column.ts +72 -0
- package/src/steps/table/utils/find-column.ts +90 -0
- package/src/steps/table/utils/get-table-rect-from-doc.ts +37 -0
- package/src/steps/table/utils/side-effects/rows.ts +327 -0
- package/src/steps/table/utils/side-effects/side-effects.ts +90 -0
- package/src/steps/table/utils/side-effects/table.ts +112 -0
- package/src/steps/table/utils/side-effects/types.ts +34 -0
- package/src/steps/table/utils/table-map.ts +28 -0
- package/src/steps/type-ahead.ts +100 -0
- package/src/steps.ts +16 -0
- package/src/utils/colors.ts +171 -0
- package/src/utils/confluence/emoji.ts +99 -0
- package/src/utils/extensions.ts +32 -0
- package/src/utils/index.ts +69 -0
- package/src/utils/parseDOM.ts +2 -0
- package/src/utils/url.ts +173 -0
- package/src/utils/uuid.ts +19 -0
- package/src/version.json +6 -0
- package/babel.config.js +0 -156
@@ -0,0 +1,388 @@
|
|
1
|
+
import {
|
2
|
+
media,
|
3
|
+
camelCaseToKebabCase,
|
4
|
+
defaultAttrs,
|
5
|
+
toJSON,
|
6
|
+
createMediaSpec,
|
7
|
+
} from '../../../../schema/nodes/media';
|
8
|
+
import { image as ImageNodeSpec } from '../../../../schema/nodes/image';
|
9
|
+
import {
|
10
|
+
fromHTML,
|
11
|
+
toDOM,
|
12
|
+
schema,
|
13
|
+
} from 'adf-test-helpers/src/adf-schema';
|
14
|
+
|
15
|
+
// Note: We can't use dom.dataset in jest until it's upgraded to use latest version
|
16
|
+
// of jsdom. In the meantime we can use this helper-method.
|
17
|
+
const getDataSet = (dom: HTMLElement) => {
|
18
|
+
return Object.keys({
|
19
|
+
...defaultAttrs,
|
20
|
+
fileName: '',
|
21
|
+
fileSize: '',
|
22
|
+
fileMimeType: '',
|
23
|
+
displayType: '',
|
24
|
+
url: '',
|
25
|
+
}).reduce<Record<string, any>>((accum, k) => {
|
26
|
+
const key = camelCaseToKebabCase(k).replace(/^__/, '');
|
27
|
+
const value = dom.getAttribute(`data-${key}`);
|
28
|
+
if (value) {
|
29
|
+
accum[k] = value;
|
30
|
+
}
|
31
|
+
|
32
|
+
return accum;
|
33
|
+
}, {});
|
34
|
+
};
|
35
|
+
const packageName = process.env._PACKAGE_NAME_ as string;
|
36
|
+
|
37
|
+
describe(`${packageName}/schema media node`, () => {
|
38
|
+
it('should parse html', () => {
|
39
|
+
const doc = fromHTML(
|
40
|
+
`
|
41
|
+
<div
|
42
|
+
data-node-type="media"
|
43
|
+
data-id="id"
|
44
|
+
data-type="file"
|
45
|
+
data-collection="collection"
|
46
|
+
data-file-name="file.jpg"
|
47
|
+
data-file-size="123456"
|
48
|
+
data-file-mime-type="image/jpeg"
|
49
|
+
/>
|
50
|
+
`,
|
51
|
+
schema,
|
52
|
+
);
|
53
|
+
const mediaGroup = doc.firstChild!;
|
54
|
+
const mediaNode = mediaGroup.firstChild!;
|
55
|
+
|
56
|
+
expect(mediaNode.type.spec).toEqual(media);
|
57
|
+
expect(mediaNode.attrs.id).toEqual('id');
|
58
|
+
expect(mediaNode.attrs.type).toEqual('file');
|
59
|
+
expect(mediaNode.attrs.collection).toEqual('collection');
|
60
|
+
expect(mediaNode.attrs.__fileName).toEqual('file.jpg');
|
61
|
+
expect(mediaNode.attrs.__fileSize).toEqual(123456);
|
62
|
+
expect(mediaNode.attrs.__fileMimeType).toEqual('image/jpeg');
|
63
|
+
expect(mediaNode.attrs.__displayType).toEqual(null);
|
64
|
+
});
|
65
|
+
|
66
|
+
it('should parse width/height as number', () => {
|
67
|
+
const doc = fromHTML(
|
68
|
+
`
|
69
|
+
<div
|
70
|
+
data-node-type="media"
|
71
|
+
data-width="456"
|
72
|
+
data-height="956"
|
73
|
+
/>
|
74
|
+
`,
|
75
|
+
schema,
|
76
|
+
);
|
77
|
+
const mediaGroup = doc.firstChild!;
|
78
|
+
const mediaNode = mediaGroup.firstChild!;
|
79
|
+
|
80
|
+
expect(mediaNode.attrs.width).toEqual(456);
|
81
|
+
expect(mediaNode.attrs.height).toEqual(956);
|
82
|
+
});
|
83
|
+
|
84
|
+
it('should parse html (with occurrenceKey)', () => {
|
85
|
+
const doc = fromHTML(
|
86
|
+
`
|
87
|
+
<div
|
88
|
+
data-node-type="media"
|
89
|
+
data-id="id"
|
90
|
+
data-type="file"
|
91
|
+
data-collection="collection"
|
92
|
+
data-occurrence-key="key"
|
93
|
+
/>
|
94
|
+
`,
|
95
|
+
schema,
|
96
|
+
);
|
97
|
+
const mediaGroup = doc.firstChild!;
|
98
|
+
const mediaNode = mediaGroup.firstChild!;
|
99
|
+
|
100
|
+
expect(mediaNode.type.spec).toEqual(media);
|
101
|
+
expect(mediaNode.attrs.id).toEqual('id');
|
102
|
+
expect(mediaNode.attrs.type).toEqual('file');
|
103
|
+
expect(mediaNode.attrs.collection).toEqual('collection');
|
104
|
+
expect(mediaNode.attrs.occurrenceKey).toEqual('key');
|
105
|
+
});
|
106
|
+
|
107
|
+
it('should encode to html', () => {
|
108
|
+
const mediaNode = schema.nodes.media.create({
|
109
|
+
id: 'id',
|
110
|
+
type: 'file',
|
111
|
+
collection: 'collection',
|
112
|
+
__fileName: 'file.jpg',
|
113
|
+
__fileSize: 123456,
|
114
|
+
__fileMimeType: 'image/jpeg',
|
115
|
+
__displayType: 'thumbnail',
|
116
|
+
});
|
117
|
+
|
118
|
+
const domNode = toDOM(mediaNode, schema).firstChild as HTMLElement;
|
119
|
+
const {
|
120
|
+
id,
|
121
|
+
type,
|
122
|
+
collection,
|
123
|
+
occurrenceKey,
|
124
|
+
fileName,
|
125
|
+
fileSize,
|
126
|
+
fileMimeType,
|
127
|
+
displayType,
|
128
|
+
} = getDataSet(domNode);
|
129
|
+
|
130
|
+
expect(id).toEqual('id');
|
131
|
+
expect(type).toEqual('file');
|
132
|
+
expect(collection).toEqual('collection');
|
133
|
+
expect(occurrenceKey).toEqual(undefined);
|
134
|
+
expect(fileName).toEqual('file.jpg');
|
135
|
+
expect(fileSize).toEqual('123456');
|
136
|
+
expect(fileMimeType).toEqual('image/jpeg');
|
137
|
+
expect(displayType).toEqual('thumbnail');
|
138
|
+
});
|
139
|
+
|
140
|
+
it('should encode to html (with occurrenceKey)', () => {
|
141
|
+
const mediaNode = schema.nodes.media.create({
|
142
|
+
id: 'id',
|
143
|
+
type: 'file',
|
144
|
+
collection: 'collection',
|
145
|
+
occurrenceKey: 'key',
|
146
|
+
});
|
147
|
+
|
148
|
+
const domNode = toDOM(mediaNode, schema).firstChild as HTMLElement;
|
149
|
+
const { id, type, collection, occurrenceKey } = getDataSet(domNode);
|
150
|
+
expect(id).toEqual('id');
|
151
|
+
expect(type).toEqual('file');
|
152
|
+
expect(collection).toEqual('collection');
|
153
|
+
expect(occurrenceKey).toEqual('key');
|
154
|
+
});
|
155
|
+
|
156
|
+
it('should strip optional attrs during JSON serialization', () => {
|
157
|
+
const mediaNode = schema.nodes.media.create({
|
158
|
+
id: 'id',
|
159
|
+
type: 'file',
|
160
|
+
collection: 'collection',
|
161
|
+
__fileName: 'file.jpg',
|
162
|
+
__fileSize: 123456,
|
163
|
+
__fileMimeType: 'image/jpeg',
|
164
|
+
__displayType: 'thumbnail',
|
165
|
+
});
|
166
|
+
|
167
|
+
expect(toJSON(mediaNode)).toEqual({
|
168
|
+
attrs: {
|
169
|
+
collection: 'collection',
|
170
|
+
id: 'id',
|
171
|
+
type: 'file',
|
172
|
+
},
|
173
|
+
});
|
174
|
+
});
|
175
|
+
|
176
|
+
it('should strip optional attrs during JSON serialization for inline media', () => {
|
177
|
+
const mediaInlineNode = schema.nodes.mediaInline.create({
|
178
|
+
id: 'id',
|
179
|
+
type: 'file',
|
180
|
+
collection: 'collection',
|
181
|
+
alt: '',
|
182
|
+
__fileName: 'file.jpg',
|
183
|
+
__fileSize: 123456,
|
184
|
+
__fileMimeType: 'image/jpeg',
|
185
|
+
__displayType: 'thumbnail',
|
186
|
+
});
|
187
|
+
|
188
|
+
expect(toJSON(mediaInlineNode)).toEqual({
|
189
|
+
attrs: {
|
190
|
+
collection: 'collection',
|
191
|
+
id: 'id',
|
192
|
+
type: 'file',
|
193
|
+
},
|
194
|
+
});
|
195
|
+
});
|
196
|
+
|
197
|
+
describe.each<['alt' | 'occurrenceKey']>([['alt'], ['occurrenceKey']])(
|
198
|
+
'%s attribute',
|
199
|
+
(attributeKey: string) => {
|
200
|
+
let mediaNodeConfig: { [key: string]: any };
|
201
|
+
beforeEach(() => {
|
202
|
+
mediaNodeConfig = {
|
203
|
+
id: 'id',
|
204
|
+
type: 'file',
|
205
|
+
collection: 'collection',
|
206
|
+
};
|
207
|
+
});
|
208
|
+
|
209
|
+
it(`should serialize ${attributeKey} when available`, () => {
|
210
|
+
mediaNodeConfig[attributeKey] = 'key_value';
|
211
|
+
const mediaNode = schema.nodes.media.create(mediaNodeConfig);
|
212
|
+
|
213
|
+
const expectedObj: any = {
|
214
|
+
attrs: {
|
215
|
+
collection: 'collection',
|
216
|
+
id: 'id',
|
217
|
+
type: 'file',
|
218
|
+
},
|
219
|
+
};
|
220
|
+
expectedObj.attrs[attributeKey] = 'key_value';
|
221
|
+
|
222
|
+
expect(toJSON(mediaNode)).toEqual(expectedObj);
|
223
|
+
});
|
224
|
+
|
225
|
+
it(`should not serialize optional ${attributeKey} with null value`, () => {
|
226
|
+
mediaNodeConfig[attributeKey] = null;
|
227
|
+
const mediaNode = schema.nodes.media.create(mediaNodeConfig);
|
228
|
+
|
229
|
+
expect(toJSON(mediaNode)).toEqual({
|
230
|
+
attrs: {
|
231
|
+
collection: 'collection',
|
232
|
+
id: 'id',
|
233
|
+
type: 'file',
|
234
|
+
},
|
235
|
+
});
|
236
|
+
});
|
237
|
+
|
238
|
+
it(`should not serialize optional ${attributeKey} with empty string`, () => {
|
239
|
+
mediaNodeConfig[attributeKey] = '';
|
240
|
+
const mediaNode = schema.nodes.media.create(mediaNodeConfig);
|
241
|
+
|
242
|
+
expect(toJSON(mediaNode)).toEqual({
|
243
|
+
attrs: {
|
244
|
+
collection: 'collection',
|
245
|
+
id: 'id',
|
246
|
+
type: 'file',
|
247
|
+
},
|
248
|
+
});
|
249
|
+
});
|
250
|
+
},
|
251
|
+
);
|
252
|
+
|
253
|
+
it('should serialize optional number keys with value 0', () => {
|
254
|
+
const mediaNode = schema.nodes.media.create({
|
255
|
+
id: 'id',
|
256
|
+
type: 'file',
|
257
|
+
collection: 'collection',
|
258
|
+
width: 0,
|
259
|
+
});
|
260
|
+
|
261
|
+
expect(toJSON(mediaNode)).toEqual({
|
262
|
+
attrs: {
|
263
|
+
collection: 'collection',
|
264
|
+
id: 'id',
|
265
|
+
type: 'file',
|
266
|
+
width: 0,
|
267
|
+
},
|
268
|
+
});
|
269
|
+
});
|
270
|
+
|
271
|
+
it('should serialize width/height as number', () => {
|
272
|
+
const mediaNode = schema.nodes.media.create({
|
273
|
+
id: 'id',
|
274
|
+
type: 'file',
|
275
|
+
collection: 'collection',
|
276
|
+
width: '100',
|
277
|
+
height: '150',
|
278
|
+
});
|
279
|
+
|
280
|
+
expect(toJSON(mediaNode)).toEqual({
|
281
|
+
attrs: {
|
282
|
+
collection: 'collection',
|
283
|
+
id: 'id',
|
284
|
+
type: 'file',
|
285
|
+
width: 100,
|
286
|
+
height: 150,
|
287
|
+
},
|
288
|
+
});
|
289
|
+
});
|
290
|
+
|
291
|
+
describe('external images', () => {
|
292
|
+
it('should parse html for external images', () => {
|
293
|
+
const doc = fromHTML(
|
294
|
+
`
|
295
|
+
<div
|
296
|
+
data-node-type="media"
|
297
|
+
data-type="external"
|
298
|
+
data-url="http://image.jpg"
|
299
|
+
/>
|
300
|
+
`,
|
301
|
+
schema,
|
302
|
+
);
|
303
|
+
const mediaGroup = doc.firstChild!;
|
304
|
+
const mediaNode = mediaGroup.firstChild!;
|
305
|
+
|
306
|
+
expect(mediaNode.type.spec).toEqual(media);
|
307
|
+
expect(mediaNode.attrs.type).toEqual('external');
|
308
|
+
expect(mediaNode.attrs.url).toEqual('http://image.jpg');
|
309
|
+
});
|
310
|
+
|
311
|
+
it('should encode to html', () => {
|
312
|
+
const mediaNode = schema.nodes.media.create({
|
313
|
+
type: 'external',
|
314
|
+
alt: 'alt text',
|
315
|
+
url: 'http://image.jpg',
|
316
|
+
});
|
317
|
+
|
318
|
+
const domNode = toDOM(mediaNode, schema).firstChild as HTMLElement;
|
319
|
+
const { type, url, alt } = getDataSet(domNode);
|
320
|
+
expect(type).toEqual('external');
|
321
|
+
expect(alt).toEqual('alt text');
|
322
|
+
expect(url).toEqual('http://image.jpg');
|
323
|
+
});
|
324
|
+
|
325
|
+
it('should strip optional attrs during JSON serialization', () => {
|
326
|
+
const mediaNode = schema.nodes.media.create({
|
327
|
+
type: 'external',
|
328
|
+
url: 'http://image.jpg',
|
329
|
+
alt: 'alt text',
|
330
|
+
});
|
331
|
+
|
332
|
+
expect(toJSON(mediaNode)).toEqual({
|
333
|
+
attrs: {
|
334
|
+
type: 'external',
|
335
|
+
alt: 'alt text',
|
336
|
+
url: 'http://image.jpg',
|
337
|
+
},
|
338
|
+
});
|
339
|
+
});
|
340
|
+
|
341
|
+
it('should parse html for images with alt text', () => {
|
342
|
+
const doc = fromHTML(
|
343
|
+
`<img src="https://image.jpg" alt="Summer Rolls are the best" />`,
|
344
|
+
schema,
|
345
|
+
);
|
346
|
+
const paragraph = doc.firstChild!;
|
347
|
+
const imageNode = paragraph.firstChild!;
|
348
|
+
|
349
|
+
expect(imageNode.type.spec).toEqual(ImageNodeSpec);
|
350
|
+
expect(imageNode.attrs.src).toEqual('https://image.jpg');
|
351
|
+
expect(imageNode.attrs.alt).toEqual('Summer Rolls are the best');
|
352
|
+
});
|
353
|
+
|
354
|
+
it('should parse html for images without alt text', () => {
|
355
|
+
const doc = fromHTML(`<img src="https://no.ch/ocolate.jpg" />`, schema);
|
356
|
+
const paragraph = doc.firstChild!;
|
357
|
+
const imageNode = paragraph.firstChild!;
|
358
|
+
|
359
|
+
expect(imageNode.type.spec).toEqual(ImageNodeSpec);
|
360
|
+
expect(imageNode.attrs.src).toEqual('https://no.ch/ocolate.jpg');
|
361
|
+
expect(imageNode.attrs.alt).toEqual(null);
|
362
|
+
});
|
363
|
+
});
|
364
|
+
|
365
|
+
describe('createMediaSpec', () => {
|
366
|
+
it('should return a media node spec supporting attributes provided', () => {
|
367
|
+
const el = document.createElement('div');
|
368
|
+
el.setAttribute('data-foo', 'test');
|
369
|
+
|
370
|
+
const attributes = {
|
371
|
+
...defaultAttrs,
|
372
|
+
foo: 'test',
|
373
|
+
} as any;
|
374
|
+
|
375
|
+
const mediaNodeSpec = createMediaSpec(attributes);
|
376
|
+
expect(mediaNodeSpec.attrs).toBe(attributes);
|
377
|
+
|
378
|
+
const parseRule =
|
379
|
+
mediaNodeSpec.parseDOM &&
|
380
|
+
mediaNodeSpec.parseDOM.find(({ tag }) => 'div[data-node-type="media"]');
|
381
|
+
expect(parseRule && parseRule.getAttrs && parseRule.getAttrs(el)).toEqual(
|
382
|
+
{
|
383
|
+
foo: 'test',
|
384
|
+
},
|
385
|
+
);
|
386
|
+
});
|
387
|
+
});
|
388
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import { createSchema } from '../../../../schema/create-schema';
|
2
|
+
import {
|
3
|
+
toHTML,
|
4
|
+
fromHTML as fromHTML_,
|
5
|
+
} from 'adf-test-helpers/src/adf-schema/html-helpers';
|
6
|
+
|
7
|
+
const schema = makeSchema();
|
8
|
+
const fromHTML = (html: string) => fromHTML_(html, schema);
|
9
|
+
const packageName = process.env._PACKAGE_NAME_ as string;
|
10
|
+
|
11
|
+
describe(`${packageName}/schema mention node`, () => {
|
12
|
+
it('should have mention id and display name when serializing to DOM', () => {
|
13
|
+
const html = toHTML(
|
14
|
+
schema.nodes.mention.create({ id: '@bar', text: 'foo bar' }),
|
15
|
+
schema,
|
16
|
+
);
|
17
|
+
expect(html).toContain('data-mention-id="@bar"');
|
18
|
+
expect(html).toContain('contenteditable="false"');
|
19
|
+
expect(html).toContain('foo bar');
|
20
|
+
});
|
21
|
+
|
22
|
+
it('should extract the correct values of mention id and display name', () => {
|
23
|
+
const doc = fromHTML("<span data-mention-id='@user-1'>foo bar</span>");
|
24
|
+
const mention = doc.firstChild!.firstChild!;
|
25
|
+
|
26
|
+
expect(mention.type.name).toEqual('mention');
|
27
|
+
expect(mention.attrs.id).toEqual('@user-1');
|
28
|
+
expect(mention.attrs.text).toEqual('foo bar');
|
29
|
+
});
|
30
|
+
|
31
|
+
it('should ignore if userType is DEFAULT', () => {
|
32
|
+
const html = toHTML(
|
33
|
+
schema.nodes.mention.create({
|
34
|
+
id: 'id-foo-bar',
|
35
|
+
text: '@foo bar',
|
36
|
+
userType: 'DEFAULT',
|
37
|
+
}),
|
38
|
+
schema,
|
39
|
+
);
|
40
|
+
expect(html).toContain('data-mention-id="id-foo-bar"');
|
41
|
+
expect(html).toContain('contenteditable="false"');
|
42
|
+
expect(html).toContain('data-user-type="DEFAULT"');
|
43
|
+
expect(html).toContain('@foo bar');
|
44
|
+
});
|
45
|
+
|
46
|
+
it('should have userType if it is SPECIAL', () => {
|
47
|
+
const html = toHTML(
|
48
|
+
schema.nodes.mention.create({
|
49
|
+
id: 'id-rick',
|
50
|
+
text: '@rick',
|
51
|
+
userType: 'SPECIAL',
|
52
|
+
}),
|
53
|
+
schema,
|
54
|
+
);
|
55
|
+
expect(html).toContain('data-mention-id="id-rick"');
|
56
|
+
expect(html).toContain('data-user-type="SPECIAL"');
|
57
|
+
expect(html).toContain('@rick');
|
58
|
+
});
|
59
|
+
|
60
|
+
it('should have userType if it is APP', () => {
|
61
|
+
const html = toHTML(
|
62
|
+
schema.nodes.mention.create({
|
63
|
+
id: 'id-coffee',
|
64
|
+
text: '@coffee',
|
65
|
+
userType: 'APP',
|
66
|
+
}),
|
67
|
+
schema,
|
68
|
+
);
|
69
|
+
expect(html).toContain('data-mention-id="id-coffee"');
|
70
|
+
expect(html).toContain('data-user-type="APP"');
|
71
|
+
expect(html).toContain('@coffee');
|
72
|
+
});
|
73
|
+
|
74
|
+
it('should extract the valid userTypes - SPECIAL', () => {
|
75
|
+
const doc = fromHTML(
|
76
|
+
'<span data-mention-id="id-rick" data-user-type="SPECIAL">@Rick Sanchez</span>',
|
77
|
+
);
|
78
|
+
const mention = doc.firstChild!.firstChild!;
|
79
|
+
|
80
|
+
expect(mention.type.name).toEqual('mention');
|
81
|
+
expect(mention.attrs.id).toEqual('id-rick');
|
82
|
+
expect(mention.attrs.text).toEqual('@Rick Sanchez');
|
83
|
+
expect(mention.attrs.userType).toEqual('SPECIAL');
|
84
|
+
});
|
85
|
+
|
86
|
+
it('should extract the valid userTypes - APP', () => {
|
87
|
+
const doc = fromHTML(
|
88
|
+
'<span data-mention-id="id-coffee" data-user-type="APP">@coffee</span>',
|
89
|
+
);
|
90
|
+
const mention = doc.firstChild!.firstChild!;
|
91
|
+
|
92
|
+
expect(mention.type.name).toEqual('mention');
|
93
|
+
expect(mention.attrs.id).toEqual('id-coffee');
|
94
|
+
expect(mention.attrs.text).toEqual('@coffee');
|
95
|
+
expect(mention.attrs.userType).toEqual('APP');
|
96
|
+
});
|
97
|
+
|
98
|
+
it('should not extract invalid value of userType', () => {
|
99
|
+
const doc = fromHTML(
|
100
|
+
'<span data-mention-id="id-morty" data-user-type="SIDEKICK">@Morty Smith</span>',
|
101
|
+
);
|
102
|
+
const mention = doc.firstChild!.firstChild!;
|
103
|
+
|
104
|
+
expect(mention.type.name).toEqual('mention');
|
105
|
+
expect(mention.attrs.id).toEqual('id-morty');
|
106
|
+
expect(mention.attrs.text).toEqual('@Morty Smith');
|
107
|
+
expect(mention.attrs.userType).toEqual(null);
|
108
|
+
});
|
109
|
+
});
|
110
|
+
|
111
|
+
function makeSchema() {
|
112
|
+
return createSchema({
|
113
|
+
nodes: ['doc', 'paragraph', 'text', 'mention'],
|
114
|
+
});
|
115
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
|
+
import { nestedExpand } from '../../../..';
|
3
|
+
import { Schema, Node } from '@atlaskit/editor-prosemirror/model';
|
4
|
+
import { schema } from 'adf-test-helpers/src/adf-schema'
|
5
|
+
|
6
|
+
const findNestedExpand = (doc: Node, schema: Schema) => {
|
7
|
+
let expand: Node | null = null;
|
8
|
+
doc.nodesBetween(0, doc.nodeSize - 2, (node) => {
|
9
|
+
if (!expand && node.type === schema.nodes.nestedExpand) {
|
10
|
+
expand = node;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
return expand as Node | null;
|
15
|
+
};
|
16
|
+
const packageName = process.env._PACKAGE_NAME_ as string;
|
17
|
+
|
18
|
+
describe(`${packageName}/schema nestedExpand node`, () => {
|
19
|
+
describe('parse html', () => {
|
20
|
+
it('converts to PM node', () => {
|
21
|
+
const doc = fromHTML('<div data-node-type="nestedExpand" />', schema);
|
22
|
+
const node = findNestedExpand(doc, schema)!;
|
23
|
+
expect(node.type.spec).toEqual(nestedExpand);
|
24
|
+
});
|
25
|
+
|
26
|
+
it('gets attributes from html', () => {
|
27
|
+
const title = 'Homer Simpson';
|
28
|
+
const doc = fromHTML(
|
29
|
+
`
|
30
|
+
<div
|
31
|
+
data-node-type="nestedExpand"
|
32
|
+
data-title="${title}"
|
33
|
+
><p>hello</p></div>
|
34
|
+
`,
|
35
|
+
schema,
|
36
|
+
);
|
37
|
+
|
38
|
+
const node = findNestedExpand(doc, schema)!;
|
39
|
+
expect(node.attrs.title).toEqual(title);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
describe('encode html', () => {
|
44
|
+
it('converts html data attributes to node attributes', () => {
|
45
|
+
const title = 'Homer Simpson';
|
46
|
+
const content = schema.nodes.paragraph.create(schema.text('hello'));
|
47
|
+
const node = schema.nodes.nestedExpand.create({ title }, content);
|
48
|
+
const dom = toDOM(node, schema).firstChild as HTMLElement;
|
49
|
+
|
50
|
+
expect(dom.getAttribute('data-node-type')).toEqual('nestedExpand');
|
51
|
+
expect(dom.getAttribute('data-title')).toEqual(title);
|
52
|
+
});
|
53
|
+
|
54
|
+
it('encodes and decodes to the same node', () => {
|
55
|
+
const { paragraph, nestedExpand, table, tableRow, tableCell } =
|
56
|
+
schema.nodes;
|
57
|
+
|
58
|
+
const title = 'Homer Simpson';
|
59
|
+
const content = paragraph.create(schema.text('hello'));
|
60
|
+
const node = nestedExpand.create({ title }, content);
|
61
|
+
|
62
|
+
// We must create a table wrapper since nestedExpands are only allow inside tables.
|
63
|
+
const cell = tableCell.createChecked(undefined, node);
|
64
|
+
const row = tableRow.createChecked(undefined, cell);
|
65
|
+
const tableWrapper = table.createChecked(undefined, row);
|
66
|
+
|
67
|
+
const dom = toDOM(node, schema).firstChild as HTMLElement;
|
68
|
+
const parsedNode = fromHTML(dom.outerHTML, schema).firstChild!;
|
69
|
+
expect(parsedNode).toEqual(tableWrapper);
|
70
|
+
});
|
71
|
+
});
|
72
|
+
});
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
|
+
import { schema } from 'adf-test-helpers/src/adf-schema'
|
3
|
+
const packageName = process.env._PACKAGE_NAME_ as string;
|
4
|
+
|
5
|
+
describe(`${packageName}/schema orderedList node`, () => {
|
6
|
+
it('should be possible to create an ordered list item with an order attribute', () => {
|
7
|
+
const html = toHTML(
|
8
|
+
schema.nodes.orderedList.create(
|
9
|
+
{ order: 6 },
|
10
|
+
schema.nodes.listItem.create({}, schema.nodes.paragraph.create()),
|
11
|
+
),
|
12
|
+
schema,
|
13
|
+
);
|
14
|
+
expect(html).toContain('<ol start="6" class="ak-ol"><li><p></p></li></ol>');
|
15
|
+
});
|
16
|
+
|
17
|
+
it('should not be possible to have an ordered list starting from a negative number', () => {
|
18
|
+
const html = toHTML(
|
19
|
+
schema.nodes.orderedList.create(
|
20
|
+
{ order: -6 },
|
21
|
+
schema.nodes.listItem.create({}, schema.nodes.paragraph.create()),
|
22
|
+
),
|
23
|
+
schema,
|
24
|
+
);
|
25
|
+
expect(html).toContain('<ol class="ak-ol"><li><p></p></li></ol>');
|
26
|
+
});
|
27
|
+
|
28
|
+
it('should not be possible to have an ordered list with order of a string', () => {
|
29
|
+
const html = toHTML(
|
30
|
+
schema.nodes.orderedList.create(
|
31
|
+
{ order: 'string' },
|
32
|
+
schema.nodes.listItem.create({}, schema.nodes.paragraph.create()),
|
33
|
+
),
|
34
|
+
schema,
|
35
|
+
);
|
36
|
+
expect(html).toContain('<ol class="ak-ol"><li><p></p></li></ol>');
|
37
|
+
});
|
38
|
+
|
39
|
+
it('should not be possible to have an ordered list with order of a decimal number', () => {
|
40
|
+
const html = toHTML(
|
41
|
+
schema.nodes.orderedList.create(
|
42
|
+
{ order: 2.9 },
|
43
|
+
schema.nodes.listItem.create({}, schema.nodes.paragraph.create()),
|
44
|
+
),
|
45
|
+
schema,
|
46
|
+
);
|
47
|
+
expect(html).toContain('<ol start="2" class="ak-ol"><li><p></p></li></ol>');
|
48
|
+
});
|
49
|
+
});
|