@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
|
@@ -1,49 +1,37 @@
|
|
|
1
1
|
export class ElementSelection {
|
|
2
2
|
constructor(selection) {
|
|
3
3
|
this.type = selection ? selection.type : 'None';
|
|
4
|
-
|
|
5
4
|
if (selection && this.type !== 'None') {
|
|
6
5
|
this.range = selection.getRangeAt(0);
|
|
7
6
|
}
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
eq(selection) {
|
|
11
9
|
if (!selection) {
|
|
12
10
|
return false;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
if (this.range && selection.range) {
|
|
16
13
|
var _this$range, _this$range2;
|
|
17
|
-
|
|
18
14
|
const startMatches = ((_this$range = this.range) === null || _this$range === void 0 ? void 0 : _this$range.compareBoundaryPoints(Range.START_TO_START, selection.range)) === 0;
|
|
19
15
|
const endMatches = ((_this$range2 = this.range) === null || _this$range2 === void 0 ? void 0 : _this$range2.compareBoundaryPoints(Range.END_TO_END, selection.range)) === 0;
|
|
20
16
|
return startMatches && endMatches;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
return this.type === 'None' && selection.type === 'None';
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
inside(el) {
|
|
27
21
|
var _this$range$commonAnc, _this$range3;
|
|
28
|
-
|
|
29
22
|
return el.contains((_this$range$commonAnc = (_this$range3 = this.range) === null || _this$range3 === void 0 ? void 0 : _this$range3.commonAncestorContainer) !== null && _this$range$commonAnc !== void 0 ? _this$range$commonAnc : null);
|
|
30
23
|
}
|
|
31
|
-
|
|
32
24
|
select(el) {
|
|
33
25
|
const range = document.createRange();
|
|
34
26
|
range.selectNodeContents(el);
|
|
35
27
|
const selection = window.getSelection();
|
|
36
|
-
|
|
37
28
|
if (selection) {
|
|
38
29
|
selection.removeAllRanges();
|
|
39
30
|
selection.addRange(range);
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
return ElementSelection.fromWindow();
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
static fromWindow(win = window) {
|
|
46
35
|
return new ElementSelection(win.getSelection());
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to recursively injects props to
|
|
4
5
|
* all valid children react nodes.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
7
|
export function recursivelyInjectProps(children, propsToInject) {
|
|
8
8
|
return React.Children.toArray(children).map(child => {
|
|
9
9
|
// Cannot add a prop to an invalid element, so just return the child
|
|
10
10
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
11
11
|
return child;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
}
|
|
13
|
+
// Recursive call if child has nested children
|
|
15
14
|
if (child.props.children) {
|
|
16
15
|
child = /*#__PURE__*/React.cloneElement(child, {
|
|
17
16
|
children: recursivelyInjectProps(child.props.children, propsToInject)
|
|
18
17
|
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
}
|
|
19
|
+
// Add props to react child node
|
|
22
20
|
return /*#__PURE__*/React.cloneElement(child, propsToInject);
|
|
23
21
|
});
|
|
24
22
|
}
|
|
@@ -3,17 +3,15 @@ export function isNestedHeaderLinksEnabled(allowHeadingAnchorLinks) {
|
|
|
3
3
|
if (!allowHeadingAnchorLinks || typeof allowHeadingAnchorLinks === 'boolean') {
|
|
4
4
|
return false;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
const {
|
|
8
7
|
allowNestedHeaderLinks
|
|
9
|
-
} = allowHeadingAnchorLinks;
|
|
10
|
-
|
|
8
|
+
} = allowHeadingAnchorLinks;
|
|
9
|
+
// Explicit cast to a boolean to cover scenario where it's undefined.
|
|
11
10
|
return !!allowNestedHeaderLinks;
|
|
12
11
|
}
|
|
13
12
|
export function getActiveHeadingId(allowHeadingAnchorLinks) {
|
|
14
13
|
if (!isNestedHeaderLinksEnabled(allowHeadingAnchorLinks)) {
|
|
15
14
|
return undefined;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
return allowHeadingAnchorLinks.activeHeadingId;
|
|
19
17
|
}
|
|
@@ -12,19 +12,14 @@ export const useSelectAllTrap = () => {
|
|
|
12
12
|
const mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
|
|
13
13
|
const onKeyDown = React.useCallback(e => {
|
|
14
14
|
const el = ref.current;
|
|
15
|
-
|
|
16
15
|
if (!el) {
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
const modKey = mac ? e.metaKey : e.ctrlKey;
|
|
21
|
-
|
|
22
19
|
if (!modKey || e.code !== 'KeyA') {
|
|
23
20
|
return;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
const elementSelection = ElementSelection.fromWindow();
|
|
27
|
-
|
|
28
23
|
if (elementSelection.eq(caught.current)) {
|
|
29
24
|
fireAnalyticsEvent({
|
|
30
25
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -33,7 +28,6 @@ export const useSelectAllTrap = () => {
|
|
|
33
28
|
});
|
|
34
29
|
return;
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
if (elementSelection.inside(el) || elementSelection.type === 'None' && clicked.current) {
|
|
38
32
|
fireAnalyticsEvent({
|
|
39
33
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -46,7 +40,6 @@ export const useSelectAllTrap = () => {
|
|
|
46
40
|
}, [mac, ref, fireAnalyticsEvent, clicked, caught]);
|
|
47
41
|
const onClick = React.useCallback(e => {
|
|
48
42
|
var _ref$current$contains, _ref$current;
|
|
49
|
-
|
|
50
43
|
clicked.current = (_ref$current$contains = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(e.target)) !== null && _ref$current$contains !== void 0 ? _ref$current$contains : false;
|
|
51
44
|
}, [ref, clicked]);
|
|
52
45
|
React.useEffect(() => {
|
|
@@ -7,7 +7,6 @@ import { PLATFORM } from './analytics/events';
|
|
|
7
7
|
import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
|
|
8
8
|
import { transformMediaLinkMarks } from '@atlaskit/adf-utils/transforms';
|
|
9
9
|
const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
|
|
10
|
-
|
|
11
10
|
const withStopwatch = cb => {
|
|
12
11
|
const startTime = SUPPORTS_HIRES_TIMER_API ? performance.now() : Date.now();
|
|
13
12
|
const output = cb();
|
|
@@ -18,10 +17,8 @@ const withStopwatch = cb => {
|
|
|
18
17
|
time
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent) => {
|
|
23
21
|
let result;
|
|
24
|
-
|
|
25
22
|
if (useSpecBasedValidator) {
|
|
26
23
|
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
27
24
|
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
@@ -29,7 +26,6 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
|
|
|
29
26
|
transformedAdf,
|
|
30
27
|
isTransformed
|
|
31
28
|
} = transformMediaLinkMarks(doc);
|
|
32
|
-
|
|
33
29
|
if (isTransformed && dispatchAnalyticsEvent) {
|
|
34
30
|
dispatchAnalyticsEvent({
|
|
35
31
|
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
@@ -37,73 +33,64 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
|
|
|
37
33
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
38
34
|
});
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
result = validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
42
37
|
} else {
|
|
43
38
|
result = getValidDocument(doc, schema, adfStage);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
if (!result) {
|
|
47
41
|
return result;
|
|
48
|
-
}
|
|
49
|
-
|
|
42
|
+
}
|
|
50
43
|
|
|
44
|
+
// ProseMirror always require a child under doc
|
|
51
45
|
if (result.type === 'doc' && useSpecBasedValidator) {
|
|
52
46
|
if (Array.isArray(result.content) && result.content.length === 0) {
|
|
53
47
|
result.content.push({
|
|
54
48
|
type: 'paragraph',
|
|
55
49
|
content: []
|
|
56
50
|
});
|
|
57
|
-
}
|
|
58
|
-
|
|
51
|
+
}
|
|
59
52
|
|
|
53
|
+
// Just making sure doc is always valid
|
|
60
54
|
if (!result.version) {
|
|
61
55
|
result.version = 1;
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
return result;
|
|
66
59
|
};
|
|
67
|
-
|
|
68
60
|
const memoValidation = memoizeOne(_validation, (newArgs, lastArgs) => {
|
|
69
61
|
const [newDoc, newSchema, newADFStage, newUseSpecValidator] = newArgs;
|
|
70
|
-
const [oldDoc, oldSchema, oldADFStage, oldUseSpecValidator] = lastArgs;
|
|
62
|
+
const [oldDoc, oldSchema, oldADFStage, oldUseSpecValidator] = lastArgs;
|
|
71
63
|
|
|
64
|
+
// we're ignoring changes to dispatchAnalyticsEvent in this check
|
|
72
65
|
const result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator;
|
|
73
66
|
return result;
|
|
74
67
|
});
|
|
75
|
-
|
|
76
68
|
const areDocsEqual = (docA, docB) => {
|
|
77
69
|
if (docA === docB) {
|
|
78
70
|
return true;
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
if (typeof docA === 'string' && typeof docB === 'string') {
|
|
82
73
|
return docA === docB;
|
|
83
|
-
}
|
|
84
|
-
|
|
74
|
+
}
|
|
85
75
|
|
|
76
|
+
// PMNode
|
|
86
77
|
if (docA.type && docA.toJSON && docB.type && docB.toJSON) {
|
|
87
78
|
return JSON.stringify(docA.toJSON()) === JSON.stringify(docB.toJSON());
|
|
88
|
-
}
|
|
89
|
-
|
|
79
|
+
}
|
|
90
80
|
|
|
81
|
+
// Object
|
|
91
82
|
return JSON.stringify(docA) === JSON.stringify(docB);
|
|
92
83
|
};
|
|
93
|
-
|
|
94
84
|
const _serializeFragment = (serializer, doc) => {
|
|
95
85
|
return serializer.serializeFragment(doc.content);
|
|
96
86
|
};
|
|
97
|
-
|
|
98
87
|
const memoSerializeFragment = memoizeOne(_serializeFragment, (newArgs, lastArgs) => {
|
|
99
88
|
const [newSerializer, newDoc] = newArgs;
|
|
100
89
|
const [oldSerializer, oldDoc] = lastArgs;
|
|
101
90
|
return newSerializer === oldSerializer && areDocsEqual(newDoc, oldDoc);
|
|
102
91
|
});
|
|
103
|
-
|
|
104
92
|
const _createNodeAndCheck = (schema, doc, dispatchAnalyticsEvent) => {
|
|
105
93
|
const pmNode = schema.nodeFromJSON(doc);
|
|
106
|
-
|
|
107
94
|
try {
|
|
108
95
|
pmNode.check();
|
|
109
96
|
} catch (err) {
|
|
@@ -119,10 +106,8 @@ const _createNodeAndCheck = (schema, doc, dispatchAnalyticsEvent) => {
|
|
|
119
106
|
});
|
|
120
107
|
}
|
|
121
108
|
}
|
|
122
|
-
|
|
123
109
|
return pmNode;
|
|
124
110
|
};
|
|
125
|
-
|
|
126
111
|
const memoCreateNodeAndCheck = memoizeOne(_createNodeAndCheck, (newArgs, lastArgs) => {
|
|
127
112
|
// ignore dispatchAnalyticsEvent
|
|
128
113
|
const [newSchema, newDoc] = newArgs;
|
|
@@ -138,37 +123,36 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
|
|
|
138
123
|
time: sanitizeTime
|
|
139
124
|
} = withStopwatch(() => {
|
|
140
125
|
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent);
|
|
141
|
-
});
|
|
126
|
+
});
|
|
142
127
|
|
|
128
|
+
// save sanitize time to stats
|
|
143
129
|
stat.sanitizeTime = sanitizeTime;
|
|
144
|
-
|
|
145
130
|
if (!validDoc) {
|
|
146
131
|
return {
|
|
147
132
|
stat,
|
|
148
133
|
result: null
|
|
149
134
|
};
|
|
150
135
|
}
|
|
151
|
-
|
|
152
136
|
const {
|
|
153
137
|
output: node,
|
|
154
138
|
time: buildTreeTime
|
|
155
139
|
} = withStopwatch(() => {
|
|
156
140
|
return memoCreateNodeAndCheck(schema, validDoc, dispatchAnalyticsEvent);
|
|
157
|
-
});
|
|
141
|
+
});
|
|
158
142
|
|
|
143
|
+
// save build tree time to stats
|
|
159
144
|
stat.buildTreeTime = buildTreeTime;
|
|
160
145
|
const {
|
|
161
146
|
output: result,
|
|
162
147
|
time: serializeTime
|
|
163
148
|
} = withStopwatch(() => {
|
|
164
149
|
return memoSerializeFragment(serializer, node);
|
|
165
|
-
});
|
|
150
|
+
});
|
|
166
151
|
|
|
152
|
+
// save serialize tree time to stats
|
|
167
153
|
stat.serializeTime = serializeTime;
|
|
168
|
-
|
|
169
154
|
if (dispatchAnalyticsEvent && useSpecBasedValidator) {
|
|
170
155
|
findAndTrackUnsupportedContentNodes(node, schema, dispatchAnalyticsEvent);
|
|
171
|
-
|
|
172
156
|
if (unsupportedContentLevelsTracking !== null && unsupportedContentLevelsTracking !== void 0 && unsupportedContentLevelsTracking.enabled) {
|
|
173
157
|
const documentData = {
|
|
174
158
|
doc: validDoc,
|
|
@@ -178,7 +162,6 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
|
|
|
178
162
|
trackUnsupportedContentLevels(documentData, unsupportedContentLevelsTracking, dispatchAnalyticsEvent);
|
|
179
163
|
}
|
|
180
164
|
}
|
|
181
|
-
|
|
182
165
|
return {
|
|
183
166
|
result,
|
|
184
167
|
stat,
|
|
@@ -1,65 +1,49 @@
|
|
|
1
1
|
import { AddMarkStep } from 'prosemirror-transform';
|
|
2
|
-
|
|
3
2
|
function getStartPos(element) {
|
|
4
3
|
return parseInt(element.dataset.rendererStartPos || '-1', 10);
|
|
5
4
|
}
|
|
6
|
-
|
|
7
5
|
function isPositionPointer(element) {
|
|
8
6
|
return getStartPos(element) > -1;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
8
|
function findParent(element) {
|
|
12
9
|
const {
|
|
13
10
|
parentElement
|
|
14
11
|
} = element;
|
|
15
|
-
|
|
16
12
|
if (!parentElement || isRoot(parentElement)) {
|
|
17
13
|
return null;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
if (isPositionPointer(parentElement)) {
|
|
21
16
|
return parentElement;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
return findParent(parentElement);
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
function findParentBeforePointer(element) {
|
|
28
21
|
const {
|
|
29
22
|
parentElement
|
|
30
23
|
} = element;
|
|
31
|
-
|
|
32
24
|
if (isRoot(parentElement) || !parentElement) {
|
|
33
25
|
return null;
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
if (isPositionPointer(parentElement)) {
|
|
37
28
|
return element;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
return findParentBeforePointer(parentElement);
|
|
41
31
|
}
|
|
42
|
-
|
|
43
32
|
function isElementNode(node) {
|
|
44
33
|
return node.nodeType === Node.ELEMENT_NODE;
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
function isTextNode(node) {
|
|
48
36
|
return node.nodeType === Node.TEXT_NODE;
|
|
49
37
|
}
|
|
50
|
-
|
|
51
38
|
function isNodeInlineMark(node) {
|
|
52
39
|
return isElementNode(node) && Boolean(node.dataset.rendererMark);
|
|
53
40
|
}
|
|
54
|
-
|
|
55
41
|
function isElementInlineMark(element) {
|
|
56
42
|
return !!element && Boolean(element.dataset.rendererMark);
|
|
57
43
|
}
|
|
58
|
-
|
|
59
44
|
function resolveNodePos(node) {
|
|
60
45
|
let resolvedPos = 0;
|
|
61
46
|
let prev = node.previousSibling;
|
|
62
|
-
|
|
63
47
|
while (prev) {
|
|
64
48
|
if (prev && isTextNode(prev)) {
|
|
65
49
|
resolvedPos += (prev.textContent || '').length;
|
|
@@ -70,54 +54,44 @@ function resolveNodePos(node) {
|
|
|
70
54
|
resolvedPos += 1;
|
|
71
55
|
}
|
|
72
56
|
}
|
|
73
|
-
|
|
74
57
|
prev = prev.previousSibling;
|
|
75
58
|
}
|
|
76
|
-
|
|
77
59
|
return resolvedPos;
|
|
78
60
|
}
|
|
79
|
-
|
|
80
61
|
function isRoot(element) {
|
|
81
62
|
return !!element && element.classList.contains('ak-renderer-document');
|
|
82
63
|
}
|
|
83
|
-
|
|
84
64
|
export function resolvePos(node, offset) {
|
|
85
65
|
// If the passed node doesnt exist, we should abort
|
|
86
66
|
if (!node) {
|
|
87
67
|
return false;
|
|
88
68
|
}
|
|
89
|
-
|
|
90
69
|
if (node instanceof HTMLElement && isPositionPointer(node)) {
|
|
91
70
|
return getStartPos(node) + offset;
|
|
92
71
|
}
|
|
72
|
+
const parent = findParent(node);
|
|
93
73
|
|
|
94
|
-
|
|
74
|
+
// Similar to above, if we cant find a parent position pointer
|
|
95
75
|
// we should not proceed.
|
|
96
|
-
|
|
97
76
|
if (!parent) {
|
|
98
77
|
return false;
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
let resolvedPos = getStartPos(parent);
|
|
102
80
|
let current = node;
|
|
103
|
-
|
|
104
81
|
if (current.parentElement && current.parentElement !== parent) {
|
|
105
82
|
// Find the parent element that is a direct child of the position pointer
|
|
106
83
|
// the outter most element from our text position.
|
|
107
|
-
const preParentPointer = findParentBeforePointer(current.parentElement);
|
|
84
|
+
const preParentPointer = findParentBeforePointer(current.parentElement);
|
|
85
|
+
// If our range is inside an inline node
|
|
108
86
|
// We need to move our pointers to parent element
|
|
109
87
|
// since we dont want to count text inside inline nodes at all
|
|
110
|
-
|
|
111
88
|
if (!isElementInlineMark(preParentPointer)) {
|
|
112
89
|
current = current.parentElement;
|
|
113
90
|
offset = 0;
|
|
114
91
|
}
|
|
115
|
-
|
|
116
92
|
resolvedPos += resolveNodePos(current);
|
|
117
|
-
|
|
118
93
|
while (current && current.parentElement !== parent) {
|
|
119
94
|
current = current.parentNode;
|
|
120
|
-
|
|
121
95
|
if (current) {
|
|
122
96
|
resolvedPos += resolveNodePos(current);
|
|
123
97
|
}
|
|
@@ -125,7 +99,6 @@ export function resolvePos(node, offset) {
|
|
|
125
99
|
} else {
|
|
126
100
|
resolvedPos += resolveNodePos(current);
|
|
127
101
|
}
|
|
128
|
-
|
|
129
102
|
return resolvedPos + offset;
|
|
130
103
|
}
|
|
131
104
|
export function getPosFromRange(range) {
|
|
@@ -137,11 +110,9 @@ export function getPosFromRange(range) {
|
|
|
137
110
|
} = range;
|
|
138
111
|
const from = resolvePos(startContainer, startOffset);
|
|
139
112
|
const to = resolvePos(endContainer, endOffset);
|
|
140
|
-
|
|
141
113
|
if (from === false || to === false) {
|
|
142
114
|
return false;
|
|
143
115
|
}
|
|
144
|
-
|
|
145
116
|
return {
|
|
146
117
|
from,
|
|
147
118
|
to
|
|
@@ -5,7 +5,6 @@ export default class TextSerializer {
|
|
|
5
5
|
this.schema = schema;
|
|
6
6
|
this.schema = schema;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
serializeFragment(fragment) {
|
|
10
9
|
const result = [];
|
|
11
10
|
fragment.forEach(n => {
|
|
@@ -13,9 +12,7 @@ export default class TextSerializer {
|
|
|
13
12
|
});
|
|
14
13
|
return result.join('\n').replace(/\n+/g, '\n');
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
static fromSchema(schema = defaultSchema) {
|
|
18
16
|
return new TextSerializer(schema);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { timestampToIsoFormat } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { getText } from '../../utils';
|
|
3
|
-
|
|
4
3
|
const date = (node, schema) => {
|
|
5
4
|
return node.attrs.timestamp ? timestampToIsoFormat(node.attrs.timestamp) : getText(node);
|
|
6
5
|
};
|
|
7
|
-
|
|
8
6
|
export default date;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { reduce } from './';
|
|
2
|
-
|
|
3
2
|
const decisionItem = (node, schema) => {
|
|
4
3
|
const result = [];
|
|
5
4
|
let previousNodeType = '';
|
|
6
5
|
node.forEach(n => {
|
|
7
6
|
const text = reduce(n, schema);
|
|
8
|
-
|
|
9
7
|
if (previousNodeType === 'mention' && !text.startsWith(' ')) {
|
|
10
8
|
result.push(` ${text}`);
|
|
11
9
|
} else {
|
|
12
10
|
result.push(text);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
previousNodeType = n.type.name;
|
|
16
13
|
});
|
|
17
14
|
return `<> ${result.join('').trim()}`;
|
|
18
15
|
};
|
|
19
|
-
|
|
20
16
|
export default decisionItem;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { getText } from '../../utils';
|
|
2
|
-
|
|
3
2
|
const inlineCard = (node, schema) => {
|
|
4
3
|
var _node$attrs$data;
|
|
5
|
-
|
|
6
4
|
return node.attrs.url || ((_node$attrs$data = node.attrs.data) === null || _node$attrs$data === void 0 ? void 0 : _node$attrs$data.url) || getText(node);
|
|
7
5
|
};
|
|
8
|
-
|
|
9
6
|
export default inlineCard;
|
|
@@ -7,13 +7,10 @@ const mediaGroup = node => {
|
|
|
7
7
|
childMediaFilesCount += 1;
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
|
-
|
|
11
10
|
if (childMediaFilesCount) {
|
|
12
11
|
const postfix = childMediaFilesCount > 1 ? 'Files' : 'File';
|
|
13
12
|
return `📎 ${childMediaFilesCount} ${postfix}`;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
return '';
|
|
17
15
|
};
|
|
18
|
-
|
|
19
16
|
export default mediaGroup;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getOrderFromOrderedListNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { reduce } from './';
|
|
3
|
-
|
|
4
3
|
const orderedList = (node, schema) => {
|
|
5
4
|
const result = [];
|
|
6
5
|
const order = getOrderFromOrderedListNode(node);
|
|
@@ -9,5 +8,4 @@ const orderedList = (node, schema) => {
|
|
|
9
8
|
});
|
|
10
9
|
return result.join('\n');
|
|
11
10
|
};
|
|
12
|
-
|
|
13
11
|
export default orderedList;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { reduce } from './';
|
|
2
|
-
|
|
3
2
|
const paragraph = (node, schema) => {
|
|
4
3
|
const result = [];
|
|
5
4
|
let previousNodeType = '';
|
|
6
5
|
node.forEach(n => {
|
|
7
6
|
const text = reduce(n, schema);
|
|
8
|
-
|
|
9
7
|
if (previousNodeType === 'mention' && !text.startsWith(' ')) {
|
|
10
8
|
result.push(` ${text}`);
|
|
11
9
|
} else {
|
|
12
10
|
result.push(text);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
previousNodeType = n.type.name;
|
|
16
13
|
});
|
|
17
14
|
return result.join('').trim();
|
|
18
15
|
};
|
|
19
|
-
|
|
20
16
|
export default paragraph;
|