@atlaskit/editor-common 72.1.2 → 72.2.1
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 +21 -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 +1 -16
- 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 +15 -39
- package/dist/cjs/ui-menu/DropdownMenu/index.js +43 -79
- package/dist/cjs/ui-menu/MenuArrowKeyNavigationProvider/index.js +66 -82
- 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 +12 -52
- 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 +1 -16
- 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 +1 -8
- package/dist/es2019/ui-menu/DropdownMenu/index.js +23 -27
- package/dist/es2019/ui-menu/MenuArrowKeyNavigationProvider/index.js +59 -73
- package/dist/es2019/ui-menu/ToolbarButton/index.js +2 -6
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +7 -25
- 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 +1 -16
- 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 +15 -28
- package/dist/esm/ui-menu/DropdownMenu/index.js +43 -60
- package/dist/esm/ui-menu/MenuArrowKeyNavigationProvider/index.js +66 -78
- package/dist/esm/ui-menu/ToolbarButton/index.js +23 -32
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +12 -41
- 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/dist/types/analytics/types/enums.d.ts +1 -1
- package/dist/types/analytics/types/events.d.ts +3 -2
- package/dist/types/analytics/types/general-events.d.ts +8 -3
- package/dist/types/types/editor-plugin.d.ts +24 -2
- package/dist/types/types/floating-toolbar.d.ts +10 -0
- package/dist/types/types/type-ahead.d.ts +8 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -1
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
- package/dist/types/ui-menu/MenuArrowKeyNavigationProvider/index.d.ts +3 -2
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -1
- package/package.json +8 -8
|
@@ -9,7 +9,6 @@ import { analyticsEventKey } from '../utils/analytics';
|
|
|
9
9
|
export default class ReactNodeView {
|
|
10
10
|
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasAnalyticsContext = false, viewShouldUpdate, hasIntlContext = false) {
|
|
11
11
|
_defineProperty(this, "handleRef", node => this._handleRef(node));
|
|
12
|
-
|
|
13
12
|
_defineProperty(this, "dispatchAnalyticsEvent", payload => {
|
|
14
13
|
if (this.eventDispatcher) {
|
|
15
14
|
const dispatch = createDispatch(this.eventDispatcher);
|
|
@@ -18,7 +17,6 @@ export default class ReactNodeView {
|
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
|
|
22
20
|
this.node = _node;
|
|
23
21
|
this.view = view;
|
|
24
22
|
this.getPos = getPos;
|
|
@@ -30,6 +28,7 @@ export default class ReactNodeView {
|
|
|
30
28
|
this.eventDispatcher = eventDispatcher;
|
|
31
29
|
this.hasIntlContext = hasIntlContext;
|
|
32
30
|
}
|
|
31
|
+
|
|
33
32
|
/**
|
|
34
33
|
* This method exists to move initialization logic out of the constructor,
|
|
35
34
|
* so object can be initialized properly before calling render first time.
|
|
@@ -39,8 +38,6 @@ export default class ReactNodeView {
|
|
|
39
38
|
* constructor, which leads to some methods being undefined during the
|
|
40
39
|
* first render.
|
|
41
40
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
41
|
init() {
|
|
45
42
|
this.domRef = this.createDomRef();
|
|
46
43
|
this.setDomAttrs(this.node, this.domRef);
|
|
@@ -51,17 +48,16 @@ export default class ReactNodeView {
|
|
|
51
48
|
dom: undefined,
|
|
52
49
|
contentDOM: undefined
|
|
53
50
|
};
|
|
54
|
-
|
|
55
51
|
if (this.domRef && contentDOMWrapper) {
|
|
56
52
|
this.domRef.appendChild(contentDOMWrapper);
|
|
57
53
|
this.contentDOM = contentDOM ? contentDOM : contentDOMWrapper;
|
|
58
54
|
this.contentDOMWrapper = contentDOMWrapper || contentDOM;
|
|
59
|
-
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// @see ED-3790
|
|
60
58
|
// something gets messed up during mutation processing inside of a
|
|
61
59
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
62
60
|
// difference between them and it kills the nodeView
|
|
63
|
-
|
|
64
|
-
|
|
65
61
|
this.domRef.classList.add(`${this.node.type.name}View-content-wrap`);
|
|
66
62
|
const {
|
|
67
63
|
samplingRate,
|
|
@@ -81,46 +77,38 @@ export default class ReactNodeView {
|
|
|
81
77
|
});
|
|
82
78
|
return this;
|
|
83
79
|
}
|
|
84
|
-
|
|
85
80
|
renderReactComponent(component) {
|
|
86
81
|
if (!this.domRef || !component) {
|
|
87
82
|
return;
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
const componentWithErrorBoundary = () => {
|
|
91
85
|
var _this$node$type$name, _this$node, _this$node$type;
|
|
92
|
-
|
|
93
86
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
94
87
|
component: ACTION_SUBJECT.REACT_NODE_VIEW,
|
|
95
88
|
componentId: (_this$node$type$name = this === null || this === void 0 ? void 0 : (_this$node = this.node) === null || _this$node === void 0 ? void 0 : (_this$node$type = _this$node.type) === null || _this$node$type === void 0 ? void 0 : _this$node$type.name) !== null && _this$node$type$name !== void 0 ? _this$node$type$name : ACTION_SUBJECT_ID.UNKNOWN_NODE,
|
|
96
89
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
97
90
|
}, component());
|
|
98
91
|
};
|
|
99
|
-
|
|
100
92
|
this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
|
|
101
93
|
}
|
|
102
|
-
|
|
103
94
|
createDomRef() {
|
|
104
95
|
if (!this.node.isInline) {
|
|
105
96
|
return document.createElement('div');
|
|
106
97
|
}
|
|
107
|
-
|
|
108
98
|
const htmlElement = document.createElement('span');
|
|
109
99
|
return htmlElement;
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
getContentDOM() {
|
|
113
102
|
return undefined;
|
|
114
103
|
}
|
|
115
|
-
|
|
116
104
|
_handleRef(node) {
|
|
117
|
-
const contentDOM = this.contentDOMWrapper || this.contentDOM;
|
|
105
|
+
const contentDOM = this.contentDOMWrapper || this.contentDOM;
|
|
118
106
|
|
|
107
|
+
// move the contentDOM node inside the inner reference after rendering
|
|
119
108
|
if (node && contentDOM && !node.contains(contentDOM)) {
|
|
120
109
|
node.appendChild(contentDOM);
|
|
121
110
|
}
|
|
122
111
|
}
|
|
123
|
-
|
|
124
112
|
render(props, forwardRef) {
|
|
125
113
|
return this.reactComponent ? /*#__PURE__*/React.createElement(this.reactComponent, _extends({
|
|
126
114
|
view: this.view,
|
|
@@ -129,66 +117,54 @@ export default class ReactNodeView {
|
|
|
129
117
|
forwardRef: forwardRef
|
|
130
118
|
}, props)) : null;
|
|
131
119
|
}
|
|
132
|
-
|
|
133
120
|
update(node, _decorations, _innerDecorations, validUpdate = () => true) {
|
|
134
121
|
// @see https://github.com/ProseMirror/prosemirror/issues/648
|
|
135
122
|
const isValidUpdate = this.node.type === node.type && validUpdate(this.node, node);
|
|
136
|
-
|
|
137
123
|
if (!isValidUpdate) {
|
|
138
124
|
return false;
|
|
139
125
|
}
|
|
140
|
-
|
|
141
126
|
if (this.domRef && !this.node.sameMarkup(node)) {
|
|
142
127
|
this.setDomAttrs(node, this.domRef);
|
|
143
|
-
}
|
|
144
|
-
// We dont want to destroy the view, so we return true.
|
|
145
|
-
|
|
128
|
+
}
|
|
146
129
|
|
|
130
|
+
// View should not process a re-render if this is false.
|
|
131
|
+
// We dont want to destroy the view, so we return true.
|
|
147
132
|
if (!this.viewShouldUpdate(node)) {
|
|
148
133
|
this.node = node;
|
|
149
134
|
return true;
|
|
150
135
|
}
|
|
151
|
-
|
|
152
136
|
this.node = node;
|
|
153
137
|
this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef));
|
|
154
138
|
return true;
|
|
155
139
|
}
|
|
156
|
-
|
|
157
140
|
viewShouldUpdate(nextNode) {
|
|
158
141
|
if (this._viewShouldUpdate) {
|
|
159
142
|
return this._viewShouldUpdate(nextNode);
|
|
160
143
|
}
|
|
161
|
-
|
|
162
144
|
return true;
|
|
163
145
|
}
|
|
146
|
+
|
|
164
147
|
/**
|
|
165
148
|
* Copies the attributes from a ProseMirror Node to a DOM node.
|
|
166
149
|
* @param node The Prosemirror Node from which to source the attributes
|
|
167
150
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
151
|
setDomAttrs(node, element) {
|
|
171
152
|
Object.keys(node.attrs || {}).forEach(attr => {
|
|
172
153
|
element.setAttribute(attr, node.attrs[attr]);
|
|
173
154
|
});
|
|
174
155
|
}
|
|
175
|
-
|
|
176
156
|
get dom() {
|
|
177
157
|
return this.domRef;
|
|
178
158
|
}
|
|
179
|
-
|
|
180
159
|
destroy() {
|
|
181
160
|
if (!this.domRef) {
|
|
182
161
|
return;
|
|
183
162
|
}
|
|
184
|
-
|
|
185
163
|
this.portalProviderAPI.remove(this.domRef);
|
|
186
164
|
this.domRef = undefined;
|
|
187
165
|
this.contentDOM = undefined;
|
|
188
166
|
}
|
|
189
|
-
|
|
190
167
|
static fromComponent(component, portalProviderAPI, eventDispatcher, props, viewShouldUpdate, hasIntlContext = false) {
|
|
191
168
|
return (node, view, getPos) => new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component, false, viewShouldUpdate, hasIntlContext).init();
|
|
192
169
|
}
|
|
193
|
-
|
|
194
170
|
}
|
|
@@ -3,8 +3,8 @@ export class SafePlugin extends Plugin {
|
|
|
3
3
|
// This variable isn't (and shouldn't) be used anywhere. Its purpose is
|
|
4
4
|
// to distinguish Plugin from SafePlugin, thus ensuring that an 'unsafe'
|
|
5
5
|
// Plugin cannot be assigned as an item in EditorPlugin → pmPlugins.
|
|
6
|
+
|
|
6
7
|
constructor(spec) {
|
|
7
8
|
super(spec);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
10
|
}
|
|
@@ -3,12 +3,10 @@ import { Slice } from 'prosemirror-model';
|
|
|
3
3
|
import { Selection } from 'prosemirror-state';
|
|
4
4
|
import { isValidTargetNode } from './utils/is-valid-target-node';
|
|
5
5
|
export let Side;
|
|
6
|
-
|
|
7
6
|
(function (Side) {
|
|
8
7
|
Side["LEFT"] = "left";
|
|
9
8
|
Side["RIGHT"] = "right";
|
|
10
9
|
})(Side || (Side = {}));
|
|
11
|
-
|
|
12
10
|
export const JSON_ID = 'gapcursor';
|
|
13
11
|
export class GapCursorSelection extends Selection {
|
|
14
12
|
/**
|
|
@@ -18,12 +16,9 @@ export class GapCursorSelection extends Selection {
|
|
|
18
16
|
*/
|
|
19
17
|
constructor($pos, side = Side.LEFT) {
|
|
20
18
|
super($pos, $pos);
|
|
21
|
-
|
|
22
19
|
_defineProperty(this, "visible", false);
|
|
23
|
-
|
|
24
20
|
this.side = side;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
static valid($pos) {
|
|
28
23
|
const {
|
|
29
24
|
parent,
|
|
@@ -31,84 +26,68 @@ export class GapCursorSelection extends Selection {
|
|
|
31
26
|
nodeAfter
|
|
32
27
|
} = $pos;
|
|
33
28
|
const targetNode = isValidTargetNode(nodeBefore) ? nodeBefore : isValidTargetNode(nodeAfter) ? nodeAfter : null;
|
|
34
|
-
|
|
35
29
|
if (!targetNode || parent.isTextblock) {
|
|
36
30
|
return false;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
const deflt = parent.contentMatchAt($pos.index()).defaultType;
|
|
40
33
|
return deflt && deflt.isTextblock;
|
|
41
34
|
}
|
|
42
|
-
|
|
43
35
|
static findFrom($pos, dir, mustMove = false) {
|
|
44
36
|
const side = dir === 1 ? Side.RIGHT : Side.LEFT;
|
|
45
|
-
|
|
46
37
|
if (!mustMove && GapCursorSelection.valid($pos)) {
|
|
47
38
|
return new GapCursorSelection($pos, side);
|
|
48
39
|
}
|
|
40
|
+
let pos = $pos.pos;
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let next = null; // Scan up from this position
|
|
42
|
+
// TODO: Fix any, potential issue. ED-5048
|
|
43
|
+
let next = null;
|
|
53
44
|
|
|
45
|
+
// Scan up from this position
|
|
54
46
|
for (let d = $pos.depth;; d--) {
|
|
55
47
|
const parent = $pos.node(d);
|
|
56
|
-
|
|
57
48
|
if (side === Side.RIGHT ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
|
|
58
49
|
next = parent.maybeChild(side === Side.RIGHT ? $pos.indexAfter(d) : $pos.index(d) - 1);
|
|
59
50
|
break;
|
|
60
51
|
} else if (d === 0) {
|
|
61
52
|
return null;
|
|
62
53
|
}
|
|
63
|
-
|
|
64
54
|
pos += dir;
|
|
65
55
|
const $cur = $pos.doc.resolve(pos);
|
|
66
|
-
|
|
67
56
|
if (GapCursorSelection.valid($cur)) {
|
|
68
57
|
return new GapCursorSelection($cur, side);
|
|
69
58
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
59
|
+
}
|
|
72
60
|
|
|
61
|
+
// And then down into the next node
|
|
73
62
|
for (;;) {
|
|
74
63
|
next = side === Side.RIGHT ? next.firstChild : next.lastChild;
|
|
75
|
-
|
|
76
64
|
if (next === null) {
|
|
77
65
|
break;
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
pos += dir;
|
|
81
68
|
const $cur = $pos.doc.resolve(pos);
|
|
82
|
-
|
|
83
69
|
if (GapCursorSelection.valid($cur)) {
|
|
84
70
|
return new GapCursorSelection($cur, side);
|
|
85
71
|
}
|
|
86
72
|
}
|
|
87
|
-
|
|
88
73
|
return null;
|
|
89
74
|
}
|
|
90
|
-
|
|
91
75
|
static fromJSON(doc, json) {
|
|
92
76
|
return new GapCursorSelection(doc.resolve(json.pos), json.side);
|
|
93
77
|
}
|
|
94
|
-
|
|
95
78
|
map(doc, mapping) {
|
|
96
79
|
const $pos = doc.resolve(mapping.map(this.head));
|
|
97
80
|
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos, this.side) : Selection.near($pos);
|
|
98
81
|
}
|
|
99
|
-
|
|
100
82
|
eq(other) {
|
|
101
83
|
return other instanceof GapCursorSelection && other.head === this.head;
|
|
102
84
|
}
|
|
103
|
-
|
|
104
85
|
content() {
|
|
105
86
|
return Slice.empty;
|
|
106
87
|
}
|
|
107
|
-
|
|
108
88
|
getBookmark() {
|
|
109
89
|
return new GapBookmark(this.anchor);
|
|
110
90
|
}
|
|
111
|
-
|
|
112
91
|
toJSON() {
|
|
113
92
|
return {
|
|
114
93
|
pos: this.head,
|
|
@@ -116,21 +95,17 @@ export class GapCursorSelection extends Selection {
|
|
|
116
95
|
side: this.side
|
|
117
96
|
};
|
|
118
97
|
}
|
|
119
|
-
|
|
120
98
|
}
|
|
121
99
|
Selection.jsonID(JSON_ID, GapCursorSelection);
|
|
122
100
|
export class GapBookmark {
|
|
123
101
|
constructor(pos) {
|
|
124
102
|
this.pos = pos;
|
|
125
103
|
}
|
|
126
|
-
|
|
127
104
|
map(mapping) {
|
|
128
105
|
return new GapBookmark(mapping.map(this.pos));
|
|
129
106
|
}
|
|
130
|
-
|
|
131
107
|
resolve(doc) {
|
|
132
108
|
const $pos = doc.resolve(this.pos);
|
|
133
109
|
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos) : Selection.near($pos);
|
|
134
110
|
}
|
|
135
|
-
|
|
136
111
|
}
|
|
@@ -2,37 +2,29 @@ export const isSelectionAtStartOfNode = ($pos, parentNode) => {
|
|
|
2
2
|
if (!parentNode) {
|
|
3
3
|
return false;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
7
6
|
const node = $pos.node(i);
|
|
8
|
-
|
|
9
7
|
if (node && node.eq(parentNode.node)) {
|
|
10
8
|
break;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
if (i > 1 && $pos.before(i) !== $pos.before(i - 1) + 1) {
|
|
14
11
|
return false;
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
return true;
|
|
19
15
|
};
|
|
20
16
|
export const isSelectionAtEndOfNode = ($pos, parentNode) => {
|
|
21
17
|
if (!parentNode) {
|
|
22
18
|
return false;
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
26
21
|
const node = $pos.node(i);
|
|
27
|
-
|
|
28
22
|
if (node && node.eq(parentNode.node)) {
|
|
29
23
|
break;
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
if (i > 1 && $pos.after(i) !== $pos.after(i - 1) - 1) {
|
|
33
26
|
return false;
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
return true;
|
|
38
30
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { h100, h300, h400, h500, h600, h700 } from '@atlaskit/theme/typography';
|
|
3
|
-
// text sizing prototype: http://proto/fabricrender/
|
|
2
|
+
import { h100, h300, h400, h500, h600, h700 } from '@atlaskit/theme/typography';
|
|
4
3
|
|
|
4
|
+
// @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
|
|
5
|
+
// text sizing prototype: http://proto/fabricrender/
|
|
5
6
|
export const headingsSharedStyles = props => css`
|
|
6
7
|
& h1 {
|
|
7
8
|
${h700(props)};
|
|
@@ -3,18 +3,15 @@ import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import browser from '../../utils/browser';
|
|
4
4
|
export const listItemCounterPadding = 24;
|
|
5
5
|
var CSS_VAR_NAMES;
|
|
6
|
-
|
|
7
6
|
(function (CSS_VAR_NAMES) {
|
|
8
7
|
CSS_VAR_NAMES["ITEM_COUNTER_PADDING"] = "--ed--list--item-counter--padding";
|
|
9
8
|
})(CSS_VAR_NAMES || (CSS_VAR_NAMES = {}));
|
|
10
|
-
|
|
11
9
|
const getItemCounterLeftPadding = itemCounterDigitsSize => {
|
|
12
10
|
// Previous padding-left was approximately 24px. We approximate that
|
|
13
11
|
// same value using "ch" units (which represent the width of a "0" digit
|
|
14
12
|
// character). We use "ch" so that this computed padding can now grow if
|
|
15
13
|
// the font-size ever enlarges.
|
|
16
14
|
let paddingLeft = `2.385ch`;
|
|
17
|
-
|
|
18
15
|
if (itemCounterDigitsSize >= 3) {
|
|
19
16
|
// When there are 3 or more digits, we use a combination of "ch" units and
|
|
20
17
|
// pixel values so that while the computed padding grows if font-size ever
|
|
@@ -24,21 +21,16 @@ const getItemCounterLeftPadding = itemCounterDigitsSize => {
|
|
|
24
21
|
const fixedBasePx = 2;
|
|
25
22
|
paddingLeft = `calc(${itemCounterDigitsSize + 1}ch - ${fixedBasePx}px)`;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return paddingLeft;
|
|
29
25
|
};
|
|
30
|
-
|
|
31
26
|
const stringifyStyle = style => Object.entries(style).reduce((str, [key, value]) => `${str}${key}:${value};`, ``);
|
|
32
|
-
|
|
33
27
|
export function getOrderedListInlineStyles(itemCounterDigitsSize, styleFormat) {
|
|
34
28
|
const style = {
|
|
35
29
|
[CSS_VAR_NAMES.ITEM_COUNTER_PADDING]: getItemCounterLeftPadding(itemCounterDigitsSize)
|
|
36
30
|
};
|
|
37
|
-
|
|
38
31
|
if (styleFormat === 'string') {
|
|
39
32
|
return stringifyStyle(style);
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
return style;
|
|
43
35
|
}
|
|
44
36
|
export const listsSharedStyles = css`
|
|
@@ -101,19 +101,23 @@ const tokenDarkPanelColors = {
|
|
|
101
101
|
success: `var(--ds-background-success, ${darkPanelColors['success']})`,
|
|
102
102
|
warning: `var(--ds-background-warning, ${darkPanelColors['warning']})`,
|
|
103
103
|
error: `var(--ds-background-danger, ${darkPanelColors['error']})`
|
|
104
|
-
};
|
|
105
|
-
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
104
|
+
};
|
|
106
105
|
|
|
106
|
+
// New custom icons are a little smaller than predefined icons.
|
|
107
|
+
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
107
108
|
const panelEmojiSpriteVerticalAlignment = -(gridSize() * 3 - akEditorCustomIconSize) / 2;
|
|
108
|
-
const panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
|
|
109
|
+
const panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
112
|
+
const panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]];
|
|
111
113
|
|
|
114
|
+
// used for custom panels
|
|
112
115
|
export const getPanelDarkColor = panelColor => {
|
|
113
116
|
const colorObject = panelDarkModeColors.find(color => color[0] === panelColor || color[1] === panelColor);
|
|
114
117
|
return colorObject ? colorObject[1] : darkPanelColors.B1200S;
|
|
115
|
-
};
|
|
118
|
+
};
|
|
116
119
|
|
|
120
|
+
// used for custom panels
|
|
117
121
|
export const getPanelBackgroundDarkModeColors = panelDarkModeColors.map(([colorName, colorValue]) => getPanelDarkModeCSS(colorName, colorValue)).join('\n');
|
|
118
122
|
export function getPanelDarkModeCSS(colorName, colorValue) {
|
|
119
123
|
return `
|
|
@@ -152,7 +156,6 @@ export const PanelSharedSelectors = {
|
|
|
152
156
|
yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`,
|
|
153
157
|
copyButton: `button[aria-label="Copy"]`
|
|
154
158
|
};
|
|
155
|
-
|
|
156
159
|
const iconDynamicStyles = panelType => props => {
|
|
157
160
|
const light = lightIconColor[panelType];
|
|
158
161
|
const dark = darkIconColor[panelType];
|
|
@@ -163,9 +166,9 @@ const iconDynamicStyles = panelType => props => {
|
|
|
163
166
|
return `
|
|
164
167
|
color: ${color};
|
|
165
168
|
`;
|
|
166
|
-
};
|
|
167
|
-
|
|
169
|
+
};
|
|
168
170
|
|
|
171
|
+
// Provides the color without tokens, used when converting to a custom panel
|
|
169
172
|
export const getPanelTypeBackgroundNoTokens = (panelType, props = {}) => {
|
|
170
173
|
const light = lightPanelColors[panelType];
|
|
171
174
|
const dark = darkPanelColors[panelType];
|
|
@@ -176,8 +179,8 @@ export const getPanelTypeBackgroundNoTokens = (panelType, props = {}) => {
|
|
|
176
179
|
return background || 'none';
|
|
177
180
|
};
|
|
178
181
|
export const getPanelTypeBackground = (panelType, props = {}) => {
|
|
179
|
-
const light = hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]);
|
|
180
|
-
|
|
182
|
+
const light = hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]);
|
|
183
|
+
// hexToEditorBackgroundPaletteColor has a light mode as a fallback color - for legacy dark mode we define the tokens locally
|
|
181
184
|
const dark = tokenDarkPanelColors[panelType];
|
|
182
185
|
const background = themed({
|
|
183
186
|
light,
|
|
@@ -185,7 +188,6 @@ export const getPanelTypeBackground = (panelType, props = {}) => {
|
|
|
185
188
|
})(props);
|
|
186
189
|
return background || 'none';
|
|
187
190
|
};
|
|
188
|
-
|
|
189
191
|
const mainDynamicStyles = panelType => props => {
|
|
190
192
|
const background = getPanelTypeBackground(panelType, props);
|
|
191
193
|
const text = themed({
|
|
@@ -197,7 +199,6 @@ const mainDynamicStyles = panelType => props => {
|
|
|
197
199
|
color: ${text};
|
|
198
200
|
`;
|
|
199
201
|
};
|
|
200
|
-
|
|
201
202
|
export const panelSharedStylesWithoutPrefix = props => css`
|
|
202
203
|
border-radius: ${borderRadius()}px;
|
|
203
204
|
margin: ${blockNodesVerticalMargin} 0 0;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { akEditorLineHeight, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
import { akEditorLineHeight, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
3
3
|
|
|
4
|
+
// @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
|
|
4
5
|
export const paragraphSharedStyles = css`
|
|
5
6
|
& p {
|
|
6
7
|
font-size: 1em;
|
|
@@ -5,8 +5,9 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
5
5
|
const divider = themed({
|
|
6
6
|
light: `var(--ds-border, ${N30A})`,
|
|
7
7
|
dark: `var(--ds-border, ${DN50})`
|
|
8
|
-
});
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
+
// @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
|
|
10
11
|
export const ruleSharedStyles = props => css`
|
|
11
12
|
& hr {
|
|
12
13
|
border: none;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
|
|
2
3
|
import { css } from '@emotion/react';
|
|
3
4
|
import { akEditorShadowZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
5
|
import { N40A } from '@atlaskit/theme/colors';
|
|
5
6
|
import { shadowClassNames } from '../../ui/OverflowShadow';
|
|
6
7
|
import { shadowObserverClassNames } from '../../ui/OverflowShadow/shadowObserver';
|
|
7
8
|
const shadowWidth = 8;
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* TODO: This is close to working and removes a tone of JS from OverflowShadow component
|
|
10
12
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
|
|
2
3
|
import { css } from '@emotion/react';
|
|
3
4
|
import { tableCellContentDomSelector, tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
4
5
|
import { akEditorBreakoutPadding, akEditorFullWidthLayoutWidth, akEditorSelectedNodeClassName, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorWideLayoutWidth, getTableCellBackgroundDarkModeColors, overflowShadow } from '@atlaskit/editor-shared-styles';
|
|
@@ -30,7 +31,6 @@ export const TableSharedCssClassName = {
|
|
|
30
31
|
TABLE_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
|
|
31
32
|
TABLE_COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`
|
|
32
33
|
};
|
|
33
|
-
|
|
34
34
|
const tableSharedStyle = props => css`
|
|
35
35
|
.${TableSharedCssClassName.TABLE_CONTAINER} {
|
|
36
36
|
position: relative;
|
|
@@ -199,19 +199,15 @@ const tableSharedStyle = props => css`
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
`;
|
|
202
|
-
|
|
203
202
|
export const calcTableWidth = (layout, containerWidth, addControllerPadding = true) => {
|
|
204
203
|
switch (layout) {
|
|
205
204
|
case 'full-width':
|
|
206
205
|
return containerWidth ? `${Math.min(containerWidth - (addControllerPadding ? akEditorBreakoutPadding : 0), akEditorFullWidthLayoutWidth)}px` : `${akEditorFullWidthLayoutWidth}px`;
|
|
207
|
-
|
|
208
206
|
case 'wide':
|
|
209
207
|
if (containerWidth) {
|
|
210
208
|
return `${Math.min(containerWidth - (addControllerPadding ? akEditorBreakoutPadding : 0), akEditorWideLayoutWidth)}px`;
|
|
211
209
|
}
|
|
212
|
-
|
|
213
210
|
return `${akEditorWideLayoutWidth}px`;
|
|
214
|
-
|
|
215
211
|
default:
|
|
216
212
|
return 'inherit';
|
|
217
213
|
}
|
|
@@ -7,16 +7,16 @@ export const findExpand = (state, selection) => {
|
|
|
7
7
|
nestedExpand
|
|
8
8
|
} = state.schema.nodes;
|
|
9
9
|
return findSelectedNodeOfType([expand, nestedExpand])(selection || state.selection) || findParentNodeOfType([expand, nestedExpand])(selection || state.selection);
|
|
10
|
-
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// If the top level is a single expand, and the expand is not
|
|
11
13
|
// a part of copied content, then return unwrap contents.
|
|
12
14
|
// This is needed for handling content copied from expand.
|
|
13
15
|
// https://product-fabric.atlassian.net/browse/ED-9146
|
|
14
|
-
|
|
15
16
|
export const transformSliceToRemoveOpenExpand = (slice, schema) => {
|
|
16
17
|
if (slice.openStart > 1 && slice.openEnd > 1 && slice.content.childCount === 1 && slice.content.firstChild && slice.content.firstChild.type === schema.nodes.expand) {
|
|
17
18
|
return new Slice(slice.content.firstChild.content, slice.openStart - 1, slice.openEnd - 1);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
20
|
return slice;
|
|
21
21
|
};
|
|
22
22
|
export const transformSliceNestedExpandToExpand = (slice, schema) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Slice } from 'prosemirror-model';
|
|
2
2
|
import { mapFragment } from '../utils/slice';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* Lift content out of "open" top-level bodiedExtensions.
|
|
5
6
|
* Will not work if bodiedExtensions are nested, or when bodiedExtensions are not in the top level
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
8
|
export const transformSliceToRemoveOpenBodiedExtension = (slice, schema) => {
|
|
9
9
|
const {
|
|
10
10
|
bodiedExtension
|
|
@@ -13,14 +13,13 @@ export const transformSliceToRemoveOpenBodiedExtension = (slice, schema) => {
|
|
|
13
13
|
if (node.type === bodiedExtension && !parent) {
|
|
14
14
|
const currentNodeIsAtStartAndIsOpen = slice.openStart && index === 0;
|
|
15
15
|
const currentNodeIsAtEndAndIsOpen = slice.openEnd && index + 1 === slice.content.childCount;
|
|
16
|
-
|
|
17
16
|
if (currentNodeIsAtStartAndIsOpen || currentNodeIsAtEndAndIsOpen) {
|
|
18
17
|
return node.content;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
return node;
|
|
23
|
-
});
|
|
21
|
+
});
|
|
24
22
|
|
|
23
|
+
// If the first/last child has changed - then we know we've removed a bodied extension & to decrement the open depth
|
|
25
24
|
return new Slice(fragment, fragment.firstChild && fragment.firstChild.type !== slice.content.firstChild.type ? slice.openStart - 1 : slice.openStart, fragment.lastChild && fragment.lastChild.type !== slice.content.lastChild.type ? slice.openEnd - 1 : slice.openEnd);
|
|
26
25
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Fragment, Slice } from 'prosemirror-model';
|
|
2
2
|
import { flatmap, mapFragment } from '../utils/slice';
|
|
3
|
-
|
|
4
3
|
const isLayoutNode = node => node.type === node.type.schema.nodes.layoutSection || node.type === node.type.schema.nodes.layoutColumn;
|
|
5
|
-
|
|
6
4
|
export function unwrapContentFromLayout(maybeLayoutSection) {
|
|
7
5
|
const fragment = mapFragment(Fragment.from(maybeLayoutSection), node => {
|
|
8
6
|
return isLayoutNode(node) ? node.content : node;
|
|
@@ -17,6 +15,7 @@ export function removeLayoutFromFirstChild(node, i) {
|
|
|
17
15
|
export function removeLayoutFromLastChild(node, i, fragment) {
|
|
18
16
|
return i === fragment.childCount - 1 ? unwrapContentFromLayout(node) : node;
|
|
19
17
|
}
|
|
18
|
+
|
|
20
19
|
/**
|
|
21
20
|
* When we have a slice that cuts across a layoutSection/layoutColumn
|
|
22
21
|
* we can end up with unexpected behaviour on paste/drop where a user
|
|
@@ -27,28 +26,28 @@ export function removeLayoutFromLastChild(node, i, fragment) {
|
|
|
27
26
|
* We only care about slices with non-zero openStart / openEnd's here
|
|
28
27
|
* as we're totally fine for people to copy/paste a full layoutSection
|
|
29
28
|
*/
|
|
30
|
-
|
|
31
29
|
export function transformSliceToRemoveOpenLayoutNodes(slice, schema) {
|
|
32
30
|
// Case 1: A slice entirely within a single layoutSection
|
|
33
31
|
if (slice.openStart && slice.openEnd && slice.content.childCount === 1) {
|
|
34
32
|
const maybeLayoutSection = slice.content.firstChild;
|
|
35
|
-
|
|
36
33
|
if (maybeLayoutSection.type === schema.nodes.layoutSection) {
|
|
37
|
-
return new Slice(flatmap(slice.content, removeLayoutFromFirstChild),
|
|
34
|
+
return new Slice(flatmap(slice.content, removeLayoutFromFirstChild),
|
|
35
|
+
// '-2' here because we've removed the layoutSection/layoutColumn; reducing the open depth.
|
|
38
36
|
slice.openStart - 2, slice.openEnd - 2);
|
|
39
37
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
38
|
+
}
|
|
42
39
|
|
|
40
|
+
// Case 2: A slice starting inside a layoutSection and finishing outside
|
|
43
41
|
if (slice.openStart && slice.content.firstChild.type === schema.nodes.layoutSection) {
|
|
44
42
|
slice = new Slice(flatmap(slice.content, removeLayoutFromFirstChild), slice.openStart - 2, slice.openEnd);
|
|
45
|
-
}
|
|
46
|
-
|
|
43
|
+
}
|
|
47
44
|
|
|
45
|
+
// Case 3: A slice starting outside a layoutSection and finishing inside
|
|
48
46
|
if (slice.openEnd && slice.content.lastChild.type === schema.nodes.layoutSection) {
|
|
49
47
|
slice = new Slice(flatmap(slice.content, removeLayoutFromLastChild), slice.openStart, slice.openEnd - 2);
|
|
50
|
-
}
|
|
48
|
+
}
|
|
51
49
|
|
|
50
|
+
// Case 2 & 3 also handles a slice starting in one layoutSection & finishing in a different layoutSection
|
|
52
51
|
|
|
53
52
|
return slice;
|
|
54
53
|
}
|