@atlaskit/editor-common 72.2.0 → 72.2.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/__tests_external__/cases/fundamentals/collection.js +0 -5
- package/dist/cjs/__tests_external__/cases/fundamentals/test-cases/editor-is-present.js +0 -4
- package/dist/cjs/__tests_external__/cases/fundamentals/test-cases/editor-typing.js +0 -8
- package/dist/cjs/__tests_external__/cases/smart-links/index.js +0 -4
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/block/delete.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/block/edit.js +2 -12
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/block/index.js +0 -6
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/block/insert.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/embed/delete.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/embed/edit.js +2 -12
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/embed/index.js +0 -6
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/embed/insert.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/inline/delete.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/inline/edit.js +2 -12
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/inline/index.js +0 -7
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/inline/insert.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/inline/unlink.js +1 -8
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/url/index.js +0 -4
- package/dist/cjs/__tests_external__/cases/smart-links/test-cases/url/insert.js +1 -8
- package/dist/cjs/__tests_external__/index.js +0 -3
- package/dist/cjs/__tests_external__/page-objects/Editor.js +0 -16
- package/dist/cjs/__tests_external__/page-objects/EditorSmartLink.js +0 -29
- package/dist/cjs/__tests_external__/page-objects/Renderer.js +0 -14
- package/dist/cjs/analytics/index.js +0 -1
- package/dist/cjs/analytics/types/enums.js +0 -15
- package/dist/cjs/analytics/types/extension-events.js +0 -4
- package/dist/cjs/analytics/types/format-events.js +0 -3
- package/dist/cjs/analytics/types/general-events.js +0 -7
- package/dist/cjs/analytics/types/index.js +0 -14
- package/dist/cjs/analytics/types/inline-comment-events.js +0 -1
- package/dist/cjs/analytics/types/insert-events.js +0 -7
- package/dist/cjs/analytics/types/list-events.js +0 -3
- package/dist/cjs/analytics/types/node-events.js +0 -3
- package/dist/cjs/analytics/types/substitute-events.js +0 -3
- package/dist/cjs/analytics/types/table-events.js +0 -4
- package/dist/cjs/analytics/types/toolbar-button.js +0 -1
- package/dist/cjs/analytics/types/utils.js +0 -3
- package/dist/cjs/core-utils/index.js +0 -1
- package/dist/cjs/core-utils/inside.js +2 -5
- package/dist/cjs/emoji.js +0 -3
- package/dist/cjs/event-dispatcher/index.js +0 -14
- package/dist/cjs/extensions/combine-extension-providers.js +2 -6
- package/dist/cjs/extensions/default-extension-provider.js +0 -26
- package/dist/cjs/extensions/extension-fields-helpers.js +0 -35
- package/dist/cjs/extensions/extension-handlers.js +0 -27
- package/dist/cjs/extensions/index.js +0 -8
- package/dist/cjs/extensions/manifest-helpers.js +4 -30
- package/dist/cjs/extensions/module-helpers.js +17 -89
- package/dist/cjs/extensions/types/field-definitions.js +1 -10
- package/dist/cjs/extensions/types/index.js +0 -1
- package/dist/cjs/extensions.js +0 -1
- 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 -27
- 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/languages.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/icons/index.js +0 -11
- package/dist/cjs/icons/shared/PanelErrorIcon.js +0 -7
- package/dist/cjs/icons/shared/PanelInfoIcon.js +0 -7
- package/dist/cjs/icons/shared/PanelNoteIcon.js +0 -7
- package/dist/cjs/icons/shared/PanelSuccessIcon.js +0 -7
- package/dist/cjs/icons/shared/PanelWarningIcon.js +0 -7
- package/dist/cjs/icons/shared/table.js +1 -3
- package/dist/cjs/in-product.js +0 -1
- package/dist/cjs/keymaps/index.js +2 -50
- package/dist/cjs/mention.js +0 -3
- package/dist/cjs/messages/codeBidiWarning.js +0 -2
- package/dist/cjs/messages/codeBlockCopyButton.js +0 -2
- package/dist/cjs/messages/index.js +0 -8
- package/dist/cjs/messages/insert-block.js +0 -2
- package/dist/cjs/messages/link.js +0 -2
- package/dist/cjs/messages/unsupportedContent.js +0 -2
- package/dist/cjs/node-width/index.js +2 -20
- package/dist/cjs/normalize-feature-flags.js +6 -25
- package/dist/cjs/panel.js +0 -1
- package/dist/cjs/provider-factory/context.js +3 -17
- package/dist/cjs/provider-factory/provider-factory.js +0 -19
- package/dist/cjs/provider-factory/with-providers.js +5 -28
- package/dist/cjs/provider-factory.js +0 -4
- package/dist/cjs/provider-helpers/combine-providers.js +3 -33
- package/dist/cjs/provider-helpers/index.js +0 -2
- package/dist/cjs/provider-helpers/promise-helpers.js +3 -15
- package/dist/cjs/react-node-view/index.js +18 -48
- package/dist/cjs/safe-plugin/index.js +1 -14
- package/dist/cjs/selection/gap-cursor/selection.js +8 -44
- package/dist/cjs/selection/gap-cursor/utils/index.js +0 -2
- package/dist/cjs/selection/gap-cursor/utils/is-ignored.js +0 -2
- package/dist/cjs/selection/gap-cursor/utils/is-valid-target-node.js +0 -3
- package/dist/cjs/selection/index.js +0 -4
- package/dist/cjs/selection/types.js +0 -1
- package/dist/cjs/selection/utils.js +0 -12
- package/dist/cjs/styles/index.js +0 -23
- package/dist/cjs/styles/shared/annotation.js +0 -11
- package/dist/cjs/styles/shared/block-marks.js +0 -5
- package/dist/cjs/styles/shared/blockquote.js +0 -7
- package/dist/cjs/styles/shared/code-block.js +0 -11
- package/dist/cjs/styles/shared/code-mark.js +0 -9
- package/dist/cjs/styles/shared/column-layout.js +0 -6
- package/dist/cjs/styles/shared/date.js +0 -5
- package/dist/cjs/styles/shared/emoji.js +0 -2
- package/dist/cjs/styles/shared/extension.js +0 -2
- package/dist/cjs/styles/shared/headings.js +0 -7
- package/dist/cjs/styles/shared/indentation.js +0 -5
- package/dist/cjs/styles/shared/layout.js +0 -2
- package/dist/cjs/styles/shared/link.js +0 -5
- package/dist/cjs/styles/shared/lists.js +2 -21
- package/dist/cjs/styles/shared/media-single.js +0 -5
- package/dist/cjs/styles/shared/panel.js +15 -41
- package/dist/cjs/styles/shared/paragraph.js +0 -6
- package/dist/cjs/styles/shared/rule.js +2 -10
- package/dist/cjs/styles/shared/shadow.js +1 -9
- package/dist/cjs/styles/shared/smart-card.js +0 -3
- package/dist/cjs/styles/shared/table.js +0 -20
- package/dist/cjs/styles/shared/task-decision.js +0 -6
- package/dist/cjs/styles/shared/text-color.js +0 -5
- package/dist/cjs/styles/shared/whitespace.js +0 -5
- package/dist/cjs/transforms/expand.js +7 -16
- package/dist/cjs/transforms/extension.js +2 -7
- package/dist/cjs/transforms/index.js +0 -3
- package/dist/cjs/transforms/layout.js +9 -15
- package/dist/cjs/type-ahead/index.js +0 -3
- package/dist/cjs/types/annotation/emitter.js +0 -11
- package/dist/cjs/types/annotation/index.js +0 -1
- package/dist/cjs/types/index.js +0 -4
- package/dist/cjs/types/toolbar.js +0 -5
- package/dist/cjs/ufo/experience-store.js +0 -24
- package/dist/cjs/ufo/index.js +0 -1
- package/dist/cjs/ui/BaseTheme/index.js +3 -21
- package/dist/cjs/ui/Caption/index.js +5 -29
- package/dist/cjs/ui/Caption/messages.js +0 -2
- package/dist/cjs/ui/DropList/index.js +18 -51
- package/dist/cjs/ui/Emoji/index.js +7 -33
- package/dist/cjs/ui/ErrorBoundary/index.js +0 -22
- package/dist/cjs/ui/Expand/index.js +5 -31
- package/dist/cjs/ui/IntlErrorBoundary/index.js +0 -24
- package/dist/cjs/ui/IntlProviderIfMissingWrapper/index.js +0 -9
- package/dist/cjs/ui/Layer/index.js +16 -46
- package/dist/cjs/ui/Layer/internal/helpers.js +0 -2
- package/dist/cjs/ui/MediaSingle/grid.js +0 -8
- package/dist/cjs/ui/MediaSingle/index.js +26 -44
- package/dist/cjs/ui/MediaSingle/link.js +0 -5
- package/dist/cjs/ui/MediaSingle/styled.js +11 -50
- package/dist/cjs/ui/Mention/index.js +5 -27
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +8 -16
- package/dist/cjs/ui/Mention/mention-with-providers.js +5 -33
- package/dist/cjs/ui/Messages/index.js +0 -18
- package/dist/cjs/ui/OverflowShadow/index.js +3 -48
- package/dist/cjs/ui/OverflowShadow/shadowObserver.js +2 -26
- package/dist/cjs/ui/Popup/index.js +28 -80
- package/dist/cjs/ui/Popup/utils.js +67 -132
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +3 -13
- package/dist/cjs/ui/PortalProvider/index.js +16 -73
- package/dist/cjs/ui/UnsupportedBlock/index.js +5 -29
- package/dist/cjs/ui/UnsupportedInline/index.js +5 -29
- package/dist/cjs/ui/WidthProvider/index.js +1 -31
- package/dist/cjs/ui/WithCreateAnalyticsEvent/index.js +2 -16
- package/dist/cjs/ui/clear-next-sibling-margin-top.js +0 -5
- package/dist/cjs/ui/index.js +0 -23
- package/dist/cjs/ui/unsupported-content-helper.js +0 -5
- package/dist/cjs/ui/with-outer-listeners.js +0 -25
- package/dist/cjs/ui-color/ColorPalette/Color/index.js +12 -40
- package/dist/cjs/ui-color/ColorPalette/Color/styles.js +0 -10
- package/dist/cjs/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +0 -7
- package/dist/cjs/ui-color/ColorPalette/Palettes/common.js +4 -12
- package/dist/cjs/ui-color/ColorPalette/Palettes/getColorMessage.js +0 -3
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +0 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessages.js +0 -3
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +0 -8
- package/dist/cjs/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +0 -10
- package/dist/cjs/ui-color/ColorPalette/Palettes/statusColorPalette.js +0 -7
- package/dist/cjs/ui-color/ColorPalette/Palettes/textColorPalette.js +2 -9
- package/dist/cjs/ui-color/ColorPalette/index.js +16 -38
- package/dist/cjs/ui-color/ColorPalette/styles.js +0 -6
- package/dist/cjs/ui-color/index.js +0 -9
- package/dist/cjs/ui-menu/Dropdown/index.js +14 -38
- package/dist/cjs/ui-menu/DropdownMenu/index.js +23 -75
- package/dist/cjs/ui-menu/MenuArrowKeyNavigationProvider/index.js +16 -49
- package/dist/cjs/ui-menu/ToolbarButton/index.js +23 -46
- package/dist/cjs/ui-menu/ToolbarButton/styles.js +0 -6
- package/dist/cjs/ui-menu/index.js +0 -7
- package/dist/cjs/ui-react/ReactEditorViewContext.js +0 -4
- package/dist/cjs/ui-react/index.js +0 -3
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +9 -49
- package/dist/cjs/utils/analytics.js +0 -14
- package/dist/cjs/utils/annotation/index.js +5 -13
- package/dist/cjs/utils/breakout.js +7 -23
- package/dist/cjs/utils/browser-extensions.js +28 -56
- package/dist/cjs/utils/browser.js +0 -2
- package/dist/cjs/utils/builder.js +0 -10
- package/dist/cjs/utils/collab.js +0 -4
- package/dist/cjs/utils/compare-props.js +11 -25
- package/dist/cjs/utils/compareNodes.js +7 -53
- package/dist/cjs/utils/compose.js +0 -2
- package/dist/cjs/utils/date.js +4 -25
- package/dist/cjs/utils/dom.js +6 -29
- package/dist/cjs/utils/editor-core-utils.js +8 -33
- package/dist/cjs/utils/error-reporter.js +0 -7
- package/dist/cjs/utils/extension-handler.js +0 -3
- package/dist/cjs/utils/get-performance-options.js +4 -12
- package/dist/cjs/utils/getModeFromTheme.js +0 -1
- package/dist/cjs/utils/imageLoader.js +0 -27
- package/dist/cjs/utils/index.js +0 -40
- package/dist/cjs/utils/is-text-input.js +5 -11
- package/dist/cjs/utils/list.js +3 -13
- package/dist/cjs/utils/macro.js +1 -7
- package/dist/cjs/utils/nodes.js +4 -31
- package/dist/cjs/utils/outdated-browsers.js +0 -10
- package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +4 -14
- package/dist/cjs/utils/performance/is-performance-api-available.js +0 -4
- package/dist/cjs/utils/performance/measure-render.js +1 -11
- package/dist/cjs/utils/performance/measure-tti.js +3 -17
- package/dist/cjs/utils/performance/measure.js +0 -11
- package/dist/cjs/utils/performance/navigation.js +0 -5
- package/dist/cjs/utils/plugin-state-factory.js +3 -11
- package/dist/cjs/utils/profiler/render-count.js +4 -24
- package/dist/cjs/utils/referentiality.js +30 -88
- package/dist/cjs/utils/sendLogs.js +0 -2
- package/dist/cjs/utils/should-force-tracking.js +4 -7
- package/dist/cjs/utils/slice.js +0 -17
- package/dist/cjs/utils/table.js +4 -13
- package/dist/cjs/utils/track-unsupported-content.js +14 -39
- package/dist/cjs/utils/traversor.js +0 -14
- package/dist/cjs/utils/unsupportedContent/get-unsupported-content-level-data.js +5 -21
- package/dist/cjs/utils/validate-using-spec.js +5 -36
- package/dist/cjs/utils/validator.js +26 -188
- package/dist/cjs/validator.js +0 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/with-plugin-state/index.js +7 -55
- package/dist/es2019/__tests_external__/cases/fundamentals/test-cases/editor-typing.js +0 -3
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/block/delete.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/block/edit.js +0 -2
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/block/insert.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/embed/delete.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/embed/edit.js +0 -2
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/embed/insert.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/inline/delete.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/inline/edit.js +0 -2
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/inline/insert.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/inline/unlink.js +0 -1
- package/dist/es2019/__tests_external__/cases/smart-links/test-cases/url/insert.js +0 -1
- package/dist/es2019/__tests_external__/page-objects/Editor.js +0 -4
- package/dist/es2019/__tests_external__/page-objects/EditorSmartLink.js +0 -28
- package/dist/es2019/__tests_external__/page-objects/Renderer.js +0 -2
- package/dist/es2019/analytics/types/enums.js +0 -15
- package/dist/es2019/analytics/types/extension-events.js +2 -3
- package/dist/es2019/analytics/types/format-events.js +0 -3
- package/dist/es2019/analytics/types/general-events.js +0 -7
- package/dist/es2019/analytics/types/inline-comment-events.js +0 -1
- package/dist/es2019/analytics/types/insert-events.js +0 -7
- package/dist/es2019/analytics/types/list-events.js +0 -3
- package/dist/es2019/analytics/types/node-events.js +0 -3
- package/dist/es2019/analytics/types/substitute-events.js +0 -3
- package/dist/es2019/analytics/types/table-events.js +2 -3
- package/dist/es2019/analytics/types/toolbar-button.js +0 -1
- package/dist/es2019/analytics/types/utils.js +0 -3
- package/dist/es2019/event-dispatcher/index.js +1 -12
- package/dist/es2019/extensions/combine-extension-providers.js +0 -5
- package/dist/es2019/extensions/default-extension-provider.js +0 -8
- package/dist/es2019/extensions/extension-fields-helpers.js +4 -10
- package/dist/es2019/extensions/extension-handlers.js +1 -8
- package/dist/es2019/extensions/manifest-helpers.js +2 -7
- package/dist/es2019/extensions/module-helpers.js +10 -43
- package/dist/es2019/extensions/types/field-definitions.js +1 -0
- package/dist/es2019/icons/index.js +1 -3
- package/dist/es2019/icons/shared/PanelErrorIcon.js +0 -2
- package/dist/es2019/icons/shared/PanelInfoIcon.js +0 -2
- package/dist/es2019/icons/shared/PanelNoteIcon.js +0 -2
- package/dist/es2019/icons/shared/PanelSuccessIcon.js +0 -2
- package/dist/es2019/icons/shared/PanelWarningIcon.js +0 -2
- package/dist/es2019/keymaps/index.js +0 -24
- package/dist/es2019/node-width/index.js +3 -14
- package/dist/es2019/normalize-feature-flags.js +1 -11
- package/dist/es2019/provider-factory/context.js +0 -1
- package/dist/es2019/provider-factory/provider-factory.js +0 -25
- package/dist/es2019/provider-factory/with-providers.js +2 -8
- package/dist/es2019/provider-helpers/combine-providers.js +3 -13
- package/dist/es2019/provider-helpers/promise-helpers.js +3 -10
- package/dist/es2019/react-node-view/index.js +10 -34
- package/dist/es2019/safe-plugin/index.js +1 -1
- package/dist/es2019/selection/gap-cursor/selection.js +6 -31
- package/dist/es2019/selection/types.js +0 -1
- package/dist/es2019/selection/utils.js +0 -8
- package/dist/es2019/styles/shared/headings.js +3 -2
- package/dist/es2019/styles/shared/lists.js +0 -8
- package/dist/es2019/styles/shared/panel.js +13 -12
- package/dist/es2019/styles/shared/paragraph.js +2 -1
- package/dist/es2019/styles/shared/rule.js +2 -1
- package/dist/es2019/styles/shared/shadow.js +2 -0
- package/dist/es2019/styles/shared/table.js +1 -5
- package/dist/es2019/transforms/expand.js +3 -3
- package/dist/es2019/transforms/extension.js +3 -4
- package/dist/es2019/transforms/layout.js +9 -10
- package/dist/es2019/type-ahead/index.js +0 -3
- package/dist/es2019/types/annotation/emitter.js +0 -8
- package/dist/es2019/types/index.js +0 -2
- package/dist/es2019/types/toolbar.js +0 -5
- package/dist/es2019/ufo/experience-store.js +0 -25
- package/dist/es2019/ui/BaseTheme/index.js +0 -2
- package/dist/es2019/ui/Caption/index.js +0 -2
- package/dist/es2019/ui/DropList/index.js +9 -25
- package/dist/es2019/ui/Emoji/index.js +0 -11
- package/dist/es2019/ui/ErrorBoundary/index.js +0 -8
- package/dist/es2019/ui/Expand/index.js +2 -10
- package/dist/es2019/ui/IntlErrorBoundary/index.js +0 -8
- package/dist/es2019/ui/IntlProviderIfMissingWrapper/index.js +0 -4
- package/dist/es2019/ui/Layer/index.js +13 -29
- package/dist/es2019/ui/Layer/internal/helpers.js +0 -2
- package/dist/es2019/ui/MediaSingle/index.js +7 -12
- package/dist/es2019/ui/MediaSingle/styled.js +2 -25
- package/dist/es2019/ui/Mention/index.js +0 -5
- package/dist/es2019/ui/Mention/mention-with-providers.js +0 -8
- package/dist/es2019/ui/Messages/index.js +1 -2
- package/dist/es2019/ui/OverflowShadow/index.js +0 -32
- package/dist/es2019/ui/OverflowShadow/shadowObserver.js +0 -14
- package/dist/es2019/ui/Popup/index.js +11 -59
- package/dist/es2019/ui/Popup/utils.js +18 -57
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -1
- package/dist/es2019/ui/PortalProvider/index.js +7 -35
- package/dist/es2019/ui/UnsupportedBlock/index.js +0 -2
- package/dist/es2019/ui/UnsupportedInline/index.js +0 -2
- package/dist/es2019/ui/WidthProvider/index.js +0 -9
- package/dist/es2019/ui/WithCreateAnalyticsEvent/index.js +0 -1
- package/dist/es2019/ui/clear-next-sibling-margin-top.js +2 -1
- package/dist/es2019/ui/unsupported-content-helper.js +0 -4
- package/dist/es2019/ui/with-outer-listeners.js +0 -8
- package/dist/es2019/ui-color/ColorPalette/Color/index.js +0 -10
- package/dist/es2019/ui-color/ColorPalette/Color/styles.js +1 -4
- package/dist/es2019/ui-color/ColorPalette/Palettes/common.js +2 -4
- package/dist/es2019/ui-color/ColorPalette/Palettes/getColorMessage.js +0 -2
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +5 -3
- package/dist/es2019/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +4 -4
- package/dist/es2019/ui-color/ColorPalette/Palettes/statusColorPalette.js +0 -2
- package/dist/es2019/ui-color/ColorPalette/Palettes/textColorPalette.js +2 -3
- package/dist/es2019/ui-color/ColorPalette/index.js +3 -10
- package/dist/es2019/ui-menu/Dropdown/index.js +0 -7
- package/dist/es2019/ui-menu/DropdownMenu/index.js +1 -21
- package/dist/es2019/ui-menu/MenuArrowKeyNavigationProvider/index.js +8 -31
- package/dist/es2019/ui-menu/ToolbarButton/index.js +2 -6
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +4 -22
- package/dist/es2019/utils/analytics.js +0 -8
- package/dist/es2019/utils/annotation/index.js +3 -7
- package/dist/es2019/utils/breakout.js +6 -13
- package/dist/es2019/utils/browser-extensions.js +10 -22
- package/dist/es2019/utils/browser.js +0 -2
- package/dist/es2019/utils/builder.js +0 -2
- package/dist/es2019/utils/collab.js +0 -2
- package/dist/es2019/utils/compare-props.js +5 -4
- package/dist/es2019/utils/compareNodes.js +3 -42
- package/dist/es2019/utils/date.js +4 -11
- package/dist/es2019/utils/dom.js +6 -19
- package/dist/es2019/utils/editor-core-utils.js +6 -11
- package/dist/es2019/utils/error-reporter.js +0 -4
- package/dist/es2019/utils/get-performance-options.js +3 -3
- package/dist/es2019/utils/imageLoader.js +0 -11
- package/dist/es2019/utils/is-text-input.js +1 -2
- package/dist/es2019/utils/list.js +3 -7
- package/dist/es2019/utils/macro.js +0 -3
- package/dist/es2019/utils/nodes.js +3 -11
- package/dist/es2019/utils/outdated-browsers.js +0 -8
- package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +0 -4
- package/dist/es2019/utils/performance/is-performance-api-available.js +0 -1
- package/dist/es2019/utils/performance/measure-render.js +2 -10
- package/dist/es2019/utils/performance/measure-tti.js +3 -11
- package/dist/es2019/utils/performance/measure.js +0 -6
- package/dist/es2019/utils/performance/navigation.js +0 -3
- package/dist/es2019/utils/plugin-state-factory.js +1 -10
- package/dist/es2019/utils/profiler/render-count.js +10 -23
- package/dist/es2019/utils/referentiality.js +24 -65
- package/dist/es2019/utils/should-force-tracking.js +2 -1
- package/dist/es2019/utils/slice.js +1 -9
- package/dist/es2019/utils/table.js +2 -6
- package/dist/es2019/utils/track-unsupported-content.js +6 -11
- package/dist/es2019/utils/traversor.js +0 -13
- package/dist/es2019/utils/unsupportedContent/get-unsupported-content-level-data.js +3 -15
- package/dist/es2019/utils/validate-using-spec.js +3 -25
- package/dist/es2019/utils/validator.js +10 -149
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/with-plugin-state/index.js +5 -46
- package/dist/esm/__tests_external__/cases/fundamentals/test-cases/editor-typing.js +0 -3
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/block/delete.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/block/edit.js +2 -4
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/block/insert.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/embed/delete.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/embed/edit.js +2 -4
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/embed/insert.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/inline/delete.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/inline/edit.js +2 -4
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/inline/insert.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/inline/unlink.js +1 -2
- package/dist/esm/__tests_external__/cases/smart-links/test-cases/url/insert.js +1 -2
- package/dist/esm/__tests_external__/page-objects/Editor.js +0 -9
- package/dist/esm/__tests_external__/page-objects/EditorSmartLink.js +0 -23
- package/dist/esm/__tests_external__/page-objects/Renderer.js +0 -8
- package/dist/esm/analytics/types/enums.js +0 -15
- package/dist/esm/analytics/types/extension-events.js +2 -3
- package/dist/esm/analytics/types/format-events.js +0 -3
- package/dist/esm/analytics/types/general-events.js +0 -7
- package/dist/esm/analytics/types/inline-comment-events.js +0 -1
- package/dist/esm/analytics/types/insert-events.js +0 -7
- package/dist/esm/analytics/types/list-events.js +0 -3
- package/dist/esm/analytics/types/node-events.js +0 -3
- package/dist/esm/analytics/types/substitute-events.js +0 -3
- package/dist/esm/analytics/types/table-events.js +2 -3
- package/dist/esm/analytics/types/toolbar-button.js +0 -1
- package/dist/esm/analytics/types/utils.js +0 -3
- package/dist/esm/core-utils/inside.js +2 -2
- package/dist/esm/event-dispatcher/index.js +1 -9
- package/dist/esm/extensions/combine-extension-providers.js +2 -4
- package/dist/esm/extensions/default-extension-provider.js +0 -22
- package/dist/esm/extensions/extension-fields-helpers.js +3 -29
- package/dist/esm/extensions/extension-handlers.js +1 -18
- package/dist/esm/extensions/manifest-helpers.js +4 -17
- package/dist/esm/extensions/module-helpers.js +17 -74
- package/dist/esm/extensions/types/field-definitions.js +1 -0
- package/dist/esm/icons/index.js +1 -3
- package/dist/esm/icons/shared/PanelErrorIcon.js +0 -2
- package/dist/esm/icons/shared/PanelInfoIcon.js +0 -2
- package/dist/esm/icons/shared/PanelNoteIcon.js +0 -2
- package/dist/esm/icons/shared/PanelSuccessIcon.js +0 -2
- package/dist/esm/icons/shared/PanelWarningIcon.js +0 -2
- package/dist/esm/keymaps/index.js +2 -28
- package/dist/esm/node-width/index.js +3 -14
- package/dist/esm/normalize-feature-flags.js +6 -19
- package/dist/esm/provider-factory/context.js +3 -5
- package/dist/esm/provider-factory/provider-factory.js +0 -18
- package/dist/esm/provider-factory/with-providers.js +5 -23
- package/dist/esm/provider-helpers/combine-providers.js +3 -27
- package/dist/esm/provider-helpers/promise-helpers.js +3 -10
- package/dist/esm/react-node-view/index.js +18 -42
- package/dist/esm/safe-plugin/index.js +1 -7
- package/dist/esm/selection/gap-cursor/selection.js +8 -35
- package/dist/esm/selection/types.js +0 -1
- package/dist/esm/selection/utils.js +0 -8
- package/dist/esm/styles/shared/annotation.js +0 -2
- package/dist/esm/styles/shared/block-marks.js +0 -2
- package/dist/esm/styles/shared/blockquote.js +0 -2
- package/dist/esm/styles/shared/code-block.js +0 -2
- package/dist/esm/styles/shared/code-mark.js +0 -2
- package/dist/esm/styles/shared/column-layout.js +0 -2
- package/dist/esm/styles/shared/date.js +0 -2
- package/dist/esm/styles/shared/headings.js +3 -4
- package/dist/esm/styles/shared/indentation.js +0 -2
- package/dist/esm/styles/shared/link.js +0 -2
- package/dist/esm/styles/shared/lists.js +2 -13
- package/dist/esm/styles/shared/media-single.js +0 -2
- package/dist/esm/styles/shared/panel.js +15 -17
- package/dist/esm/styles/shared/paragraph.js +2 -3
- package/dist/esm/styles/shared/rule.js +2 -3
- package/dist/esm/styles/shared/shadow.js +2 -2
- package/dist/esm/styles/shared/table.js +1 -8
- package/dist/esm/styles/shared/task-decision.js +0 -2
- package/dist/esm/styles/shared/text-color.js +0 -2
- package/dist/esm/styles/shared/whitespace.js +0 -2
- package/dist/esm/transforms/expand.js +7 -7
- package/dist/esm/transforms/extension.js +3 -4
- package/dist/esm/transforms/layout.js +9 -10
- package/dist/esm/type-ahead/index.js +0 -3
- package/dist/esm/types/annotation/emitter.js +0 -6
- package/dist/esm/types/index.js +0 -2
- package/dist/esm/types/toolbar.js +0 -5
- package/dist/esm/ufo/experience-store.js +0 -19
- package/dist/esm/ui/BaseTheme/index.js +3 -7
- package/dist/esm/ui/Caption/index.js +5 -14
- package/dist/esm/ui/DropList/index.js +18 -47
- package/dist/esm/ui/Emoji/index.js +7 -26
- package/dist/esm/ui/ErrorBoundary/index.js +0 -14
- package/dist/esm/ui/Expand/index.js +5 -15
- package/dist/esm/ui/IntlErrorBoundary/index.js +0 -16
- package/dist/esm/ui/IntlProviderIfMissingWrapper/index.js +0 -4
- package/dist/esm/ui/Layer/index.js +16 -39
- package/dist/esm/ui/Layer/internal/helpers.js +0 -2
- package/dist/esm/ui/MediaSingle/index.js +25 -32
- package/dist/esm/ui/MediaSingle/link.js +0 -2
- package/dist/esm/ui/MediaSingle/styled.js +11 -39
- package/dist/esm/ui/Mention/index.js +5 -18
- package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -8
- package/dist/esm/ui/Mention/mention-with-providers.js +5 -21
- package/dist/esm/ui/Messages/index.js +1 -4
- package/dist/esm/ui/OverflowShadow/index.js +3 -46
- package/dist/esm/ui/OverflowShadow/shadowObserver.js +2 -27
- package/dist/esm/ui/Popup/index.js +28 -80
- package/dist/esm/ui/Popup/utils.js +67 -123
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +3 -3
- package/dist/esm/ui/PortalProvider/index.js +17 -61
- package/dist/esm/ui/UnsupportedBlock/index.js +5 -11
- package/dist/esm/ui/UnsupportedInline/index.js +5 -11
- package/dist/esm/ui/WidthProvider/index.js +1 -17
- package/dist/esm/ui/WithCreateAnalyticsEvent/index.js +2 -10
- package/dist/esm/ui/clear-next-sibling-margin-top.js +2 -3
- package/dist/esm/ui/unsupported-content-helper.js +0 -4
- package/dist/esm/ui/with-outer-listeners.js +0 -15
- package/dist/esm/ui-color/ColorPalette/Color/index.js +12 -27
- package/dist/esm/ui-color/ColorPalette/Color/styles.js +1 -6
- package/dist/esm/ui-color/ColorPalette/Palettes/common.js +5 -7
- package/dist/esm/ui-color/ColorPalette/Palettes/getColorMessage.js +0 -2
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +2 -4
- package/dist/esm/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +0 -5
- package/dist/esm/ui-color/ColorPalette/Palettes/statusColorPalette.js +0 -2
- package/dist/esm/ui-color/ColorPalette/Palettes/textColorPalette.js +2 -3
- package/dist/esm/ui-color/ColorPalette/index.js +16 -24
- package/dist/esm/ui-color/ColorPalette/styles.js +0 -2
- package/dist/esm/ui-menu/Dropdown/index.js +14 -27
- package/dist/esm/ui-menu/DropdownMenu/index.js +23 -56
- package/dist/esm/ui-menu/MenuArrowKeyNavigationProvider/index.js +16 -42
- package/dist/esm/ui-menu/ToolbarButton/index.js +23 -32
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +9 -38
- package/dist/esm/utils/analytics.js +0 -8
- package/dist/esm/utils/annotation/index.js +5 -9
- package/dist/esm/utils/breakout.js +8 -15
- package/dist/esm/utils/browser-extensions.js +28 -55
- package/dist/esm/utils/browser.js +0 -2
- package/dist/esm/utils/builder.js +0 -4
- package/dist/esm/utils/collab.js +0 -2
- package/dist/esm/utils/compare-props.js +10 -15
- package/dist/esm/utils/compareNodes.js +7 -48
- package/dist/esm/utils/compose.js +0 -1
- package/dist/esm/utils/date.js +4 -11
- package/dist/esm/utils/dom.js +6 -19
- package/dist/esm/utils/editor-core-utils.js +8 -13
- package/dist/esm/utils/error-reporter.js +0 -5
- package/dist/esm/utils/get-performance-options.js +7 -7
- package/dist/esm/utils/imageLoader.js +0 -18
- package/dist/esm/utils/is-text-input.js +5 -6
- package/dist/esm/utils/list.js +3 -7
- package/dist/esm/utils/macro.js +1 -5
- package/dist/esm/utils/nodes.js +5 -13
- package/dist/esm/utils/outdated-browsers.js +0 -8
- package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +4 -10
- package/dist/esm/utils/performance/is-performance-api-available.js +0 -1
- package/dist/esm/utils/performance/measure-render.js +2 -9
- package/dist/esm/utils/performance/measure-tti.js +3 -12
- package/dist/esm/utils/performance/measure.js +0 -6
- package/dist/esm/utils/performance/navigation.js +0 -3
- package/dist/esm/utils/plugin-state-factory.js +3 -10
- package/dist/esm/utils/profiler/render-count.js +4 -21
- package/dist/esm/utils/referentiality.js +30 -80
- package/dist/esm/utils/should-force-tracking.js +4 -4
- package/dist/esm/utils/slice.js +1 -10
- package/dist/esm/utils/table.js +4 -8
- package/dist/esm/utils/track-unsupported-content.js +14 -31
- package/dist/esm/utils/traversor.js +0 -13
- package/dist/esm/utils/unsupportedContent/get-unsupported-content-level-data.js +5 -18
- package/dist/esm/utils/validate-using-spec.js +5 -29
- package/dist/esm/utils/validator.js +26 -170
- package/dist/esm/version.json +1 -1
- package/dist/esm/with-plugin-state/index.js +7 -55
- package/package.json +4 -4
|
@@ -8,44 +8,31 @@ import { calculatePlacement, calculatePosition, findOverflowScrollParent, valida
|
|
|
8
8
|
export default class Popup extends React.Component {
|
|
9
9
|
constructor(...args) {
|
|
10
10
|
var _window;
|
|
11
|
-
|
|
12
11
|
super(...args);
|
|
13
|
-
|
|
14
12
|
_defineProperty(this, "rafIds", new Set());
|
|
15
|
-
|
|
16
13
|
_defineProperty(this, "state", {
|
|
17
14
|
validPosition: true
|
|
18
15
|
});
|
|
19
|
-
|
|
20
16
|
_defineProperty(this, "popupRef", /*#__PURE__*/React.createRef());
|
|
21
|
-
|
|
22
17
|
_defineProperty(this, "placement", ['', '']);
|
|
23
|
-
|
|
24
18
|
_defineProperty(this, "handleRef", popup => {
|
|
25
19
|
if (!popup) {
|
|
26
20
|
return;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
this.initPopup(popup);
|
|
30
23
|
});
|
|
31
|
-
|
|
32
24
|
_defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => {
|
|
33
25
|
this.updatePosition(this.props);
|
|
34
26
|
}));
|
|
35
|
-
|
|
36
27
|
_defineProperty(this, "onResize", () => this.scheduledUpdatePosition(this.props));
|
|
37
|
-
|
|
38
28
|
_defineProperty(this, "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(() => {
|
|
39
29
|
this.scheduledUpdatePosition(this.props);
|
|
40
30
|
}) : undefined);
|
|
41
|
-
|
|
42
31
|
_defineProperty(this, "initFocusTrap", rafSchedule(() => {
|
|
43
32
|
const popup = this.popupRef.current;
|
|
44
|
-
|
|
45
33
|
if (!popup) {
|
|
46
34
|
return;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
const trapConfig = {
|
|
50
37
|
clickOutsideDeactivates: true,
|
|
51
38
|
escapeDeactivates: true,
|
|
@@ -57,7 +44,6 @@ export default class Popup extends React.Component {
|
|
|
57
44
|
this.focusTrap.activate();
|
|
58
45
|
}));
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
/**
|
|
62
48
|
* Calculates new popup position
|
|
63
49
|
*/
|
|
@@ -78,18 +64,14 @@ export default class Popup extends React.Component {
|
|
|
78
64
|
rect,
|
|
79
65
|
preventOverflow
|
|
80
66
|
} = props;
|
|
81
|
-
|
|
82
67
|
if (!target || !popup) {
|
|
83
68
|
return {};
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
const placement = calculatePlacement(target, boundariesElement || document.body, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow);
|
|
87
|
-
|
|
88
71
|
if (onPlacementChanged && this.placement.join('') !== placement.join('')) {
|
|
89
72
|
onPlacementChanged(placement);
|
|
90
73
|
this.placement = placement;
|
|
91
74
|
}
|
|
92
|
-
|
|
93
75
|
let position = calculatePosition({
|
|
94
76
|
placement,
|
|
95
77
|
popup,
|
|
@@ -105,7 +87,6 @@ export default class Popup extends React.Component {
|
|
|
105
87
|
validPosition: validatePosition(target)
|
|
106
88
|
};
|
|
107
89
|
}
|
|
108
|
-
|
|
109
90
|
updatePosition(props = this.props, state = this.state) {
|
|
110
91
|
const {
|
|
111
92
|
popup
|
|
@@ -114,7 +95,6 @@ export default class Popup extends React.Component {
|
|
|
114
95
|
position,
|
|
115
96
|
validPosition
|
|
116
97
|
} = this.calculatePosition(props, popup);
|
|
117
|
-
|
|
118
98
|
if (position && validPosition) {
|
|
119
99
|
this.setState({
|
|
120
100
|
position,
|
|
@@ -122,7 +102,6 @@ export default class Popup extends React.Component {
|
|
|
122
102
|
});
|
|
123
103
|
}
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
cannotSetPopup(popup, target, overflowScrollParent) {
|
|
127
106
|
/**
|
|
128
107
|
* Check whether:
|
|
@@ -134,23 +113,20 @@ export default class Popup extends React.Component {
|
|
|
134
113
|
*/
|
|
135
114
|
return !target || document.body.contains(target) && popup.offsetParent && !popup.offsetParent.contains(target) || overflowScrollParent && !overflowScrollParent.contains(popup.offsetParent);
|
|
136
115
|
}
|
|
116
|
+
|
|
137
117
|
/**
|
|
138
118
|
* Popup initialization.
|
|
139
119
|
* Checks whether it's possible to position popup along given target, and if it's not throws an error.
|
|
140
120
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
121
|
initPopup(popup) {
|
|
144
122
|
this.popupRef.current = popup;
|
|
145
123
|
const {
|
|
146
124
|
target
|
|
147
125
|
} = this.props;
|
|
148
126
|
const overflowScrollParent = findOverflowScrollParent(popup);
|
|
149
|
-
|
|
150
127
|
if (this.cannotSetPopup(popup, target, overflowScrollParent)) {
|
|
151
128
|
return;
|
|
152
129
|
}
|
|
153
|
-
|
|
154
130
|
this.setState({
|
|
155
131
|
popup
|
|
156
132
|
});
|
|
@@ -165,95 +141,78 @@ export default class Popup extends React.Component {
|
|
|
165
141
|
* So, calling scheduledUpdatePosition to position popup on next request animation frame,
|
|
166
142
|
* which is currently working for most of the floating toolbar and other popups.
|
|
167
143
|
*/
|
|
168
|
-
|
|
169
144
|
this.scheduledUpdatePosition(this.props);
|
|
170
|
-
|
|
171
145
|
if (this.props.focusTrap) {
|
|
172
146
|
this.initFocusTrap();
|
|
173
147
|
}
|
|
174
148
|
}
|
|
175
|
-
|
|
176
149
|
UNSAFE_componentWillReceiveProps(newProps) {
|
|
177
150
|
// We are delaying `updatePosition` otherwise it happens before the children
|
|
178
151
|
// get rendered and we end up with a wrong position
|
|
179
152
|
this.scheduledUpdatePosition(newProps);
|
|
180
153
|
}
|
|
181
|
-
|
|
182
154
|
/**
|
|
183
155
|
* Cancels the initialisation of the focus trap if it has not yet occured
|
|
184
156
|
* Deactivates the focus trap if it exists
|
|
185
157
|
*/
|
|
186
158
|
destroyFocusTrap() {
|
|
187
159
|
var _this$focusTrap;
|
|
188
|
-
|
|
189
160
|
this.initFocusTrap.cancel();
|
|
190
161
|
(_this$focusTrap = this.focusTrap) === null || _this$focusTrap === void 0 ? void 0 : _this$focusTrap.deactivate();
|
|
191
162
|
}
|
|
163
|
+
|
|
192
164
|
/**
|
|
193
165
|
* Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
|
|
194
166
|
*/
|
|
195
|
-
|
|
196
|
-
|
|
197
167
|
handleChangedFocusTrapProp(prevProps) {
|
|
198
168
|
if (prevProps.focusTrap !== this.props.focusTrap) {
|
|
199
169
|
// If currently set to disable, then pause the trap if it exists
|
|
200
170
|
if (!this.props.focusTrap) {
|
|
201
171
|
var _this$focusTrap2;
|
|
202
|
-
|
|
203
172
|
return (_this$focusTrap2 = this.focusTrap) === null || _this$focusTrap2 === void 0 ? void 0 : _this$focusTrap2.pause();
|
|
204
|
-
}
|
|
205
|
-
|
|
173
|
+
}
|
|
206
174
|
|
|
175
|
+
// If set to enabled and trap already exists, unpause
|
|
207
176
|
if (this.focusTrap) {
|
|
208
177
|
this.focusTrap.unpause();
|
|
209
|
-
}
|
|
210
|
-
|
|
178
|
+
}
|
|
211
179
|
|
|
180
|
+
// Else initialise the focus trap
|
|
212
181
|
return this.initFocusTrap();
|
|
213
182
|
}
|
|
214
183
|
}
|
|
215
|
-
|
|
216
184
|
componentDidUpdate(prevProps) {
|
|
217
185
|
this.handleChangedFocusTrapProp(prevProps);
|
|
218
186
|
}
|
|
219
|
-
|
|
220
187
|
componentDidMount() {
|
|
221
188
|
window.addEventListener('resize', this.onResize);
|
|
222
189
|
const {
|
|
223
190
|
stick
|
|
224
191
|
} = this.props;
|
|
225
192
|
this.scrollParentElement = findOverflowScrollParent(this.props.target);
|
|
226
|
-
|
|
227
193
|
if (this.scrollParentElement && this.resizeObserver) {
|
|
228
194
|
this.resizeObserver.observe(this.scrollParentElement);
|
|
229
195
|
}
|
|
230
|
-
|
|
231
196
|
if (stick) {
|
|
232
197
|
this.scrollElement = this.scrollParentElement;
|
|
233
198
|
} else {
|
|
234
199
|
this.scrollElement = this.props.scrollableElement;
|
|
235
200
|
}
|
|
236
|
-
|
|
237
201
|
if (this.scrollElement) {
|
|
238
202
|
this.scrollElement.addEventListener('scroll', this.onResize);
|
|
239
203
|
}
|
|
240
204
|
}
|
|
241
|
-
|
|
242
205
|
componentWillUnmount() {
|
|
243
206
|
window.removeEventListener('resize', this.onResize);
|
|
244
|
-
|
|
245
207
|
if (this.scrollElement) {
|
|
246
208
|
this.scrollElement.removeEventListener('scroll', this.onResize);
|
|
247
209
|
}
|
|
248
|
-
|
|
249
210
|
if (this.scrollParentElement && this.resizeObserver) {
|
|
250
211
|
this.resizeObserver.unobserve(this.scrollParentElement);
|
|
251
212
|
}
|
|
252
|
-
|
|
253
213
|
this.scheduledUpdatePosition.cancel();
|
|
254
214
|
this.destroyFocusTrap();
|
|
255
215
|
}
|
|
256
|
-
|
|
257
216
|
renderPopup() {
|
|
258
217
|
const {
|
|
259
218
|
position
|
|
@@ -261,11 +220,9 @@ export default class Popup extends React.Component {
|
|
|
261
220
|
const {
|
|
262
221
|
shouldRenderPopup
|
|
263
222
|
} = this.props;
|
|
264
|
-
|
|
265
223
|
if (shouldRenderPopup && !shouldRenderPopup(position || {})) {
|
|
266
224
|
return null;
|
|
267
225
|
}
|
|
268
|
-
|
|
269
226
|
return /*#__PURE__*/React.createElement("div", {
|
|
270
227
|
ref: this.handleRef,
|
|
271
228
|
style: {
|
|
@@ -274,12 +231,12 @@ export default class Popup extends React.Component {
|
|
|
274
231
|
...position,
|
|
275
232
|
...this.props.style
|
|
276
233
|
},
|
|
277
|
-
"aria-label": this.props.ariaLabel || 'Popup'
|
|
234
|
+
"aria-label": this.props.ariaLabel || 'Popup'
|
|
235
|
+
// Indicates component is an editor pop. Required for focus handling in Message.tsx
|
|
278
236
|
,
|
|
279
237
|
"data-editor-popup": true
|
|
280
238
|
}, this.props.children);
|
|
281
239
|
}
|
|
282
|
-
|
|
283
240
|
render() {
|
|
284
241
|
const {
|
|
285
242
|
target,
|
|
@@ -288,25 +245,20 @@ export default class Popup extends React.Component {
|
|
|
288
245
|
const {
|
|
289
246
|
validPosition
|
|
290
247
|
} = this.state;
|
|
291
|
-
|
|
292
248
|
if (!target || !validPosition) {
|
|
293
249
|
return null;
|
|
294
250
|
}
|
|
295
|
-
|
|
296
251
|
if (mountTo) {
|
|
297
252
|
return /*#__PURE__*/createPortal(this.renderPopup(), mountTo);
|
|
298
|
-
}
|
|
299
|
-
// which means it will be cropped by "overflow: hidden" container.
|
|
300
|
-
|
|
253
|
+
}
|
|
301
254
|
|
|
255
|
+
// Without mountTo property renders popup as is,
|
|
256
|
+
// which means it will be cropped by "overflow: hidden" container.
|
|
302
257
|
return this.renderPopup();
|
|
303
258
|
}
|
|
304
|
-
|
|
305
259
|
}
|
|
306
|
-
|
|
307
260
|
_defineProperty(Popup, "defaultProps", {
|
|
308
261
|
offset: [0, 0],
|
|
309
262
|
allowOutOfBound: false
|
|
310
263
|
});
|
|
311
|
-
|
|
312
264
|
export { findOverflowScrollParent } from './utils';
|
|
@@ -4,23 +4,20 @@ export function isBody(elem) {
|
|
|
4
4
|
export function isTextNode(elem) {
|
|
5
5
|
return elem && elem.nodeType === 3;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Decides if given fitHeight fits below or above the target taking boundaries into account.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow) {
|
|
12
12
|
if (forcePlacement && alignY) {
|
|
13
13
|
return alignY;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
if (!fitHeight) {
|
|
17
16
|
return 'bottom';
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
if (isTextNode(target)) {
|
|
21
19
|
target = target.parentElement;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
const boundariesClientRect = boundariesElement.getBoundingClientRect();
|
|
25
22
|
const {
|
|
26
23
|
height: boundariesHeight
|
|
@@ -31,38 +28,34 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
31
28
|
height: targetHeight
|
|
32
29
|
} = target.getBoundingClientRect();
|
|
33
30
|
const spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
|
|
34
|
-
const spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
31
|
+
const spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
35
32
|
|
|
33
|
+
// Force vertical placement to bottom if the space above doesn't accomodate the fitHeight
|
|
36
34
|
if (preventOverflow) {
|
|
37
35
|
if (spaceAbove <= fitHeight) {
|
|
38
36
|
return 'bottom';
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
|
|
42
39
|
if (spaceBelow >= fitHeight || spaceBelow >= spaceAbove) {
|
|
43
40
|
return 'bottom';
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
return 'top';
|
|
47
43
|
}
|
|
44
|
+
|
|
48
45
|
/**
|
|
49
46
|
* Decides if given fitWidth fits to the left or to the right of the target taking boundaries into account.
|
|
50
47
|
*/
|
|
51
|
-
|
|
52
48
|
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow) {
|
|
53
49
|
// force placement unless preventOverflow is enabled
|
|
54
50
|
if (forcePlacement && alignX && !preventOverflow) {
|
|
55
51
|
return alignX;
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
if (!fitWidth) {
|
|
59
54
|
return alignX || 'left';
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
if (isTextNode(target)) {
|
|
63
57
|
target = target.parentElement;
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
const {
|
|
67
60
|
left: targetLeft,
|
|
68
61
|
width: targetWidth
|
|
@@ -73,19 +66,16 @@ export function getHorizontalPlacement(target, boundariesElement, fitWidth, alig
|
|
|
73
66
|
} = boundariesElement.getBoundingClientRect();
|
|
74
67
|
const spaceLeft = targetLeft - boundariesLeft + targetWidth;
|
|
75
68
|
const spaceRight = boundariesLeft + boundariesWidth - targetLeft;
|
|
76
|
-
|
|
77
69
|
if (alignX && spaceLeft > fitWidth && spaceRight > fitWidth) {
|
|
78
70
|
return alignX;
|
|
79
71
|
} else if (spaceRight >= fitWidth || spaceRight >= spaceLeft && !alignX) {
|
|
80
72
|
return 'left';
|
|
81
73
|
}
|
|
82
|
-
|
|
83
74
|
return 'right';
|
|
84
75
|
}
|
|
85
76
|
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow) {
|
|
86
77
|
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow)];
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
const calculateHorizontalPlacement = ({
|
|
90
80
|
placement,
|
|
91
81
|
targetLeft,
|
|
@@ -101,7 +91,6 @@ const calculateHorizontalPlacement = ({
|
|
|
101
91
|
allowOutOfBounds = false
|
|
102
92
|
}) => {
|
|
103
93
|
const position = {};
|
|
104
|
-
|
|
105
94
|
if (placement === 'left') {
|
|
106
95
|
position.left = Math.ceil(targetLeft - popupOffsetParentLeft + (isPopupParentBody ? 0 : popupOffsetParentScrollLeft) + offset[0]);
|
|
107
96
|
} else if (placement === 'center') {
|
|
@@ -112,32 +101,26 @@ const calculateHorizontalPlacement = ({
|
|
|
112
101
|
} else {
|
|
113
102
|
position.right = Math.ceil(popupOffsetParentRight - targetRight - (isPopupParentBody ? 0 : popupOffsetParentScrollLeft) + offset[0]);
|
|
114
103
|
}
|
|
115
|
-
|
|
116
104
|
if (!allowOutOfBounds) {
|
|
117
105
|
if (position.left !== undefined) {
|
|
118
106
|
position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth);
|
|
119
107
|
}
|
|
120
|
-
|
|
121
108
|
if (position.right !== undefined) {
|
|
122
109
|
position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth);
|
|
123
110
|
}
|
|
124
111
|
}
|
|
125
|
-
|
|
126
112
|
return position;
|
|
127
113
|
};
|
|
128
|
-
|
|
129
114
|
const getPopupXInsideParent = (x, popupClientWidth, popupOffsetParentClientWidth) => {
|
|
130
115
|
// minimum distance the popup can be from the edge of its parent
|
|
131
|
-
const minPopupMargin = 1;
|
|
132
|
-
|
|
116
|
+
const minPopupMargin = 1;
|
|
117
|
+
// prevent going too far right
|
|
133
118
|
if (popupOffsetParentClientWidth < x + popupClientWidth) {
|
|
134
119
|
x = popupOffsetParentClientWidth - popupClientWidth - minPopupMargin;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
120
|
+
}
|
|
121
|
+
// prevent going too far left
|
|
138
122
|
return Math.max(minPopupMargin, x);
|
|
139
123
|
};
|
|
140
|
-
|
|
141
124
|
const calculateVerticalStickBottom = ({
|
|
142
125
|
target,
|
|
143
126
|
targetTop,
|
|
@@ -147,13 +130,12 @@ const calculateVerticalStickBottom = ({
|
|
|
147
130
|
position
|
|
148
131
|
}) => {
|
|
149
132
|
const scrollParent = findOverflowScrollParent(target);
|
|
150
|
-
const newPos = {
|
|
133
|
+
const newPos = {
|
|
134
|
+
...position
|
|
151
135
|
};
|
|
152
|
-
|
|
153
136
|
if (scrollParent) {
|
|
154
137
|
let topOffsetTop = targetTop - scrollParent.getBoundingClientRect().top;
|
|
155
138
|
let targetEnd = targetHeight + topOffsetTop;
|
|
156
|
-
|
|
157
139
|
if (scrollParent.clientHeight - targetEnd <= popup.clientHeight + offset[1] * 2 && topOffsetTop < scrollParent.clientHeight) {
|
|
158
140
|
const scroll = targetEnd - scrollParent.clientHeight + offset[1] * 2;
|
|
159
141
|
let top = newPos.top || 0;
|
|
@@ -161,10 +143,8 @@ const calculateVerticalStickBottom = ({
|
|
|
161
143
|
newPos.top = top;
|
|
162
144
|
}
|
|
163
145
|
}
|
|
164
|
-
|
|
165
146
|
return newPos;
|
|
166
147
|
};
|
|
167
|
-
|
|
168
148
|
const calculateVerticalStickTop = ({
|
|
169
149
|
target,
|
|
170
150
|
targetTop,
|
|
@@ -176,19 +156,17 @@ const calculateVerticalStickTop = ({
|
|
|
176
156
|
placement
|
|
177
157
|
}) => {
|
|
178
158
|
const scrollParent = findOverflowScrollParent(target);
|
|
179
|
-
const newPos = {
|
|
159
|
+
const newPos = {
|
|
160
|
+
...position
|
|
180
161
|
};
|
|
181
|
-
|
|
182
162
|
if (scrollParent) {
|
|
183
163
|
const {
|
|
184
164
|
top: scrollParentTop
|
|
185
165
|
} = scrollParent.getBoundingClientRect();
|
|
186
166
|
const topBoundary = targetTop - scrollParentTop;
|
|
187
167
|
const scrollParentScrollTop = scrollParent.scrollTop;
|
|
188
|
-
|
|
189
168
|
if (topBoundary < 0) {
|
|
190
169
|
const isBelowNodeBoundary = targetTop + (scrollParentScrollTop - scrollParentTop) + targetHeight + offset[1] < scrollParentScrollTop;
|
|
191
|
-
|
|
192
170
|
if (placement === 'top') {
|
|
193
171
|
if (isBelowNodeBoundary) {
|
|
194
172
|
newPos.bottom = popupOffsetParentHeight - (topBoundary + popupOffsetParent.scrollTop + targetHeight);
|
|
@@ -196,7 +174,6 @@ const calculateVerticalStickTop = ({
|
|
|
196
174
|
newPos.bottom = topBoundary + (newPos.bottom || 0);
|
|
197
175
|
}
|
|
198
176
|
}
|
|
199
|
-
|
|
200
177
|
if (placement === 'start') {
|
|
201
178
|
if (isBelowNodeBoundary) {
|
|
202
179
|
newPos.top = topBoundary + popupOffsetParent.scrollTop + targetHeight;
|
|
@@ -206,10 +183,8 @@ const calculateVerticalStickTop = ({
|
|
|
206
183
|
}
|
|
207
184
|
}
|
|
208
185
|
}
|
|
209
|
-
|
|
210
186
|
return newPos;
|
|
211
187
|
};
|
|
212
|
-
|
|
213
188
|
const calculateVerticalPlacement = ({
|
|
214
189
|
placement,
|
|
215
190
|
targetTop,
|
|
@@ -222,7 +197,6 @@ const calculateVerticalPlacement = ({
|
|
|
222
197
|
offset
|
|
223
198
|
}) => {
|
|
224
199
|
const position = {};
|
|
225
|
-
|
|
226
200
|
if (placement === 'top') {
|
|
227
201
|
position.bottom = Math.ceil(popupOffsetParentHeight - (targetTop - popupOffsetParentTop) - (isPopupParentBody ? 0 : popupOffsetParentScrollTop) - borderBottomWidth + offset[1]);
|
|
228
202
|
} else if (placement === 'start') {
|
|
@@ -231,15 +205,13 @@ const calculateVerticalPlacement = ({
|
|
|
231
205
|
let top = Math.ceil(targetTop - popupOffsetParentTop + targetHeight + (isPopupParentBody ? 0 : popupOffsetParentScrollTop) - borderBottomWidth + offset[1]);
|
|
232
206
|
position.top = top;
|
|
233
207
|
}
|
|
234
|
-
|
|
235
208
|
return position;
|
|
236
209
|
};
|
|
210
|
+
|
|
237
211
|
/**
|
|
238
212
|
* Calculates relative coordinates for placing popup along with the target.
|
|
239
213
|
* Uses placement from calculatePlacement.
|
|
240
214
|
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
215
|
export function calculatePosition({
|
|
244
216
|
placement,
|
|
245
217
|
target,
|
|
@@ -250,23 +222,18 @@ export function calculatePosition({
|
|
|
250
222
|
rect
|
|
251
223
|
}) {
|
|
252
224
|
let position = {};
|
|
253
|
-
|
|
254
225
|
if (!target || !popup || !popup.offsetParent) {
|
|
255
226
|
return position;
|
|
256
227
|
}
|
|
257
|
-
|
|
258
228
|
if (isTextNode(target)) {
|
|
259
229
|
target = target.parentElement;
|
|
260
230
|
}
|
|
261
|
-
|
|
262
231
|
const popupOffsetParent = popup.offsetParent;
|
|
263
232
|
const offsetParentStyle = popupOffsetParent.style;
|
|
264
233
|
let borderBottomWidth = 0;
|
|
265
|
-
|
|
266
234
|
if (offsetParentStyle && offsetParentStyle.borderBottomWidth) {
|
|
267
235
|
borderBottomWidth = parseInt(offsetParentStyle.borderBottomWidth, 10);
|
|
268
236
|
}
|
|
269
|
-
|
|
270
237
|
const [verticalPlacement, horizontalPlacement] = placement;
|
|
271
238
|
const {
|
|
272
239
|
top: popupOffsetParentTop,
|
|
@@ -293,10 +260,10 @@ export function calculatePosition({
|
|
|
293
260
|
borderBottomWidth,
|
|
294
261
|
offset
|
|
295
262
|
});
|
|
296
|
-
position = {
|
|
263
|
+
position = {
|
|
264
|
+
...position,
|
|
297
265
|
...verticalPosition
|
|
298
266
|
};
|
|
299
|
-
|
|
300
267
|
if ((verticalPlacement === 'top' || verticalPlacement === 'start') && stick) {
|
|
301
268
|
position = calculateVerticalStickTop({
|
|
302
269
|
target,
|
|
@@ -310,7 +277,6 @@ export function calculatePosition({
|
|
|
310
277
|
placement: verticalPlacement
|
|
311
278
|
});
|
|
312
279
|
}
|
|
313
|
-
|
|
314
280
|
if (verticalPlacement !== 'top' && verticalPlacement !== 'start' && stick) {
|
|
315
281
|
position = calculateVerticalStickBottom({
|
|
316
282
|
target,
|
|
@@ -321,7 +287,6 @@ export function calculatePosition({
|
|
|
321
287
|
position
|
|
322
288
|
});
|
|
323
289
|
}
|
|
324
|
-
|
|
325
290
|
const horizontalPosition = calculateHorizontalPlacement({
|
|
326
291
|
placement: horizontalPlacement,
|
|
327
292
|
targetLeft,
|
|
@@ -336,7 +301,8 @@ export function calculatePosition({
|
|
|
336
301
|
offset,
|
|
337
302
|
allowOutOfBounds
|
|
338
303
|
});
|
|
339
|
-
position = {
|
|
304
|
+
position = {
|
|
305
|
+
...position,
|
|
340
306
|
...horizontalPosition
|
|
341
307
|
};
|
|
342
308
|
return position;
|
|
@@ -346,28 +312,23 @@ export function validatePosition(popup) {
|
|
|
346
312
|
if (!popup || !popup.offsetParent) {
|
|
347
313
|
return false;
|
|
348
314
|
}
|
|
349
|
-
|
|
350
315
|
return true;
|
|
351
316
|
}
|
|
317
|
+
|
|
352
318
|
/**
|
|
353
319
|
* Traverse DOM Tree upwards looking for popup parents with "overflow: scroll".
|
|
354
320
|
*/
|
|
355
|
-
|
|
356
321
|
export function findOverflowScrollParent(popup) {
|
|
357
322
|
let parent = popup;
|
|
358
|
-
|
|
359
323
|
if (!parent) {
|
|
360
324
|
return false;
|
|
361
325
|
}
|
|
362
|
-
|
|
363
326
|
while (parent = parent.parentElement) {
|
|
364
327
|
// IE11 on Window 8 doesn't show styles from CSS when accessing through element.style property.
|
|
365
328
|
const style = window.getComputedStyle(parent);
|
|
366
|
-
|
|
367
329
|
if (style.overflow === 'scroll' || style.overflowX === 'scroll' || style.overflowY === 'scroll' || parent.classList.contains('fabric-editor-popup-scroll-parent')) {
|
|
368
330
|
return parent;
|
|
369
331
|
}
|
|
370
332
|
}
|
|
371
|
-
|
|
372
333
|
return false;
|
|
373
334
|
}
|
|
@@ -7,7 +7,8 @@ export function PortalProviderThemeProviders(props) {
|
|
|
7
7
|
children,
|
|
8
8
|
mode
|
|
9
9
|
} = props;
|
|
10
|
-
const styledComponentsAndEmotionTheme = React.useMemo(
|
|
10
|
+
const styledComponentsAndEmotionTheme = React.useMemo(
|
|
11
|
+
// This return value should only be one of the following
|
|
11
12
|
// - { [CHANNEL]: { mode },
|
|
12
13
|
// - { theme: { [CHANNEL]: { mode } }
|
|
13
14
|
// However, it appears that consumers have inconsistent expectations
|