@atlaskit/renderer 105.1.0 → 105.1.2
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 +12 -0
- package/dist/cjs/actions/index.js +19 -71
- package/dist/cjs/actions/matches-utils.js +10 -11
- package/dist/cjs/actions.js +0 -2
- package/dist/cjs/analytics/analyticsContext.js +0 -4
- package/dist/cjs/analytics/events.js +0 -5
- package/dist/cjs/analytics/unsupported-content.js +14 -27
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +0 -1
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +0 -1
- package/dist/cjs/i18n/en_GB.js +0 -1
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -26
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/messages.js +0 -2
- package/dist/cjs/react/hooks/use-bidi-warnings.js +2 -12
- package/dist/cjs/react/hooks/use-in-viewport.js +4 -17
- package/dist/cjs/react/hooks/use-observed-width.js +20 -35
- package/dist/cjs/react/index.js +27 -114
- package/dist/cjs/react/marks/alignment.js +0 -9
- package/dist/cjs/react/marks/annotation.js +6 -21
- package/dist/cjs/react/marks/breakout.js +0 -9
- package/dist/cjs/react/marks/code.js +0 -11
- package/dist/cjs/react/marks/confluence-inline-comment.js +2 -19
- package/dist/cjs/react/marks/data-consumer.js +0 -4
- package/dist/cjs/react/marks/em.js +0 -3
- package/dist/cjs/react/marks/fragment.js +0 -4
- package/dist/cjs/react/marks/indentation.js +0 -3
- package/dist/cjs/react/marks/index.js +1 -24
- package/dist/cjs/react/marks/link.js +5 -25
- package/dist/cjs/react/marks/strike.js +0 -4
- package/dist/cjs/react/marks/strong.js +0 -3
- package/dist/cjs/react/marks/subsup.js +0 -5
- package/dist/cjs/react/marks/textColor.js +0 -9
- package/dist/cjs/react/marks/underline.js +0 -3
- package/dist/cjs/react/marks/unsupportedMark.js +0 -3
- package/dist/cjs/react/marks/unsupportedNodeAttribute.js +0 -3
- package/dist/cjs/react/nodes/blockCard.js +4 -16
- package/dist/cjs/react/nodes/blockquote.js +0 -3
- package/dist/cjs/react/nodes/bodiedExtension.js +6 -17
- package/dist/cjs/react/nodes/bulletList.js +0 -5
- package/dist/cjs/react/nodes/caption.js +1 -6
- package/dist/cjs/react/nodes/codeBlock/codeBlock.js +5 -14
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -16
- package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -23
- package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +9 -32
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +7 -31
- package/dist/cjs/react/nodes/date.js +5 -33
- package/dist/cjs/react/nodes/decisionItem.js +1 -5
- package/dist/cjs/react/nodes/decisionList.js +0 -20
- package/dist/cjs/react/nodes/doc.js +0 -6
- package/dist/cjs/react/nodes/embedCard.js +25 -54
- package/dist/cjs/react/nodes/emoji.js +6 -24
- package/dist/cjs/react/nodes/extension.js +12 -26
- package/dist/cjs/react/nodes/fallback.js +2 -24
- package/dist/cjs/react/nodes/hardBreak.js +1 -7
- package/dist/cjs/react/nodes/heading-anchor.js +1 -46
- package/dist/cjs/react/nodes/heading.js +4 -17
- package/dist/cjs/react/nodes/index.js +7 -62
- package/dist/cjs/react/nodes/inline.js +0 -6
- package/dist/cjs/react/nodes/inlineCard.js +6 -23
- package/dist/cjs/react/nodes/inlineExtension.js +2 -10
- package/dist/cjs/react/nodes/layoutColumn.js +0 -8
- package/dist/cjs/react/nodes/layoutSection.js +0 -3
- package/dist/cjs/react/nodes/listItem.js +0 -3
- package/dist/cjs/react/nodes/media.js +10 -49
- package/dist/cjs/react/nodes/mediaGroup.js +6 -47
- package/dist/cjs/react/nodes/mediaInline.js +7 -37
- package/dist/cjs/react/nodes/mediaSingle/index.js +38 -85
- package/dist/cjs/react/nodes/mediaSingle/styles.js +0 -5
- package/dist/cjs/react/nodes/mention.js +5 -23
- package/dist/cjs/react/nodes/orderedList.js +0 -14
- package/dist/cjs/react/nodes/panel.js +10 -38
- package/dist/cjs/react/nodes/paragraph.js +1 -5
- package/dist/cjs/react/nodes/placeholder.js +0 -4
- package/dist/cjs/react/nodes/rule.js +0 -3
- package/dist/cjs/react/nodes/status.js +3 -22
- package/dist/cjs/react/nodes/table/colgroup.js +12 -26
- package/dist/cjs/react/nodes/table/sticky.js +17 -47
- package/dist/cjs/react/nodes/table/table.js +5 -10
- package/dist/cjs/react/nodes/table.js +19 -102
- package/dist/cjs/react/nodes/tableCell.js +26 -79
- package/dist/cjs/react/nodes/tableRow.js +4 -33
- package/dist/cjs/react/nodes/task-item-with-providers.js +4 -40
- package/dist/cjs/react/nodes/taskItem.js +8 -36
- package/dist/cjs/react/nodes/taskList.js +2 -22
- package/dist/cjs/react/nodes/text-wrapper.js +1 -8
- package/dist/cjs/react/nodes/unknownBlock.js +0 -3
- package/dist/cjs/react/renderer-node.js +0 -6
- package/dist/cjs/react/utils/clipboard.js +0 -3
- package/dist/cjs/react/utils/element-selection.js +0 -13
- package/dist/cjs/react/utils/getCardClickHandler.js +0 -3
- package/dist/cjs/react/utils/inject-props.js +4 -9
- package/dist/cjs/react/utils/links.js +2 -6
- package/dist/cjs/react/utils/lists.js +0 -1
- package/dist/cjs/react/utils/performance/RenderTracking.js +2 -10
- package/dist/cjs/react/utils/use-select-all-trap.js +1 -23
- package/dist/cjs/render-document.js +42 -83
- package/dist/cjs/renderer-context.js +0 -5
- package/dist/cjs/steps/index.js +7 -39
- package/dist/cjs/text/index.js +0 -9
- package/dist/cjs/text/nodes/blockquote.js +0 -3
- package/dist/cjs/text/nodes/bulletList.js +0 -3
- package/dist/cjs/text/nodes/date.js +0 -4
- package/dist/cjs/text/nodes/decisionItem.js +0 -5
- package/dist/cjs/text/nodes/hardBreak.js +0 -2
- package/dist/cjs/text/nodes/heading.js +0 -3
- package/dist/cjs/text/nodes/index.js +0 -21
- package/dist/cjs/text/nodes/inlineCard.js +0 -4
- package/dist/cjs/text/nodes/listItem.js +0 -3
- package/dist/cjs/text/nodes/mediaGroup.js +0 -4
- package/dist/cjs/text/nodes/mention.js +0 -3
- package/dist/cjs/text/nodes/orderedList.js +0 -4
- package/dist/cjs/text/nodes/panel.js +0 -3
- package/dist/cjs/text/nodes/paragraph.js +0 -5
- package/dist/cjs/text/nodes/rule.js +0 -2
- package/dist/cjs/text/nodes/status.js +0 -3
- package/dist/cjs/text/nodes/table.js +0 -5
- package/dist/cjs/text/nodes/taskItem.js +0 -5
- package/dist/cjs/text/nodes/unknown.js +0 -6
- package/dist/cjs/text-serializer.js +0 -2
- package/dist/cjs/ui/Expand.js +15 -59
- package/dist/cjs/ui/ExtensionRenderer.js +10 -43
- package/dist/cjs/ui/MediaCard.js +40 -116
- package/dist/cjs/ui/Renderer/ErrorBoundary.js +0 -26
- package/dist/cjs/ui/Renderer/breakout-ssr.js +6 -32
- package/dist/cjs/ui/Renderer/click-to-edit.js +0 -6
- package/dist/cjs/ui/Renderer/index.js +47 -149
- package/dist/cjs/ui/Renderer/style.js +1 -39
- package/dist/cjs/ui/Renderer/truncated-wrapper.js +12 -30
- package/dist/cjs/ui/RendererActionsContext/WithRendererActions.js +0 -4
- package/dist/cjs/ui/RendererActionsContext/index.js +1 -11
- package/dist/cjs/ui/SmartCardStorage.js +0 -20
- package/dist/cjs/ui/SortingIcon.js +10 -40
- package/dist/cjs/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -11
- package/dist/cjs/ui/TaskItemsFormatContext/index.js +0 -1
- package/dist/cjs/ui/active-header-id-provider.js +6 -19
- package/dist/cjs/ui/annotations/context.js +0 -24
- package/dist/cjs/ui/annotations/draft/component.js +5 -42
- package/dist/cjs/ui/annotations/draft/dom.js +3 -17
- package/dist/cjs/ui/annotations/draft/index.js +0 -2
- package/dist/cjs/ui/annotations/draft/position.js +1 -12
- package/dist/cjs/ui/annotations/draft/text.js +2 -8
- package/dist/cjs/ui/annotations/element/index.js +4 -16
- package/dist/cjs/ui/annotations/element/mark.js +8 -26
- package/dist/cjs/ui/annotations/hooks/index.js +0 -3
- package/dist/cjs/ui/annotations/hooks/use-events.js +13 -45
- package/dist/cjs/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -6
- package/dist/cjs/ui/annotations/hooks/use-inline-comments-filter.js +1 -8
- package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -19
- package/dist/cjs/ui/annotations/hooks/user-selection.js +3 -18
- package/dist/cjs/ui/annotations/hooks/utils.js +0 -2
- package/dist/cjs/ui/annotations/index.js +4 -20
- package/dist/cjs/ui/annotations/selection/index.js +0 -1
- package/dist/cjs/ui/annotations/selection/mounter.js +13 -42
- package/dist/cjs/ui/annotations/selection/range-validator.js +9 -23
- package/dist/cjs/ui/annotations/selection/wrapper.js +3 -13
- package/dist/cjs/ui/annotations/types.js +0 -1
- package/dist/cjs/ui/annotations/view/index.js +1 -12
- package/dist/cjs/ui/index.js +0 -2
- package/dist/cjs/use-feature-flags.js +0 -4
- package/dist/cjs/utils.js +1 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +6 -50
- package/dist/es2019/actions/matches-utils.js +10 -9
- package/dist/es2019/actions.js +2 -1
- package/dist/es2019/analytics/events.js +0 -5
- package/dist/es2019/analytics/unsupported-content.js +8 -14
- package/dist/es2019/react/hooks/use-bidi-warnings.js +0 -2
- package/dist/es2019/react/hooks/use-in-viewport.js +0 -1
- package/dist/es2019/react/hooks/use-observed-width.js +0 -2
- package/dist/es2019/react/index.js +44 -119
- package/dist/es2019/react/marks/alignment.js +0 -3
- package/dist/es2019/react/marks/annotation.js +2 -5
- package/dist/es2019/react/marks/confluence-inline-comment.js +0 -1
- package/dist/es2019/react/marks/index.js +2 -1
- package/dist/es2019/react/marks/link.js +0 -6
- package/dist/es2019/react/marks/subsup.js +0 -3
- package/dist/es2019/react/nodes/bodiedExtension.js +2 -5
- package/dist/es2019/react/nodes/caption.js +0 -2
- package/dist/es2019/react/nodes/codeBlock/codeBlock.js +0 -2
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +1 -3
- package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +1 -6
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -4
- package/dist/es2019/react/nodes/date.js +0 -7
- package/dist/es2019/react/nodes/decisionList.js +0 -3
- package/dist/es2019/react/nodes/embedCard.js +8 -16
- package/dist/es2019/react/nodes/emoji.js +0 -1
- package/dist/es2019/react/nodes/extension.js +4 -6
- package/dist/es2019/react/nodes/fallback.js +0 -8
- package/dist/es2019/react/nodes/hardBreak.js +0 -3
- package/dist/es2019/react/nodes/heading-anchor.js +0 -15
- package/dist/es2019/react/nodes/heading.js +0 -6
- package/dist/es2019/react/nodes/index.js +28 -61
- package/dist/es2019/react/nodes/inline.js +0 -2
- package/dist/es2019/react/nodes/inlineCard.js +0 -5
- package/dist/es2019/react/nodes/inlineExtension.js +2 -5
- package/dist/es2019/react/nodes/media.js +0 -10
- package/dist/es2019/react/nodes/mediaGroup.js +2 -22
- package/dist/es2019/react/nodes/mediaInline.js +1 -8
- package/dist/es2019/react/nodes/mediaSingle/index.js +8 -29
- package/dist/es2019/react/nodes/mention.js +0 -1
- package/dist/es2019/react/nodes/orderedList.js +0 -5
- package/dist/es2019/react/nodes/panel.js +4 -17
- package/dist/es2019/react/nodes/placeholder.js +0 -1
- package/dist/es2019/react/nodes/status.js +0 -1
- package/dist/es2019/react/nodes/table/colgroup.js +9 -18
- package/dist/es2019/react/nodes/table/sticky.js +3 -16
- package/dist/es2019/react/nodes/table.js +9 -75
- package/dist/es2019/react/nodes/tableCell.js +4 -31
- package/dist/es2019/react/nodes/tableRow.js +0 -10
- package/dist/es2019/react/nodes/task-item-with-providers.js +0 -6
- package/dist/es2019/react/nodes/taskItem.js +0 -7
- package/dist/es2019/react/nodes/taskList.js +0 -3
- package/dist/es2019/react/nodes/text-wrapper.js +0 -4
- package/dist/es2019/react/utils/clipboard.js +0 -1
- package/dist/es2019/react/utils/element-selection.js +0 -12
- package/dist/es2019/react/utils/inject-props.js +5 -7
- package/dist/es2019/react/utils/links.js +2 -4
- package/dist/es2019/react/utils/performance/RenderTracking.js +0 -1
- package/dist/es2019/react/utils/use-select-all-trap.js +0 -7
- package/dist/es2019/render-document.js +16 -33
- package/dist/es2019/steps/index.js +4 -33
- package/dist/es2019/text/index.js +0 -3
- package/dist/es2019/text/nodes/blockquote.js +0 -2
- package/dist/es2019/text/nodes/bulletList.js +0 -2
- package/dist/es2019/text/nodes/date.js +0 -2
- package/dist/es2019/text/nodes/decisionItem.js +0 -4
- package/dist/es2019/text/nodes/hardBreak.js +0 -1
- package/dist/es2019/text/nodes/heading.js +0 -2
- package/dist/es2019/text/nodes/inlineCard.js +0 -3
- package/dist/es2019/text/nodes/listItem.js +0 -2
- package/dist/es2019/text/nodes/mediaGroup.js +0 -3
- package/dist/es2019/text/nodes/mention.js +0 -2
- package/dist/es2019/text/nodes/orderedList.js +0 -2
- package/dist/es2019/text/nodes/panel.js +0 -2
- package/dist/es2019/text/nodes/paragraph.js +0 -4
- package/dist/es2019/text/nodes/rule.js +0 -1
- package/dist/es2019/text/nodes/status.js +0 -2
- package/dist/es2019/text/nodes/table.js +0 -4
- package/dist/es2019/text/nodes/taskItem.js +0 -4
- package/dist/es2019/text/nodes/unknown.js +0 -4
- package/dist/es2019/ui/Expand.js +2 -17
- package/dist/es2019/ui/ExtensionRenderer.js +0 -19
- package/dist/es2019/ui/MediaCard.js +9 -40
- package/dist/es2019/ui/Renderer/ErrorBoundary.js +0 -10
- package/dist/es2019/ui/Renderer/breakout-ssr.js +6 -26
- package/dist/es2019/ui/Renderer/click-to-edit.js +1 -4
- package/dist/es2019/ui/Renderer/index.js +17 -66
- package/dist/es2019/ui/Renderer/style.js +0 -14
- package/dist/es2019/ui/Renderer/truncated-wrapper.js +2 -6
- package/dist/es2019/ui/SmartCardStorage.js +0 -1
- package/dist/es2019/ui/SortingIcon.js +3 -20
- package/dist/es2019/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
- package/dist/es2019/ui/active-header-id-provider.js +0 -3
- package/dist/es2019/ui/annotations/context.js +0 -6
- package/dist/es2019/ui/annotations/draft/component.js +0 -13
- package/dist/es2019/ui/annotations/draft/dom.js +0 -6
- package/dist/es2019/ui/annotations/draft/position.js +0 -8
- package/dist/es2019/ui/annotations/draft/text.js +0 -1
- package/dist/es2019/ui/annotations/element/index.js +0 -3
- package/dist/es2019/ui/annotations/element/mark.js +4 -6
- package/dist/es2019/ui/annotations/hooks/use-events.js +4 -13
- package/dist/es2019/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
- package/dist/es2019/ui/annotations/hooks/use-inline-comments-filter.js +0 -1
- package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +4 -8
- package/dist/es2019/ui/annotations/hooks/user-selection.js +0 -6
- package/dist/es2019/ui/annotations/selection/mounter.js +0 -13
- package/dist/es2019/ui/annotations/selection/range-validator.js +0 -2
- package/dist/es2019/ui/annotations/selection/wrapper.js +0 -2
- package/dist/es2019/ui/annotations/types.js +0 -1
- package/dist/es2019/ui/annotations/view/index.js +0 -4
- package/dist/es2019/use-feature-flags.js +0 -1
- package/dist/es2019/utils.js +1 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +19 -63
- package/dist/esm/actions/matches-utils.js +10 -9
- package/dist/esm/actions.js +2 -1
- package/dist/esm/analytics/events.js +0 -5
- package/dist/esm/analytics/unsupported-content.js +14 -21
- package/dist/esm/react/hooks/use-bidi-warnings.js +2 -4
- package/dist/esm/react/hooks/use-in-viewport.js +4 -13
- package/dist/esm/react/hooks/use-observed-width.js +20 -29
- package/dist/esm/react/index.js +27 -111
- package/dist/esm/react/marks/alignment.js +0 -4
- package/dist/esm/react/marks/annotation.js +6 -14
- package/dist/esm/react/marks/breakout.js +0 -2
- package/dist/esm/react/marks/confluence-inline-comment.js +2 -12
- package/dist/esm/react/marks/index.js +2 -1
- package/dist/esm/react/marks/link.js +5 -12
- package/dist/esm/react/marks/subsup.js +0 -3
- package/dist/esm/react/nodes/blockCard.js +4 -4
- package/dist/esm/react/nodes/bodiedExtension.js +6 -10
- package/dist/esm/react/nodes/caption.js +1 -3
- package/dist/esm/react/nodes/codeBlock/codeBlock.js +4 -6
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +4 -8
- package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -10
- package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +10 -21
- package/dist/esm/react/nodes/codeBlockCopyButton.js +7 -15
- package/dist/esm/react/nodes/date.js +5 -20
- package/dist/esm/react/nodes/decisionItem.js +1 -1
- package/dist/esm/react/nodes/decisionList.js +0 -12
- package/dist/esm/react/nodes/embedCard.js +25 -39
- package/dist/esm/react/nodes/emoji.js +6 -16
- package/dist/esm/react/nodes/extension.js +12 -16
- package/dist/esm/react/nodes/fallback.js +2 -18
- package/dist/esm/react/nodes/hardBreak.js +1 -5
- package/dist/esm/react/nodes/heading-anchor.js +1 -32
- package/dist/esm/react/nodes/heading.js +4 -10
- package/dist/esm/react/nodes/index.js +26 -64
- package/dist/esm/react/nodes/inline.js +0 -2
- package/dist/esm/react/nodes/inlineCard.js +6 -12
- package/dist/esm/react/nodes/inlineExtension.js +2 -6
- package/dist/esm/react/nodes/layoutColumn.js +0 -2
- package/dist/esm/react/nodes/media.js +10 -34
- package/dist/esm/react/nodes/mediaGroup.js +6 -37
- package/dist/esm/react/nodes/mediaInline.js +7 -20
- package/dist/esm/react/nodes/mediaSingle/index.js +37 -66
- package/dist/esm/react/nodes/mediaSingle/styles.js +0 -2
- package/dist/esm/react/nodes/mention.js +5 -15
- package/dist/esm/react/nodes/orderedList.js +0 -5
- package/dist/esm/react/nodes/panel.js +12 -28
- package/dist/esm/react/nodes/paragraph.js +1 -1
- package/dist/esm/react/nodes/placeholder.js +0 -1
- package/dist/esm/react/nodes/status.js +3 -13
- package/dist/esm/react/nodes/table/colgroup.js +12 -21
- package/dist/esm/react/nodes/table/sticky.js +17 -32
- package/dist/esm/react/nodes/table/table.js +5 -5
- package/dist/esm/react/nodes/table.js +19 -95
- package/dist/esm/react/nodes/tableCell.js +26 -66
- package/dist/esm/react/nodes/tableRow.js +4 -25
- package/dist/esm/react/nodes/task-item-with-providers.js +4 -27
- package/dist/esm/react/nodes/taskItem.js +8 -24
- package/dist/esm/react/nodes/taskList.js +2 -14
- package/dist/esm/react/nodes/text-wrapper.js +1 -5
- package/dist/esm/react/utils/clipboard.js +0 -1
- package/dist/esm/react/utils/element-selection.js +0 -10
- package/dist/esm/react/utils/inject-props.js +5 -7
- package/dist/esm/react/utils/links.js +2 -4
- package/dist/esm/react/utils/performance/RenderTracking.js +2 -4
- package/dist/esm/react/utils/use-select-all-trap.js +1 -9
- package/dist/esm/render-document.js +42 -70
- package/dist/esm/steps/index.js +7 -36
- package/dist/esm/text/index.js +0 -6
- package/dist/esm/text/nodes/blockquote.js +0 -2
- package/dist/esm/text/nodes/bulletList.js +0 -2
- package/dist/esm/text/nodes/date.js +0 -2
- package/dist/esm/text/nodes/decisionItem.js +0 -4
- package/dist/esm/text/nodes/hardBreak.js +0 -1
- package/dist/esm/text/nodes/heading.js +0 -2
- package/dist/esm/text/nodes/inlineCard.js +0 -3
- package/dist/esm/text/nodes/listItem.js +0 -2
- package/dist/esm/text/nodes/mediaGroup.js +0 -3
- package/dist/esm/text/nodes/mention.js +0 -2
- package/dist/esm/text/nodes/orderedList.js +0 -2
- package/dist/esm/text/nodes/panel.js +0 -2
- package/dist/esm/text/nodes/paragraph.js +0 -4
- package/dist/esm/text/nodes/rule.js +0 -1
- package/dist/esm/text/nodes/status.js +0 -2
- package/dist/esm/text/nodes/table.js +0 -4
- package/dist/esm/text/nodes/taskItem.js +0 -4
- package/dist/esm/text/nodes/unknown.js +0 -4
- package/dist/esm/ui/Expand.js +15 -36
- package/dist/esm/ui/ExtensionRenderer.js +10 -39
- package/dist/esm/ui/MediaCard.js +42 -99
- package/dist/esm/ui/Renderer/ErrorBoundary.js +0 -16
- package/dist/esm/ui/Renderer/breakout-ssr.js +7 -27
- package/dist/esm/ui/Renderer/click-to-edit.js +1 -4
- package/dist/esm/ui/Renderer/index.js +47 -110
- package/dist/esm/ui/Renderer/style.js +1 -21
- package/dist/esm/ui/Renderer/truncated-wrapper.js +12 -23
- package/dist/esm/ui/RendererActionsContext/index.js +1 -1
- package/dist/esm/ui/SmartCardStorage.js +0 -9
- package/dist/esm/ui/SortingIcon.js +10 -29
- package/dist/esm/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
- package/dist/esm/ui/active-header-id-provider.js +6 -12
- package/dist/esm/ui/annotations/context.js +0 -15
- package/dist/esm/ui/annotations/draft/component.js +5 -19
- package/dist/esm/ui/annotations/draft/dom.js +3 -11
- package/dist/esm/ui/annotations/draft/position.js +1 -9
- package/dist/esm/ui/annotations/draft/text.js +2 -4
- package/dist/esm/ui/annotations/element/index.js +4 -7
- package/dist/esm/ui/annotations/element/mark.js +8 -14
- package/dist/esm/ui/annotations/hooks/use-events.js +13 -32
- package/dist/esm/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
- package/dist/esm/ui/annotations/hooks/use-inline-comments-filter.js +1 -2
- package/dist/esm/ui/annotations/hooks/use-load-annotations.js +4 -12
- package/dist/esm/ui/annotations/hooks/user-selection.js +3 -11
- package/dist/esm/ui/annotations/index.js +4 -6
- package/dist/esm/ui/annotations/selection/mounter.js +13 -29
- package/dist/esm/ui/annotations/selection/range-validator.js +9 -12
- package/dist/esm/ui/annotations/selection/wrapper.js +3 -5
- package/dist/esm/ui/annotations/types.js +0 -1
- package/dist/esm/ui/annotations/view/index.js +1 -5
- package/dist/esm/use-feature-flags.js +0 -1
- package/dist/esm/utils.js +1 -8
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
|
@@ -12,21 +12,17 @@ import { getText } from '../utils';
|
|
|
12
12
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
13
13
|
import { insideBreakoutLayout } from './renderer-node';
|
|
14
14
|
import { isCodeMark } from './marks/code';
|
|
15
|
-
|
|
16
15
|
function mergeMarks(marksAndNodes) {
|
|
17
16
|
return marksAndNodes.reduce((acc, markOrNode) => {
|
|
18
17
|
const prev = acc.length && acc[acc.length - 1] || null;
|
|
19
|
-
|
|
20
18
|
if (markOrNode.type instanceof MarkType && prev && prev.type instanceof MarkType && Array.isArray(prev.content) && isSameMark(prev, markOrNode)) {
|
|
21
19
|
prev.content = mergeMarks(prev.content.concat(markOrNode.content));
|
|
22
20
|
} else {
|
|
23
21
|
acc.push(markOrNode);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
return acc;
|
|
27
24
|
}, []);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
export default class ReactSerializer {
|
|
31
27
|
/**
|
|
32
28
|
* The reason we have this extra array here is because we need to generate the same unique
|
|
@@ -36,23 +32,16 @@ export default class ReactSerializer {
|
|
|
36
32
|
* We will eventually need to refactor the current approach to generate unique ids
|
|
37
33
|
* for headers under this ticket -> https://product-fabric.atlassian.net/browse/ED-9668
|
|
38
34
|
*/
|
|
35
|
+
|
|
39
36
|
constructor(init) {
|
|
40
37
|
_defineProperty(this, "headingIds", []);
|
|
41
|
-
|
|
42
38
|
_defineProperty(this, "expandHeadingIds", []);
|
|
43
|
-
|
|
44
39
|
_defineProperty(this, "allowCopyToClipboard", false);
|
|
45
|
-
|
|
46
40
|
_defineProperty(this, "allowPlaceholderText", true);
|
|
47
|
-
|
|
48
41
|
_defineProperty(this, "allowCustomPanels", false);
|
|
49
|
-
|
|
50
42
|
_defineProperty(this, "startPos", 1);
|
|
51
|
-
|
|
52
43
|
_defineProperty(this, "surroundTextNodesWithTextWrapper", false);
|
|
53
|
-
|
|
54
44
|
_defineProperty(this, "allowAnnotations", false);
|
|
55
|
-
|
|
56
45
|
_defineProperty(this, "serializeFragmentChild", (node, {
|
|
57
46
|
index,
|
|
58
47
|
parentInfo
|
|
@@ -72,41 +61,34 @@ export default class ReactSerializer {
|
|
|
72
61
|
this.startPos = pos + node.nodeSize;
|
|
73
62
|
const marks = node.marks ? [...node.marks] : [];
|
|
74
63
|
const isMedia = node.type.name === 'media';
|
|
75
|
-
|
|
76
64
|
const shouldSkipMark = mark => this.allowMediaLinking !== true && isMedia && mark.type.name === 'link';
|
|
77
|
-
|
|
78
65
|
return marks.reverse().reduce((content, mark) => {
|
|
79
66
|
if (shouldSkipMark(mark)) {
|
|
80
67
|
return content;
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
return this.renderMark(markToReact(mark), this.withMediaMarkProps(node, mark, this.getMarkProps(mark, [], node)), `${mark.type.name}-${index}`, content);
|
|
84
70
|
}, serializedContent);
|
|
85
71
|
});
|
|
86
|
-
|
|
87
72
|
_defineProperty(this, "withMediaMarkProps", (node, mark, defaultProps) => {
|
|
88
73
|
if (mark.type.name === 'link' && node.type.name === 'media') {
|
|
89
|
-
return {
|
|
74
|
+
return {
|
|
75
|
+
...defaultProps,
|
|
90
76
|
isMediaLink: true
|
|
91
77
|
};
|
|
92
78
|
}
|
|
93
|
-
|
|
94
79
|
return defaultProps;
|
|
95
80
|
});
|
|
96
|
-
|
|
97
81
|
_defineProperty(this, "getUnsupportedContentProps", node => {
|
|
98
82
|
return {
|
|
99
83
|
node,
|
|
100
84
|
dispatchAnalyticsEvent: this.fireAnalyticsEvent
|
|
101
85
|
};
|
|
102
86
|
});
|
|
103
|
-
|
|
104
87
|
_defineProperty(this, "getAnnotationMarkProps", (mark, marksParentPath) => {
|
|
105
88
|
const annotationParentIds = (marksParentPath || []).reduce((acc, parent) => {
|
|
106
89
|
if (isAnnotationMark(parent)) {
|
|
107
90
|
return [...acc, parent.attrs.id];
|
|
108
91
|
}
|
|
109
|
-
|
|
110
92
|
return acc;
|
|
111
93
|
}, []);
|
|
112
94
|
return {
|
|
@@ -119,20 +101,19 @@ export default class ReactSerializer {
|
|
|
119
101
|
}
|
|
120
102
|
};
|
|
121
103
|
});
|
|
122
|
-
|
|
123
104
|
_defineProperty(this, "getMarkProps", (mark, marksParentPath, node) => {
|
|
124
105
|
if (isAnnotationMark(mark)) {
|
|
125
106
|
return this.getAnnotationMarkProps(mark, marksParentPath);
|
|
126
107
|
}
|
|
127
|
-
|
|
128
108
|
const {
|
|
129
109
|
key,
|
|
130
110
|
...otherAttrs
|
|
131
111
|
} = mark.attrs;
|
|
132
112
|
const extraProps = {
|
|
133
113
|
isInline: node === null || node === void 0 ? void 0 : node.isInline
|
|
134
|
-
};
|
|
114
|
+
};
|
|
135
115
|
|
|
116
|
+
// currently the only mark which has custom props is the code mark
|
|
136
117
|
const markSpecificProps = isCodeMark(mark) ? {
|
|
137
118
|
// The appearance being mobile indicates we are in an renderer being
|
|
138
119
|
// rendered by mobile bridge in a web view.
|
|
@@ -154,7 +135,6 @@ export default class ReactSerializer {
|
|
|
154
135
|
};
|
|
155
136
|
return props;
|
|
156
137
|
});
|
|
157
|
-
|
|
158
138
|
this.providers = init.providers;
|
|
159
139
|
this.eventHandlers = init.eventHandlers;
|
|
160
140
|
this.extensionHandlers = init.extensionHandlers;
|
|
@@ -182,78 +162,57 @@ export default class ReactSerializer {
|
|
|
182
162
|
this.nodeComponents = init.nodeComponents;
|
|
183
163
|
this.allowWindowedCodeBlock = init.allowWindowedCodeBlock;
|
|
184
164
|
}
|
|
185
|
-
|
|
186
165
|
resetState() {
|
|
187
166
|
this.headingIds = [];
|
|
188
167
|
this.expandHeadingIds = [];
|
|
189
168
|
this.startPos = 1;
|
|
190
169
|
}
|
|
191
|
-
|
|
192
170
|
getNodeProps(node, parentInfo) {
|
|
193
171
|
const path = parentInfo ? parentInfo.path : undefined;
|
|
194
|
-
|
|
195
172
|
switch (node.type.name) {
|
|
196
173
|
case 'date':
|
|
197
174
|
return this.getDateProps(node, parentInfo);
|
|
198
|
-
|
|
199
175
|
case 'hardBreak':
|
|
200
176
|
return this.getHardBreakProps(node, path);
|
|
201
|
-
|
|
202
177
|
case 'heading':
|
|
203
178
|
return this.getHeadingProps(node, path);
|
|
204
|
-
|
|
205
179
|
case 'media':
|
|
206
180
|
return this.getMediaProps(node, path);
|
|
207
|
-
|
|
208
181
|
case 'emoji':
|
|
209
182
|
return this.getEmojiProps(node);
|
|
210
|
-
|
|
211
183
|
case 'mediaGroup':
|
|
212
184
|
return this.getMediaGroupProps(node);
|
|
213
|
-
|
|
214
185
|
case 'mediaInline':
|
|
215
186
|
return this.getMediaInlineProps(node);
|
|
216
|
-
|
|
217
187
|
case 'mediaSingle':
|
|
218
188
|
return this.getMediaSingleProps(node, path);
|
|
219
|
-
|
|
220
189
|
case 'table':
|
|
221
190
|
return this.getTableProps(node, path);
|
|
222
|
-
|
|
223
191
|
case 'tableHeader':
|
|
224
192
|
case 'tableRow':
|
|
225
193
|
return this.getTableChildrenProps(node);
|
|
226
|
-
|
|
227
194
|
case 'taskItem':
|
|
228
195
|
return this.getTaskItemProps(node, path);
|
|
229
|
-
|
|
230
196
|
case 'embedCard':
|
|
231
197
|
return this.getEmbedCardProps(node, path);
|
|
232
|
-
|
|
233
198
|
case 'expand':
|
|
234
199
|
return this.getExpandProps(node, path);
|
|
235
|
-
|
|
236
200
|
case 'unsupportedBlock':
|
|
237
201
|
case 'unsupportedInline':
|
|
238
202
|
return this.getUnsupportedContentProps(node);
|
|
239
|
-
|
|
240
203
|
case 'codeBlock':
|
|
241
204
|
return this.getCodeBlockProps(node);
|
|
242
|
-
|
|
243
205
|
case 'panel':
|
|
244
206
|
return this.getPanelProps(node);
|
|
245
|
-
|
|
246
207
|
default:
|
|
247
208
|
return this.getProps(node, path);
|
|
248
209
|
}
|
|
249
210
|
}
|
|
250
|
-
|
|
251
211
|
serializeFragment(fragment, props = {}, target = this.allowSelectAllTrap ? DocWithSelectAllTrap : Doc, key = 'root-0', parentInfo) {
|
|
252
212
|
// This makes sure that we reset internal state on re-render.
|
|
253
213
|
if (key === 'root-0') {
|
|
254
214
|
this.resetState();
|
|
255
215
|
}
|
|
256
|
-
|
|
257
216
|
return this.renderNode(target, props, key, ReactSerializer.getChildNodes(fragment).map((node, index) => {
|
|
258
217
|
if (isTextWrapper(node)) {
|
|
259
218
|
return this.serializeTextWrapper(node.content, {
|
|
@@ -261,14 +220,12 @@ export default class ReactSerializer {
|
|
|
261
220
|
parentInfo
|
|
262
221
|
});
|
|
263
222
|
}
|
|
264
|
-
|
|
265
223
|
return this.serializeFragmentChild(node, {
|
|
266
224
|
index,
|
|
267
225
|
parentInfo
|
|
268
226
|
});
|
|
269
227
|
}));
|
|
270
228
|
}
|
|
271
|
-
|
|
272
229
|
serializeTextWrapper(content, {
|
|
273
230
|
index,
|
|
274
231
|
parentInfo
|
|
@@ -288,7 +245,6 @@ export default class ReactSerializer {
|
|
|
288
245
|
});
|
|
289
246
|
});
|
|
290
247
|
}
|
|
291
|
-
|
|
292
248
|
serializeMark({
|
|
293
249
|
mark,
|
|
294
250
|
parentNode,
|
|
@@ -302,16 +258,13 @@ export default class ReactSerializer {
|
|
|
302
258
|
path: [...parentMark.path, childMark]
|
|
303
259
|
}
|
|
304
260
|
});
|
|
305
|
-
|
|
306
261
|
const content = (mark.content || []).map(serializeContent);
|
|
307
262
|
const markKey = `${mark.type.name}-component__${this.startPos}__${parentMark.path.length}`;
|
|
308
263
|
return this.renderMark(markToReact(mark), this.getMarkProps(mark, parentMark.path), markKey, content);
|
|
309
264
|
}
|
|
310
|
-
|
|
311
265
|
const startPos = this.startPos;
|
|
312
266
|
const endPos = startPos + mark.nodeSize;
|
|
313
267
|
this.startPos = endPos;
|
|
314
|
-
|
|
315
268
|
if (this.surroundTextNodesWithTextWrapper) {
|
|
316
269
|
const textKey = `text-wrapper_${this.startPos}`;
|
|
317
270
|
const parentDepth = Math.max(parentNode.path.length - 1, 0);
|
|
@@ -321,46 +274,41 @@ export default class ReactSerializer {
|
|
|
321
274
|
endPos: endPos + parentDepth
|
|
322
275
|
}, mark.text);
|
|
323
276
|
}
|
|
324
|
-
|
|
325
277
|
return mark.text || '';
|
|
326
278
|
}
|
|
327
|
-
|
|
328
279
|
renderNode(NodeComponent, props, key, content) {
|
|
329
280
|
return /*#__PURE__*/React.createElement(NodeComponent, _extends({
|
|
330
281
|
key: key
|
|
331
282
|
}, props), content);
|
|
332
283
|
}
|
|
333
|
-
|
|
334
284
|
renderMark(MarkComponent, props, key, content) {
|
|
335
285
|
return /*#__PURE__*/React.createElement(MarkComponent, _extends({
|
|
336
286
|
key: key
|
|
337
287
|
}, props), content);
|
|
338
288
|
}
|
|
339
|
-
|
|
340
289
|
getTableChildrenProps(node) {
|
|
341
|
-
return {
|
|
290
|
+
return {
|
|
291
|
+
...this.getProps(node),
|
|
342
292
|
allowColumnSorting: this.allowColumnSorting
|
|
343
293
|
};
|
|
344
294
|
}
|
|
345
|
-
|
|
346
295
|
getTableProps(node, path = []) {
|
|
347
296
|
// TODO: https://product-fabric.atlassian.net/browse/CEMS-1048
|
|
348
297
|
const stickyHeaders = !insideBreakoutLayout(path) ? this.stickyHeaders : undefined;
|
|
349
|
-
return {
|
|
298
|
+
return {
|
|
299
|
+
...this.getProps(node),
|
|
350
300
|
allowColumnSorting: this.allowColumnSorting,
|
|
351
301
|
columnWidths: calcTableColumnWidths(node),
|
|
352
302
|
tableNode: node,
|
|
353
303
|
stickyHeaders
|
|
354
304
|
};
|
|
355
305
|
}
|
|
356
|
-
|
|
357
306
|
getDateProps(node, parentInfo) {
|
|
358
307
|
return {
|
|
359
308
|
timestamp: node.attrs && node.attrs.timestamp,
|
|
360
309
|
parentIsIncompleteTask: parentInfo && parentInfo.parentIsIncompleteTask
|
|
361
310
|
};
|
|
362
311
|
}
|
|
363
|
-
|
|
364
312
|
getMediaSingleProps(node, path = []) {
|
|
365
313
|
const {
|
|
366
314
|
nodes: {
|
|
@@ -375,29 +323,25 @@ export default class ReactSerializer {
|
|
|
375
323
|
const blockNodeNames = [expand, nestedExpand, layoutColumn].filter(node => Boolean(node)) // Check if the node exist first
|
|
376
324
|
.map(node => node.name);
|
|
377
325
|
const isInsideOfBlockNode = path && path.some(n => n.type && blockNodeNames.indexOf(n.type.name) > -1);
|
|
378
|
-
|
|
379
326
|
const isLinkMark = mark => mark.type === link;
|
|
380
|
-
|
|
381
327
|
const childHasLink = node.firstChild && node.firstChild.marks.filter(m => isLinkMark(m) || this.allowMediaLinking === true).length;
|
|
382
|
-
return {
|
|
328
|
+
return {
|
|
329
|
+
...this.getProps(node),
|
|
383
330
|
isInsideOfBlockNode,
|
|
384
331
|
childHasLink,
|
|
385
332
|
featureFlags: this.media && this.media.featureFlags
|
|
386
333
|
};
|
|
387
334
|
}
|
|
388
|
-
|
|
389
335
|
getMediaProps(node, path = []) {
|
|
390
336
|
var _this$media;
|
|
391
|
-
|
|
392
337
|
const {
|
|
393
338
|
marks: {
|
|
394
339
|
link
|
|
395
340
|
}
|
|
396
341
|
} = node.type.schema;
|
|
397
|
-
|
|
398
342
|
const isLinkMark = mark => mark.type === link;
|
|
399
|
-
|
|
400
|
-
|
|
343
|
+
return {
|
|
344
|
+
...this.getProps(node),
|
|
401
345
|
marks: node.marks.filter(m => !isLinkMark(m) || this.allowMediaLinking === true),
|
|
402
346
|
isLinkMark,
|
|
403
347
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
@@ -406,13 +350,12 @@ export default class ReactSerializer {
|
|
|
406
350
|
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
407
351
|
};
|
|
408
352
|
}
|
|
409
|
-
|
|
410
353
|
getEmojiProps(node) {
|
|
411
|
-
return {
|
|
354
|
+
return {
|
|
355
|
+
...this.getProps(node),
|
|
412
356
|
resourceConfig: this.emojiResourceConfig
|
|
413
357
|
};
|
|
414
358
|
}
|
|
415
|
-
|
|
416
359
|
getEmbedCardProps(node, path = []) {
|
|
417
360
|
const {
|
|
418
361
|
nodes: {
|
|
@@ -424,15 +367,15 @@ export default class ReactSerializer {
|
|
|
424
367
|
const blockNodeNames = [expand, nestedExpand, layoutColumn].filter(node => Boolean(node)) // Check if the node exist first
|
|
425
368
|
.map(node => node.name);
|
|
426
369
|
const isInsideOfBlockNode = path && path.some(n => n.type && blockNodeNames.indexOf(n.type.name) > -1);
|
|
427
|
-
return {
|
|
370
|
+
return {
|
|
371
|
+
...this.getProps(node),
|
|
428
372
|
isInsideOfBlockNode
|
|
429
373
|
};
|
|
430
374
|
}
|
|
431
|
-
|
|
432
375
|
getMediaGroupProps(node) {
|
|
433
376
|
var _this$media2, _this$media3;
|
|
434
|
-
|
|
435
|
-
|
|
377
|
+
return {
|
|
378
|
+
...this.getProps(node),
|
|
436
379
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
437
380
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
438
381
|
featureFlags: this.media && this.media.featureFlags,
|
|
@@ -440,31 +383,28 @@ export default class ReactSerializer {
|
|
|
440
383
|
ssr: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.ssr
|
|
441
384
|
};
|
|
442
385
|
}
|
|
443
|
-
|
|
444
386
|
getMediaInlineProps(node) {
|
|
445
|
-
return {
|
|
387
|
+
return {
|
|
388
|
+
...this.getProps(node)
|
|
446
389
|
};
|
|
447
390
|
}
|
|
448
|
-
|
|
449
391
|
getTaskItemProps(node, path = []) {
|
|
450
|
-
return {
|
|
392
|
+
return {
|
|
393
|
+
...this.getProps(node, path),
|
|
451
394
|
disabled: this.disableActions
|
|
452
395
|
};
|
|
453
396
|
}
|
|
454
|
-
|
|
455
397
|
getHardBreakProps(node, path = []) {
|
|
456
398
|
let forceNewLine = false;
|
|
457
399
|
const parentNode = path.length > 0 ? path[path.length - 1] : null;
|
|
458
|
-
|
|
459
400
|
if (parentNode && parentNode.lastChild === node) {
|
|
460
401
|
forceNewLine = true;
|
|
461
402
|
}
|
|
462
|
-
|
|
463
|
-
|
|
403
|
+
return {
|
|
404
|
+
...this.getProps(node),
|
|
464
405
|
forceNewLine
|
|
465
406
|
};
|
|
466
407
|
}
|
|
467
|
-
|
|
468
408
|
getCodeBlockProps(node) {
|
|
469
409
|
// The appearance being mobile indicates we are in an renderer being
|
|
470
410
|
// rendered by mobile bridge in a web view.
|
|
@@ -472,18 +412,18 @@ export default class ReactSerializer {
|
|
|
472
412
|
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
473
413
|
// the rendering in the mobile Native Renderer.
|
|
474
414
|
const codeBidiWarningTooltipEnabled = this.appearance !== 'mobile';
|
|
475
|
-
return {
|
|
415
|
+
return {
|
|
416
|
+
...this.getProps(node),
|
|
476
417
|
text: node.textContent,
|
|
477
418
|
codeBidiWarningTooltipEnabled
|
|
478
419
|
};
|
|
479
420
|
}
|
|
480
|
-
|
|
481
421
|
getPanelProps(node) {
|
|
482
|
-
return {
|
|
422
|
+
return {
|
|
423
|
+
...this.getProps(node),
|
|
483
424
|
allowCustomPanels: this.allowCustomPanels
|
|
484
425
|
};
|
|
485
426
|
}
|
|
486
|
-
|
|
487
427
|
getProps(node, path = []) {
|
|
488
428
|
return {
|
|
489
429
|
text: node.text,
|
|
@@ -511,72 +451,63 @@ export default class ReactSerializer {
|
|
|
511
451
|
...node.attrs
|
|
512
452
|
};
|
|
513
453
|
}
|
|
514
|
-
|
|
515
454
|
headingAnchorSupported(path = []) {
|
|
516
455
|
const isImmediateParent = (path, nodeName) => {
|
|
517
456
|
return path.length > 0 && path[path.length - 1].type.name === nodeName;
|
|
518
457
|
};
|
|
519
|
-
|
|
520
458
|
return isNestedHeaderLinksEnabled(this.allowHeadingAnchorLinks) || path.length === 0 || isImmediateParent(path, 'layoutColumn');
|
|
521
459
|
}
|
|
522
|
-
|
|
523
460
|
getHeadingProps(node, path = []) {
|
|
524
|
-
return {
|
|
461
|
+
return {
|
|
462
|
+
...this.getProps(node, path),
|
|
525
463
|
content: node.content ? node.content.toJSON() : undefined,
|
|
526
464
|
headingId: this.getHeadingId(node, this.headingIds),
|
|
527
465
|
showAnchorLink: this.appearance !== 'comment' && this.allowHeadingAnchorLinks && !this.disableHeadingIDs && this.headingAnchorSupported(path)
|
|
528
466
|
};
|
|
529
467
|
}
|
|
530
|
-
|
|
531
468
|
getExpandProps(node, path = []) {
|
|
532
469
|
if (!isNestedHeaderLinksEnabled(this.allowHeadingAnchorLinks)) {
|
|
533
470
|
return this.getProps(node);
|
|
534
471
|
}
|
|
535
|
-
|
|
536
472
|
const nestedHeaderIds = findChildrenByType(node, node.type.schema.nodes.heading).map(({
|
|
537
473
|
node
|
|
538
474
|
}) => this.getHeadingId(node, this.expandHeadingIds));
|
|
539
|
-
return {
|
|
475
|
+
return {
|
|
476
|
+
...this.getProps(node),
|
|
540
477
|
nestedHeaderIds
|
|
541
478
|
};
|
|
542
|
-
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// The return value of this function is NOT url encoded,
|
|
543
482
|
// In HTML5 standard, id can contain any characters, encoding is no necessary.
|
|
544
483
|
// Plus we trying to avoid double encoding, therefore we leave the value as is.
|
|
545
484
|
// Remember to use encodeURIComponent when generating url from the id value.
|
|
546
|
-
|
|
547
|
-
|
|
548
485
|
getHeadingId(node, headingIds) {
|
|
549
486
|
if (this.disableHeadingIDs || !node.content.size) {
|
|
550
487
|
return;
|
|
551
|
-
}
|
|
552
|
-
// headings only contain inline blocks like emoji, status and date.
|
|
553
|
-
|
|
488
|
+
}
|
|
554
489
|
|
|
490
|
+
// We are not use node.textContent here, because we would like to handle cases where
|
|
491
|
+
// headings only contain inline blocks like emoji, status and date.
|
|
555
492
|
const nodeContent = node.content.toJSON().reduce((acc, node) => acc.concat(getText(node) || ''), '').trim().replace(/\s/g, '-');
|
|
556
|
-
|
|
557
493
|
if (!nodeContent) {
|
|
558
494
|
return;
|
|
559
495
|
}
|
|
560
|
-
|
|
561
496
|
return this.getUniqueHeadingId(nodeContent, headingIds);
|
|
562
497
|
}
|
|
563
|
-
|
|
564
498
|
getUniqueHeadingId(baseId, headingIds, counter = 0) {
|
|
565
499
|
if (counter === 0 && headingIds.indexOf(baseId) === -1) {
|
|
566
500
|
headingIds.push(baseId);
|
|
567
501
|
return baseId;
|
|
568
502
|
} else if (counter !== 0) {
|
|
569
503
|
const headingId = `${baseId}.${counter}`;
|
|
570
|
-
|
|
571
504
|
if (headingIds.indexOf(headingId) === -1) {
|
|
572
505
|
headingIds.push(headingId);
|
|
573
506
|
return headingId;
|
|
574
507
|
}
|
|
575
508
|
}
|
|
576
|
-
|
|
577
509
|
return this.getUniqueHeadingId(baseId, headingIds, ++counter);
|
|
578
510
|
}
|
|
579
|
-
|
|
580
511
|
static getChildNodes(fragment) {
|
|
581
512
|
const children = [];
|
|
582
513
|
fragment.forEach(node => {
|
|
@@ -584,44 +515,38 @@ export default class ReactSerializer {
|
|
|
584
515
|
});
|
|
585
516
|
return mergeTextNodes(children);
|
|
586
517
|
}
|
|
587
|
-
|
|
588
518
|
static getMarks(node) {
|
|
589
519
|
if (!node.marks || node.marks.length === 0) {
|
|
590
520
|
return [];
|
|
591
521
|
}
|
|
592
|
-
|
|
593
522
|
return getMarksByOrder(node.marks);
|
|
594
523
|
}
|
|
595
|
-
|
|
596
524
|
static buildMarkStructure(content) {
|
|
597
525
|
return mergeMarks(content.map(node => {
|
|
598
526
|
const nodeMarks = this.getMarks(node);
|
|
599
|
-
|
|
600
527
|
if (nodeMarks.length === 0) {
|
|
601
528
|
return node;
|
|
602
529
|
}
|
|
603
|
-
|
|
604
530
|
return nodeMarks.reverse().reduce((acc, mark) => {
|
|
605
531
|
const {
|
|
606
532
|
eq
|
|
607
533
|
} = mark;
|
|
608
|
-
return {
|
|
534
|
+
return {
|
|
535
|
+
...mark,
|
|
609
536
|
eq,
|
|
610
537
|
content: [acc]
|
|
611
538
|
};
|
|
612
539
|
}, node);
|
|
613
540
|
}));
|
|
614
|
-
}
|
|
615
|
-
// https://sourcegraph-frontend.internal.shared-prod.us-west-2.kitt-inf.net/search?q=ReactSerializer.fromSchema&patternType=literal
|
|
616
|
-
|
|
541
|
+
}
|
|
617
542
|
|
|
543
|
+
// TODO: ED-9004 Remove unused ReactSerializer.fromSchema in renderer
|
|
544
|
+
// https://sourcegraph-frontend.internal.shared-prod.us-west-2.kitt-inf.net/search?q=ReactSerializer.fromSchema&patternType=literal
|
|
618
545
|
static fromSchema(_, init) {
|
|
619
546
|
if (process.env.NODE_ENV !== 'production') {
|
|
620
547
|
// eslint-disable-next-line no-console
|
|
621
548
|
console.warn('ReactSerializer.fromSchema is deprecated. Please use the constructor instead via new ReactSerializer()');
|
|
622
549
|
}
|
|
623
|
-
|
|
624
550
|
return new ReactSerializer(init);
|
|
625
551
|
}
|
|
626
|
-
|
|
627
552
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
6
5
|
import { alignmentPositionMap } from '@atlaskit/adf-schema';
|
|
7
|
-
|
|
8
6
|
const MarkWrapper = props => {
|
|
9
7
|
const styles = props['data-align'] ? css`
|
|
10
8
|
text-align: ${alignmentPositionMap[props['data-align']]};
|
|
@@ -13,7 +11,6 @@ const MarkWrapper = props => {
|
|
|
13
11
|
css: styles
|
|
14
12
|
}, props), props.children);
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
export default function Alignment(props) {
|
|
18
15
|
return jsx(MarkWrapper, {
|
|
19
16
|
className: "fabric-editor-block-mark fabric-editor-alignment",
|
|
@@ -5,7 +5,6 @@ import { AnnotationMark } from '../../ui/annotations';
|
|
|
5
5
|
export const isAnnotationMark = mark => {
|
|
6
6
|
return mark && mark.type && mark.type.name === 'annotation';
|
|
7
7
|
};
|
|
8
|
-
|
|
9
8
|
const AnnotationComponent = ({
|
|
10
9
|
id,
|
|
11
10
|
annotationType,
|
|
@@ -14,13 +13,13 @@ const AnnotationComponent = ({
|
|
|
14
13
|
annotationParentIds = [],
|
|
15
14
|
allowAnnotations
|
|
16
15
|
}) => {
|
|
17
|
-
const data = {
|
|
16
|
+
const data = {
|
|
17
|
+
...dataAttributes,
|
|
18
18
|
...buildAnnotationMarkDataAttributes({
|
|
19
19
|
id,
|
|
20
20
|
annotationType
|
|
21
21
|
})
|
|
22
22
|
};
|
|
23
|
-
|
|
24
23
|
if (allowAnnotations) {
|
|
25
24
|
return /*#__PURE__*/React.createElement(AnnotationMark, {
|
|
26
25
|
id: id,
|
|
@@ -29,10 +28,8 @@ const AnnotationComponent = ({
|
|
|
29
28
|
annotationType: annotationType
|
|
30
29
|
}, children);
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
34
32
|
id: id
|
|
35
33
|
}, data), children);
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
export default AnnotationComponent;
|
|
@@ -13,8 +13,9 @@ import UnsupportedMark from './unsupportedMark';
|
|
|
13
13
|
import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
|
|
14
14
|
import DataConsumer from './data-consumer';
|
|
15
15
|
import FragmentMark from './fragment';
|
|
16
|
-
import Annotation, { isAnnotationMark } from './annotation';
|
|
16
|
+
import Annotation, { isAnnotationMark } from './annotation';
|
|
17
17
|
|
|
18
|
+
// Stage0
|
|
18
19
|
import ConfluenceInlineComment from './confluence-inline-comment';
|
|
19
20
|
export const markToReact = {
|
|
20
21
|
code: Code,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React, { Fragment } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -33,17 +32,13 @@ export default function Link(props) {
|
|
|
33
32
|
target,
|
|
34
33
|
title: href
|
|
35
34
|
};
|
|
36
|
-
|
|
37
35
|
if (target === '_blank') {
|
|
38
36
|
anchorProps.rel = 'noreferrer noopener';
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
const handler = getEventHandler(eventHandlers, 'link');
|
|
42
|
-
|
|
43
39
|
if (isMediaLink) {
|
|
44
40
|
return jsx(Fragment, null, props.children);
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
return jsx("a", _extends({
|
|
48
43
|
css: anchorStyles,
|
|
49
44
|
onClick: e => {
|
|
@@ -58,7 +53,6 @@ export default function Link(props) {
|
|
|
58
53
|
}
|
|
59
54
|
});
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
if (handler) {
|
|
63
57
|
handler(e, href);
|
|
64
58
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
const isSub = type => {
|
|
4
3
|
return type === 'sub';
|
|
5
4
|
};
|
|
6
|
-
|
|
7
5
|
export default function SubSup(props) {
|
|
8
6
|
if (isSub(props.type)) {
|
|
9
7
|
return /*#__PURE__*/React.createElement("sub", props.dataAttributes, props.children);
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
return /*#__PURE__*/React.createElement("sup", props.dataAttributes, props.children);
|
|
13
10
|
}
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { renderExtension } from './extension';
|
|
4
4
|
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
5
|
-
|
|
6
5
|
const BodiedExtension = props => {
|
|
7
6
|
const {
|
|
8
7
|
children,
|
|
@@ -24,15 +23,13 @@ const BodiedExtension = props => {
|
|
|
24
23
|
}
|
|
25
24
|
} catch (e) {
|
|
26
25
|
/** We don't want this error to block renderer */
|
|
27
|
-
|
|
28
26
|
/** We keep rendering the default content */
|
|
29
|
-
}
|
|
30
|
-
|
|
27
|
+
}
|
|
31
28
|
|
|
29
|
+
// Always return default content if anything goes wrong
|
|
32
30
|
return renderExtension(children, layout, {
|
|
33
31
|
isTopLevel: path.length < 1
|
|
34
32
|
}, removeOverflow);
|
|
35
33
|
});
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
export default BodiedExtension;
|