@atlaskit/editor-core 180.0.0 → 180.1.0
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 +74 -0
- package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
- package/dist/cjs/actions/index.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +12 -762
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +35 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
- package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
- package/dist/cjs/editor-next/index.js +139 -0
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
- package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
- package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
- package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
- package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
- package/dist/cjs/editor.js +130 -443
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
- package/dist/cjs/labs/next/presets/preset.js +0 -5
- package/dist/cjs/labs/next/presets/universal.js +11 -2
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/cjs/plugins/analytics/index.js +2 -3
- package/dist/cjs/plugins/analytics/plugin.js +5 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
- package/dist/cjs/plugins/hyperlink/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/cjs/plugins/media/commands/helpers.js +12 -40
- package/dist/cjs/plugins/media/commands/index.js +4 -4
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/cjs/plugins/panel/utils.js +4 -1
- package/dist/cjs/plugins/paste/handlers.js +128 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/cjs/plugins/text-formatting/utils.js +1 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/types/get-editor-props.js +5 -0
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ContextPanel/context.js +13 -12
- package/dist/cjs/ui/Dropdown/index.js +7 -2
- package/dist/cjs/ui/DropdownMenu/index.js +7 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +32 -0
- package/dist/cjs/utils/linking-utils.js +1 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
- package/dist/cjs/utils/performance/safer-transactions.js +1 -1
- package/dist/cjs/utils/prepare-extension-provider.js +25 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -2
- package/dist/es2019/create-editor/ReactEditorView.js +6 -708
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -0
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +10 -0
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
- package/dist/es2019/editor-next/index.js +90 -0
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
- package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
- package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
- package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
- package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
- package/dist/es2019/editor.js +111 -396
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
- package/dist/es2019/labs/next/presets/preset.js +0 -3
- package/dist/es2019/labs/next/presets/universal.js +13 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
- package/dist/es2019/plugins/analytics/index.js +3 -4
- package/dist/es2019/plugins/analytics/plugin.js +1 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
- package/dist/es2019/plugins/hyperlink/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
- package/dist/es2019/plugins/media/commands/helpers.js +9 -35
- package/dist/es2019/plugins/media/commands/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/es2019/plugins/text-formatting/utils.js +0 -8
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/types/get-editor-props.js +1 -0
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ContextPanel/context.js +5 -4
- package/dist/es2019/ui/Dropdown/index.js +5 -2
- package/dist/es2019/ui/DropdownMenu/index.js +5 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +25 -0
- package/dist/es2019/utils/linking-utils.js +1 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
- package/dist/es2019/utils/performance/safer-transactions.js +1 -1
- package/dist/es2019/utils/prepare-extension-provider.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -2
- package/dist/esm/create-editor/ReactEditorView.js +12 -763
- package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -0
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +28 -0
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
- package/dist/esm/editor-next/index.js +134 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
- package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
- package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/esm/editor-next/utils/handleProviders.js +50 -0
- package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
- package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
- package/dist/esm/editor.js +130 -440
- package/dist/esm/index.js +2 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
- package/dist/esm/labs/next/presets/preset.js +0 -5
- package/dist/esm/labs/next/presets/universal.js +11 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/esm/plugins/analytics/index.js +3 -4
- package/dist/esm/plugins/analytics/plugin.js +1 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/hyperlink/analytics.js +1 -1
- package/dist/esm/plugins/hyperlink/index.js +1 -1
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/esm/plugins/media/commands/helpers.js +9 -35
- package/dist/esm/plugins/media/commands/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/esm/plugins/text-formatting/utils.js +0 -8
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/types/get-editor-props.js +1 -0
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPickerButton/index.js +69 -7
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ContextPanel/context.js +8 -8
- package/dist/esm/ui/Dropdown/index.js +7 -2
- package/dist/esm/ui/DropdownMenu/index.js +7 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +25 -0
- package/dist/esm/utils/linking-utils.js +1 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
- package/dist/esm/utils/performance/safer-transactions.js +1 -1
- package/dist/esm/utils/prepare-extension-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
- package/dist/types/editor-next/editor-internal.d.ts +44 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
- package/dist/types/editor-next/index.d.ts +34 -0
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
- package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
- package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
- package/dist/types/editor.d.ts +47 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
- package/dist/types/labs/next/presets/preset.d.ts +6 -6
- package/dist/types/labs/next/presets/universal.d.ts +1 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
- package/dist/types/plugins/analytics/index.d.ts +3 -6
- package/dist/types/plugins/analytics/plugin.d.ts +3 -1
- package/dist/types/plugins/analytics/utils.d.ts +2 -3
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -1
- package/dist/types/plugins/base/index.d.ts +3 -1
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
- package/dist/types/plugins/block-type/index.d.ts +3 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/breakout/index.d.ts +3 -1
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/context-panel/index.d.ts +1 -1
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +3 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
- package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/hyperlink/types.d.ts +3 -1
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types/plugins/layout/index.d.ts +3 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/max-content-size/index.d.ts +3 -1
- package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
- package/dist/types/plugins/media/commands/index.d.ts +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
- package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +3 -1
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
- package/dist/types/plugins/placeholder/index.d.ts +3 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/plugins/quick-insert/index.d.ts +3 -1
- package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
- package/dist/types/plugins/selection/index.d.ts +3 -1
- package/dist/types/plugins/status/index.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
- package/dist/types/plugins/submit-editor/index.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/index.d.ts +3 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/types/get-editor-props.d.ts +12 -0
- package/dist/types/types/performance-tracking.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/utils/document.d.ts +4 -3
- package/dist/types/utils/get-editor-plugins.d.ts +10 -0
- package/dist/types/utils/linking-utils.d.ts +1 -1
- package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
- package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
- package/docs/0-intro.tsx +0 -1
- package/package.json +23 -22
- package/report.api.md +193 -139
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
- package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
|
@@ -23,6 +23,8 @@ var _DropdownMenu = _interopRequireWildcard(require("./DropdownMenu"));
|
|
|
23
23
|
var _templateObject, _templateObject2;
|
|
24
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
28
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
27
29
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
28
30
|
var dropdownExpandContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px -4px;\n"])));
|
|
@@ -48,8 +50,10 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
48
50
|
}
|
|
49
51
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
50
52
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
51
|
-
isOpen: false
|
|
53
|
+
isOpen: false,
|
|
54
|
+
isOpenedByKeyboard: false
|
|
52
55
|
});
|
|
56
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "triggerRef", /*#__PURE__*/_react.default.createRef());
|
|
53
57
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderArrayOptions", function (options) {
|
|
54
58
|
var _this$props = _this.props,
|
|
55
59
|
showSelected = _this$props.showSelected,
|
|
@@ -65,15 +69,25 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
65
69
|
});
|
|
66
70
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
|
|
67
71
|
_this.setState({
|
|
68
|
-
isOpen: !_this.state.isOpen
|
|
72
|
+
isOpen: !_this.state.isOpen,
|
|
73
|
+
isOpenedByKeyboard: false
|
|
69
74
|
});
|
|
70
75
|
});
|
|
76
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpenByKeyboard", function (event) {
|
|
77
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
_this.setState({
|
|
80
|
+
isOpen: !_this.state.isOpen,
|
|
81
|
+
isOpenedByKeyboard: true
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
71
85
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function () {
|
|
72
|
-
_this.setState({
|
|
86
|
+
_this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
|
|
73
87
|
isOpen: false
|
|
74
|
-
});
|
|
88
|
+
}));
|
|
75
89
|
});
|
|
76
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
90
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideOnEsc", function () {
|
|
77
91
|
var _document$querySelect;
|
|
78
92
|
_this.hide();
|
|
79
93
|
//Focus the trigger button only on Escape
|
|
@@ -82,7 +96,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
82
96
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpenChanged", function (openChangedEvent) {
|
|
83
97
|
if (!openChangedEvent.isOpen && openChangedEvent.event instanceof KeyboardEvent) {
|
|
84
98
|
var _openChangedEvent$eve;
|
|
85
|
-
((_openChangedEvent$eve = openChangedEvent.event) === null || _openChangedEvent$eve === void 0 ? void 0 : _openChangedEvent$eve.key) === 'Escape' ? _this.
|
|
99
|
+
((_openChangedEvent$eve = openChangedEvent.event) === null || _openChangedEvent$eve === void 0 ? void 0 : _openChangedEvent$eve.key) === 'Escape' ? _this.hideOnEsc() : _this.hide();
|
|
86
100
|
}
|
|
87
101
|
});
|
|
88
102
|
return _this;
|
|
@@ -115,6 +129,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
115
129
|
title: title,
|
|
116
130
|
icon: TriggerIcon,
|
|
117
131
|
onClick: this.toggleOpen,
|
|
132
|
+
onKeyDown: this.toggleOpenByKeyboard,
|
|
118
133
|
selected: isOpen,
|
|
119
134
|
disabled: disabled,
|
|
120
135
|
tooltipContent: tooltip
|
|
@@ -128,6 +143,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
128
143
|
label: "Expand dropdown menu"
|
|
129
144
|
})),
|
|
130
145
|
onClick: this.toggleOpen,
|
|
146
|
+
onKeyDown: this.toggleOpenByKeyboard,
|
|
131
147
|
selected: isOpen,
|
|
132
148
|
disabled: disabled,
|
|
133
149
|
tooltipContent: tooltip
|
|
@@ -142,12 +158,13 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
142
158
|
var fitWidth = Array.isArray(options) ? dropdownWidth || _DropdownMenu.menuItemDimensions.width : options.width;
|
|
143
159
|
var fitHeight = Array.isArray(options) ? options.length * _DropdownMenu.menuItemDimensions.height + _DropdownMenu.itemSpacing * 2 : options.height;
|
|
144
160
|
return (0, _react2.jsx)(_Dropdown.default, {
|
|
161
|
+
ref: this.triggerRef,
|
|
145
162
|
mountTo: mountPoint,
|
|
146
163
|
boundariesElement: boundariesElement,
|
|
147
164
|
scrollableElement: scrollableElement,
|
|
148
165
|
isOpen: isOpen,
|
|
149
166
|
handleClickOutside: this.hide,
|
|
150
|
-
handleEscapeKeydown: this.
|
|
167
|
+
handleEscapeKeydown: this.hideOnEsc,
|
|
151
168
|
onOpenChange: this.onOpenChanged,
|
|
152
169
|
fitWidth: fitWidth + fitTolerance,
|
|
153
170
|
fitHeight: fitHeight + fitTolerance,
|
|
@@ -161,8 +178,20 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
161
178
|
}, {
|
|
162
179
|
key: "componentDidUpdate",
|
|
163
180
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
164
|
-
if (
|
|
165
|
-
this.props.setDisableParentScroll
|
|
181
|
+
if (prevState.isOpen !== this.state.isOpen) {
|
|
182
|
+
if (this.props.setDisableParentScroll) {
|
|
183
|
+
this.props.setDisableParentScroll(this.state.isOpen);
|
|
184
|
+
}
|
|
185
|
+
if (this.state.isOpen && this.state.isOpenedByKeyboard) {
|
|
186
|
+
var dropList = document.querySelector('[data-role="droplistContent"]');
|
|
187
|
+
if (dropList) {
|
|
188
|
+
var keyboardEvent = new KeyboardEvent('keydown', {
|
|
189
|
+
bubbles: true,
|
|
190
|
+
key: 'ArrowDown'
|
|
191
|
+
});
|
|
192
|
+
dropList.dispatchEvent(keyboardEvent);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
166
195
|
}
|
|
167
196
|
}
|
|
168
197
|
}]);
|
|
@@ -58,28 +58,30 @@ var ExtensionButton = function ExtensionButton(props) {
|
|
|
58
58
|
var item = props.item,
|
|
59
59
|
node = props.node,
|
|
60
60
|
editorView = props.editorView;
|
|
61
|
-
var ButtonIcon =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
var ButtonIcon = _react.default.useMemo(function () {
|
|
62
|
+
return item.icon ? (0, _reactLoadable.default)({
|
|
63
|
+
loader: function () {
|
|
64
|
+
var _loader = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
65
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
66
|
+
while (1) {
|
|
67
|
+
switch (_context2.prev = _context2.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
return _context2.abrupt("return", resolveExtensionIcon(item.icon));
|
|
70
|
+
case 1:
|
|
71
|
+
case "end":
|
|
72
|
+
return _context2.stop();
|
|
73
|
+
}
|
|
72
74
|
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
75
|
+
}, _callee2);
|
|
76
|
+
}));
|
|
77
|
+
function loader() {
|
|
78
|
+
return _loader.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
return loader;
|
|
81
|
+
}(),
|
|
82
|
+
loading: noop
|
|
83
|
+
}) : undefined;
|
|
84
|
+
}, [item.icon]);
|
|
83
85
|
var onClick = function onClick() {
|
|
84
86
|
if (typeof item.action !== 'function') {
|
|
85
87
|
throw new Error("'action' of context toolbar item '".concat(item.key, "' is not a function"));
|
|
@@ -96,19 +96,14 @@ var _default = function _default(_ref) {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
(0, _react.useEffect)(function () {
|
|
99
|
-
var scrollContainerRefCurrent = scrollContainerRef.current;
|
|
100
99
|
onScroll();
|
|
100
|
+
var scrollContainerRefCurrent = scrollContainerRef.current;
|
|
101
101
|
if (scrollContainerRefCurrent) {
|
|
102
102
|
// enable/disable scroll buttons depending on scroll position
|
|
103
103
|
scrollContainerRefCurrent.addEventListener('scroll', onScroll);
|
|
104
104
|
|
|
105
105
|
// watch for toolbar resize and show/hide scroll buttons if needed
|
|
106
106
|
resizeObserver.observe(scrollContainerRefCurrent);
|
|
107
|
-
|
|
108
|
-
// reset scroll position when switching from one node with toolbar to another
|
|
109
|
-
scrollContainerRefCurrent.scrollTo({
|
|
110
|
-
left: 0
|
|
111
|
-
});
|
|
112
107
|
}
|
|
113
108
|
return function () {
|
|
114
109
|
if (scrollContainerRefCurrent) {
|
|
@@ -117,7 +112,17 @@ var _default = function _default(_ref) {
|
|
|
117
112
|
}
|
|
118
113
|
};
|
|
119
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
-
}, [
|
|
115
|
+
}, []);
|
|
116
|
+
(0, _react.useEffect)(function () {
|
|
117
|
+
var scrollContainerRefCurrent = scrollContainerRef.current;
|
|
118
|
+
if (scrollContainerRefCurrent) {
|
|
119
|
+
// reset scroll position when switching from one node with toolbar to another
|
|
120
|
+
scrollContainerRefCurrent.scrollTo({
|
|
121
|
+
left: 0
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125
|
+
}, [node.type]);
|
|
121
126
|
return needScroll ? (0, _react2.jsx)("div", {
|
|
122
127
|
ref: buttonsContainerRef,
|
|
123
128
|
css: toolbarScrollButtons,
|
|
@@ -18,6 +18,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
21
|
+
var _editorPalette = require("@atlaskit/editor-palette");
|
|
21
22
|
var _components = require("@atlaskit/theme/components");
|
|
22
23
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
24
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -182,6 +183,15 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
182
183
|
placement: "Panels",
|
|
183
184
|
mountPoint: emojiAndColourPickerMountPoint,
|
|
184
185
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined
|
|
186
|
+
// Currently in floating toolbar, color picker is only
|
|
187
|
+
// used in panel and table cell background color.
|
|
188
|
+
// Both uses same color palette.
|
|
189
|
+
// That's why hard-coding hexToEditorBackgroundPaletteColor.
|
|
190
|
+
// When we need to support different color palette
|
|
191
|
+
// in floating toolbar, we need to set hexToPaletteColor
|
|
192
|
+
// in item options.
|
|
193
|
+
,
|
|
194
|
+
hexToPaletteColor: _editorPalette.hexToEditorBackgroundPaletteColor
|
|
185
195
|
});
|
|
186
196
|
}
|
|
187
197
|
if (item.selectType === 'emoji') {
|
|
@@ -443,6 +453,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
443
453
|
text: intl.formatMessage(_messages.default.floatingToolbarAnnouncer),
|
|
444
454
|
delay: 250
|
|
445
455
|
}), (0, _react2.jsx)("div", {
|
|
456
|
+
"data-testid": "floating-toolbar-items",
|
|
446
457
|
ref: this.scrollContainerRef,
|
|
447
458
|
css: toolbarOverflow(scrollable, this.state.scrollDisabled, firstElementIsSelect)
|
|
448
459
|
}, (0, _react2.jsx)(ToolbarItems, (0, _extends2.default)({}, this.props, {
|
|
@@ -67,6 +67,7 @@ var regenerateFragmentIdIfNeeded = function regenerateFragmentIdIfNeeded(_ref) {
|
|
|
67
67
|
transaction.setNodeMarkup(pos, undefined, node.attrs, node.marks.map(function (mark) {
|
|
68
68
|
if (mark.type === fragment) {
|
|
69
69
|
mark.attrs.localId = _adfSchema.uuid.generate();
|
|
70
|
+
mark.attrs.name = null;
|
|
70
71
|
}
|
|
71
72
|
return mark;
|
|
72
73
|
}));
|
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getLinkCreationAnalyticsEvent = getLinkCreationAnalyticsEvent;
|
|
7
|
-
var
|
|
7
|
+
var _types = require("../analytics/types");
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
function getLinkCreationAnalyticsEvent(inputMethod, url) {
|
|
10
10
|
return {
|
|
11
|
-
action:
|
|
12
|
-
actionSubject:
|
|
13
|
-
actionSubjectId:
|
|
11
|
+
action: _types.ACTION.INSERTED,
|
|
12
|
+
actionSubject: _types.ACTION_SUBJECT.DOCUMENT,
|
|
13
|
+
actionSubjectId: _types.ACTION_SUBJECT_ID.LINK,
|
|
14
14
|
attributes: {
|
|
15
15
|
inputMethod: inputMethod,
|
|
16
16
|
fromCurrentDomain: (0, _utils.isFromCurrentDomain)(url)
|
|
17
17
|
},
|
|
18
|
-
eventType:
|
|
18
|
+
eventType: _types.EVENT_TYPE.TRACK,
|
|
19
19
|
nonPrivacySafeAttributes: {
|
|
20
20
|
linkDomain: (0, _utils.getLinkDomain)(url)
|
|
21
21
|
}
|
|
@@ -34,7 +34,7 @@ var hyperlinkPlugin = function hyperlinkPlugin(options) {
|
|
|
34
34
|
name: 'hyperlink',
|
|
35
35
|
plugin: function plugin(_ref) {
|
|
36
36
|
var dispatch = _ref.dispatch;
|
|
37
|
-
return (0, _main.plugin)(dispatch);
|
|
37
|
+
return (0, _main.plugin)(dispatch, options === null || options === void 0 ? void 0 : options.editorAppearance);
|
|
38
38
|
}
|
|
39
39
|
}, {
|
|
40
40
|
name: 'fakeCursorToolbarPlugin',
|
|
@@ -193,7 +193,7 @@ var getActiveText = function getActiveText(selection) {
|
|
|
193
193
|
};
|
|
194
194
|
var stateKey = new _prosemirrorState.PluginKey('hyperlinkPlugin');
|
|
195
195
|
exports.stateKey = stateKey;
|
|
196
|
-
var plugin = function plugin(dispatch) {
|
|
196
|
+
var plugin = function plugin(dispatch, editorAppearance) {
|
|
197
197
|
return new _safePlugin.SafePlugin({
|
|
198
198
|
state: {
|
|
199
199
|
init: function init(_, state) {
|
|
@@ -202,7 +202,8 @@ var plugin = function plugin(dispatch) {
|
|
|
202
202
|
activeText: getActiveText(state.selection),
|
|
203
203
|
canInsertLink: canInsertLink,
|
|
204
204
|
timesViewed: 0,
|
|
205
|
-
activeLinkMark: toState(undefined, LinkAction.SELECTION_CHANGE, state)
|
|
205
|
+
activeLinkMark: toState(undefined, LinkAction.SELECTION_CHANGE, state),
|
|
206
|
+
editorAppearance: editorAppearance
|
|
206
207
|
};
|
|
207
208
|
},
|
|
208
209
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
@@ -215,7 +216,8 @@ var plugin = function plugin(dispatch) {
|
|
|
215
216
|
canInsertLink: canLinkBeCreatedInRange(newState.selection.from, newState.selection.to)(newState),
|
|
216
217
|
timesViewed: state.timesViewed,
|
|
217
218
|
inputMethod: inputMethod,
|
|
218
|
-
activeLinkMark: mapTransactionToState(state.activeLinkMark, tr)
|
|
219
|
+
activeLinkMark: mapTransactionToState(state.activeLinkMark, tr),
|
|
220
|
+
editorAppearance: editorAppearance
|
|
219
221
|
};
|
|
220
222
|
}
|
|
221
223
|
if (action) {
|
|
@@ -230,7 +232,8 @@ var plugin = function plugin(dispatch) {
|
|
|
230
232
|
activeText: state.activeText,
|
|
231
233
|
canInsertLink: state.canInsertLink,
|
|
232
234
|
inputMethod: inputMethod,
|
|
233
|
-
activeLinkMark: toState(state.activeLinkMark, action, newState)
|
|
235
|
+
activeLinkMark: toState(state.activeLinkMark, action, newState),
|
|
236
|
+
editorAppearance: editorAppearance
|
|
234
237
|
}, stateForAnalytics);
|
|
235
238
|
}
|
|
236
239
|
var hasPositionChanged = oldState.selection.from !== newState.selection.from || oldState.selection.to !== newState.selection.to;
|
|
@@ -241,7 +244,8 @@ var plugin = function plugin(dispatch) {
|
|
|
241
244
|
activeLinkMark: toState(state.activeLinkMark, LinkAction.SELECTION_CHANGE, newState),
|
|
242
245
|
timesViewed: state.timesViewed,
|
|
243
246
|
searchSessionId: state.searchSessionId,
|
|
244
|
-
inputMethod: inputMethod
|
|
247
|
+
inputMethod: inputMethod,
|
|
248
|
+
editorAppearance: editorAppearance
|
|
245
249
|
};
|
|
246
250
|
}
|
|
247
251
|
if (!(0, _utils.shallowEqual)(state, pluginState)) {
|
|
@@ -14,7 +14,8 @@ var _actions = require("../../../card/pm-plugins/actions");
|
|
|
14
14
|
var _commands = require("../../commands");
|
|
15
15
|
var _useEscapeClickaway = require("./useEscapeClickaway");
|
|
16
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
|
-
var
|
|
17
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
18
|
+
var _excluded = ["view", "onCancel", "invokeMethod", "editorAppearance"];
|
|
18
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
21
|
var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
@@ -22,6 +23,7 @@ var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
|
22
23
|
onCancel = _ref.onCancel,
|
|
23
24
|
_ref$invokeMethod = _ref.invokeMethod,
|
|
24
25
|
invokeMethod = _ref$invokeMethod === void 0 ? '_unknown' : _ref$invokeMethod,
|
|
26
|
+
editorAppearance = _ref.editorAppearance,
|
|
25
27
|
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
26
28
|
var onEscape = (0, _react.useCallback)(function () {
|
|
27
29
|
(0, _commands.hideLinkToolbar)()(view.state, view.dispatch);
|
|
@@ -33,13 +35,17 @@ var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
|
33
35
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
34
36
|
}, [view, onCancel]);
|
|
35
37
|
var ref = (0, _useEscapeClickaway.useEscapeClickaway)(onEscape, onClickAway);
|
|
38
|
+
var analyticsEditorAppearance = (0, _utils.getAnalyticsEditorAppearance)(editorAppearance);
|
|
36
39
|
var analyticsData = (0, _react.useMemo)(function () {
|
|
37
40
|
return {
|
|
38
41
|
attributes: {
|
|
39
|
-
invokeMethod: invokeMethod
|
|
40
|
-
|
|
42
|
+
invokeMethod: invokeMethod,
|
|
43
|
+
location: analyticsEditorAppearance
|
|
44
|
+
},
|
|
45
|
+
// Below is added for the future implementation of Linking Platform namespaced analytic context
|
|
46
|
+
location: analyticsEditorAppearance
|
|
41
47
|
};
|
|
42
|
-
}, [invokeMethod]);
|
|
48
|
+
}, [invokeMethod, analyticsEditorAppearance]);
|
|
43
49
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
50
|
ref: ref
|
|
45
51
|
}, /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
@@ -33,7 +33,7 @@ var _messages = require("../../../../messages");
|
|
|
33
33
|
var _PanelTextInput = _interopRequireDefault(require("../../../../ui/PanelTextInput"));
|
|
34
34
|
var _LinkSearchList = _interopRequireDefault(require("../../../../ui/LinkSearch/LinkSearchList"));
|
|
35
35
|
var _ToolbarComponents = require("../../../../ui/LinkSearch/ToolbarComponents");
|
|
36
|
-
var _analytics = require("
|
|
36
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
37
37
|
var _utils = require("../../utils");
|
|
38
38
|
var _array = require("../../../../utils/array");
|
|
39
39
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
@@ -14,7 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
16
16
|
var _HyperlinkAddToolbar = _interopRequireDefault(require("./HyperlinkAddToolbar"));
|
|
17
|
-
var
|
|
17
|
+
var _types = require("../../../analytics/types");
|
|
18
18
|
var _main = require("../../pm-plugins/main");
|
|
19
19
|
var _WithPluginState = _interopRequireDefault(require("../../../../ui/WithPluginState"));
|
|
20
20
|
var _featureFlagsContext = require("../../../feature-flags-context");
|
|
@@ -31,7 +31,7 @@ var onSubmitInterface = function onSubmitInterface(onSubmit) {
|
|
|
31
31
|
displayText = _ref.displayText,
|
|
32
32
|
rawUrl = _ref.rawUrl,
|
|
33
33
|
meta = _ref.meta;
|
|
34
|
-
onSubmit(url, title !== null && title !== void 0 ? title : rawUrl, displayText || undefined, meta.inputMethod === 'manual' ?
|
|
34
|
+
onSubmit(url, title !== null && title !== void 0 ? title : rawUrl, displayText || undefined, meta.inputMethod === 'manual' ? _types.INPUT_METHOD.MANUAL : _types.INPUT_METHOD.TYPEAHEAD);
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -74,7 +74,8 @@ var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
74
|
view: view,
|
|
75
75
|
invokeMethod: // Provide `invokeMethod` prop as preferred value (card plugin passes as prop) otherwise assume this
|
|
76
76
|
// is being used from inside the hyperlink plugin and use inputMethod from plugin state
|
|
77
|
-
invokeMethod !== null && invokeMethod !== void 0 ? invokeMethod : hyperlinkPluginState === null || hyperlinkPluginState === void 0 ? void 0 : hyperlinkPluginState.inputMethod
|
|
77
|
+
invokeMethod !== null && invokeMethod !== void 0 ? invokeMethod : hyperlinkPluginState === null || hyperlinkPluginState === void 0 ? void 0 : hyperlinkPluginState.inputMethod,
|
|
78
|
+
editorAppearance: hyperlinkPluginState === null || hyperlinkPluginState === void 0 ? void 0 : hyperlinkPluginState.editorAppearance
|
|
78
79
|
}, linkPickerOptions, {
|
|
79
80
|
url: displayUrl,
|
|
80
81
|
displayText: displayText,
|
|
@@ -33,6 +33,7 @@ var BlockInsertElementBrowser = function BlockInsertElementBrowser(props) {
|
|
|
33
33
|
selected: props.open,
|
|
34
34
|
disabled: props.disabled,
|
|
35
35
|
onClick: props.onClick,
|
|
36
|
+
onKeyDown: props.onKeyDown,
|
|
36
37
|
spacing: props.spacing,
|
|
37
38
|
label: props.label,
|
|
38
39
|
"aria-keyshortcuts": "/"
|
|
@@ -21,6 +21,7 @@ var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
21
21
|
selected: props.open,
|
|
22
22
|
disabled: props.disabled,
|
|
23
23
|
onClick: props.onClick,
|
|
24
|
+
onKeyDown: props.onKeyDown,
|
|
24
25
|
spacing: props.spacing,
|
|
25
26
|
label: props.label,
|
|
26
27
|
"aria-keyshortcuts": "/"
|
|
@@ -33,6 +34,7 @@ var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
33
34
|
items: props.items,
|
|
34
35
|
label: props.label,
|
|
35
36
|
onClick: props.onClick,
|
|
37
|
+
onKeyDown: props.onKeyDown,
|
|
36
38
|
onInsert: props.onInsert,
|
|
37
39
|
onRef: props.onPlusButtonRef,
|
|
38
40
|
open: props.open,
|
|
@@ -50,6 +52,7 @@ var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
50
52
|
items: props.items,
|
|
51
53
|
label: props.label,
|
|
52
54
|
onClick: props.onClick,
|
|
55
|
+
onKeyDown: props.onKeyDown,
|
|
53
56
|
onItemActivated: props.onItemActivated,
|
|
54
57
|
onOpenChange: props.onOpenChange,
|
|
55
58
|
onRef: props.onRef,
|
|
@@ -32,6 +32,7 @@ var DropDownButton = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
32
32
|
selected: props.selected,
|
|
33
33
|
disabled: props.disabled,
|
|
34
34
|
onClick: props.onClick,
|
|
35
|
+
onKeyDown: props.onKeyDown,
|
|
35
36
|
spacing: props.spacing,
|
|
36
37
|
"aria-expanded": props['aria-expanded'],
|
|
37
38
|
"aria-haspopup": props['aria-haspopup'],
|
|
@@ -62,6 +62,7 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
62
62
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
63
63
|
isPlusMenuOpen: false,
|
|
64
64
|
emojiPickerOpen: false,
|
|
65
|
+
isOpenedByKeyboard: false,
|
|
65
66
|
buttons: [],
|
|
66
67
|
dropdownItems: []
|
|
67
68
|
});
|
|
@@ -161,6 +162,15 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
161
162
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
|
|
162
163
|
_this.togglePlusMenuVisibility();
|
|
163
164
|
});
|
|
165
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenByKeyboard", function (event) {
|
|
166
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
167
|
+
_this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
|
|
168
|
+
isOpenedByKeyboard: true
|
|
169
|
+
}));
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
_this.togglePlusMenuVisibility();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
164
174
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleLinkPanel", function (inputMethod) {
|
|
165
175
|
var editorView = _this.props.editorView;
|
|
166
176
|
(0, _commands4.showLinkToolbar)(inputMethod)(editorView.state, editorView.dispatch);
|
|
@@ -383,6 +393,17 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
383
393
|
emojiPickerOpen: false
|
|
384
394
|
});
|
|
385
395
|
}
|
|
396
|
+
if (this.state.isOpenedByKeyboard) {
|
|
397
|
+
var _this$dropdownButtonR;
|
|
398
|
+
var downArrowEvent = new KeyboardEvent('keydown', {
|
|
399
|
+
bubbles: true,
|
|
400
|
+
key: 'ArrowDown'
|
|
401
|
+
});
|
|
402
|
+
(_this$dropdownButtonR = this.dropdownButtonRef) === null || _this$dropdownButtonR === void 0 ? void 0 : _this$dropdownButtonR.dispatchEvent(downArrowEvent);
|
|
403
|
+
this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
|
|
404
|
+
isOpenedByKeyboard: false
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
386
407
|
}
|
|
387
408
|
}, {
|
|
388
409
|
key: "renderPopup",
|
|
@@ -468,6 +489,7 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
468
489
|
onRef: this.handleDropDownButtonRef,
|
|
469
490
|
onPlusButtonRef: this.handlePlusButtonRef,
|
|
470
491
|
onClick: this.handleClick,
|
|
492
|
+
onKeyDown: this.handleOpenByKeyboard,
|
|
471
493
|
onItemActivated: this.insertInsertMenuItem,
|
|
472
494
|
onInsert: this.insertInsertMenuItem,
|
|
473
495
|
onOpenChange: this.onOpenChange,
|
|
@@ -4,12 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.updateMediaSingleNodeAttrs = exports.updateCurrentMediaNodeAttrs = exports.updateAllMediaSingleNodesAttrs = exports.replaceExternalMedia = exports.isMediaNode = exports.findMediaSingleNode = exports.findAllMediaSingleNodes = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
10
10
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
11
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
/**
|
|
14
|
+
* Note that Media Inline is inserted like a media single node into the media plugin state.
|
|
15
|
+
* Though it is not of type mediaSingle, it shares the same `findMediaSingleNode` method
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
13
18
|
var findMediaSingleNode = function findMediaSingleNode(mediaPluginState, id) {
|
|
14
19
|
var mediaNodes = mediaPluginState.mediaNodes;
|
|
15
20
|
|
|
@@ -25,25 +30,7 @@ var findMediaSingleNode = function findMediaSingleNode(mediaPluginState, id) {
|
|
|
25
30
|
return memo;
|
|
26
31
|
}, null);
|
|
27
32
|
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Finds the media inline node with the given id.
|
|
31
|
-
* Media Inline is inserted like a media single node into the media plugin state.
|
|
32
|
-
* However it is not of type mediaSingle.
|
|
33
|
-
*
|
|
34
|
-
* @param mediaPluginState
|
|
35
|
-
* @param id
|
|
36
|
-
* @param isMediaSingle
|
|
37
|
-
* @returns {MediaNodeWithPosHandler | null}
|
|
38
|
-
*/
|
|
39
33
|
exports.findMediaSingleNode = findMediaSingleNode;
|
|
40
|
-
var findMediaInlineNode = function findMediaInlineNode(mediaPluginState, id, isMediaSingle) {
|
|
41
|
-
if (!isMediaSingle) {
|
|
42
|
-
return findMediaSingleNode(mediaPluginState, id);
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
exports.findMediaInlineNode = findMediaInlineNode;
|
|
47
34
|
var findAllMediaSingleNodes = function findAllMediaSingleNodes(mediaPluginState, id) {
|
|
48
35
|
var mediaNodes = mediaPluginState.mediaNodes;
|
|
49
36
|
return mediaNodes.filter(function (nodeWithHandler) {
|
|
@@ -51,31 +38,16 @@ var findAllMediaSingleNodes = function findAllMediaSingleNodes(mediaPluginState,
|
|
|
51
38
|
});
|
|
52
39
|
};
|
|
53
40
|
exports.findAllMediaSingleNodes = findAllMediaSingleNodes;
|
|
54
|
-
var findMediaNode = function findMediaNode(mediaPluginState, id, isMediaSingle) {
|
|
55
|
-
var mediaNodeWithPos = isMediaSingle ? findMediaSingleNode(mediaPluginState, id) : mediaPluginState.mediaGroupNodes[id];
|
|
56
|
-
|
|
57
|
-
// Should attempt to find media inline node if media single node or media group node is not found
|
|
58
|
-
if (!mediaNodeWithPos) {
|
|
59
|
-
return findMediaInlineNode(mediaPluginState, id, isMediaSingle);
|
|
60
|
-
}
|
|
61
|
-
return mediaNodeWithPos;
|
|
62
|
-
};
|
|
63
|
-
exports.findMediaNode = findMediaNode;
|
|
64
41
|
var isMediaNode = function isMediaNode(pos, state) {
|
|
65
42
|
var node = state.doc.nodeAt(pos);
|
|
66
43
|
return node && ['media', 'mediaInline'].includes(node.type.name);
|
|
67
44
|
};
|
|
68
45
|
exports.isMediaNode = isMediaNode;
|
|
69
|
-
var
|
|
46
|
+
var updateAllMediaSingleNodesAttrs = function updateAllMediaSingleNodesAttrs(id, attrs) {
|
|
70
47
|
return function (state, dispatch) {
|
|
71
48
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
72
49
|
var mediaNodes;
|
|
73
|
-
|
|
74
|
-
mediaNodes = findAllMediaSingleNodes(mediaPluginState, id);
|
|
75
|
-
} else {
|
|
76
|
-
var mediaGroupNode = findMediaNode(mediaPluginState, id, isMediaSingle);
|
|
77
|
-
mediaNodes = mediaGroupNode ? [mediaGroupNode] : [];
|
|
78
|
-
}
|
|
50
|
+
mediaNodes = findAllMediaSingleNodes(mediaPluginState, id);
|
|
79
51
|
var validMediaNodePositions = mediaNodes.reduce(function (acc, _ref) {
|
|
80
52
|
var getPos = _ref.getPos;
|
|
81
53
|
var pos = getPos();
|
|
@@ -99,7 +71,7 @@ var updateAllMediaNodesAttrs = function updateAllMediaNodesAttrs(id, attrs, isMe
|
|
|
99
71
|
return true;
|
|
100
72
|
};
|
|
101
73
|
};
|
|
102
|
-
exports.
|
|
74
|
+
exports.updateAllMediaSingleNodesAttrs = updateAllMediaSingleNodesAttrs;
|
|
103
75
|
var updateCurrentMediaNodeAttrs = function updateCurrentMediaNodeAttrs(attrs, mediaNode) {
|
|
104
76
|
return function (state, dispatch) {
|
|
105
77
|
var pos = mediaNode.getPos();
|
|
@@ -116,10 +88,10 @@ var updateCurrentMediaNodeAttrs = function updateCurrentMediaNodeAttrs(attrs, me
|
|
|
116
88
|
};
|
|
117
89
|
};
|
|
118
90
|
exports.updateCurrentMediaNodeAttrs = updateCurrentMediaNodeAttrs;
|
|
119
|
-
var
|
|
91
|
+
var updateMediaSingleNodeAttrs = function updateMediaSingleNodeAttrs(id, attrs) {
|
|
120
92
|
return function (state, dispatch) {
|
|
121
93
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
122
|
-
var mediaNodeWithPos =
|
|
94
|
+
var mediaNodeWithPos = findMediaSingleNode(mediaPluginState, id);
|
|
123
95
|
if (!mediaNodeWithPos) {
|
|
124
96
|
return false;
|
|
125
97
|
}
|
|
@@ -135,7 +107,7 @@ var updateMediaNodeAttrs = function updateMediaNodeAttrs(id, attrs, isMediaSingl
|
|
|
135
107
|
return true;
|
|
136
108
|
};
|
|
137
109
|
};
|
|
138
|
-
exports.
|
|
110
|
+
exports.updateMediaSingleNodeAttrs = updateMediaSingleNodeAttrs;
|
|
139
111
|
var replaceExternalMedia = function replaceExternalMedia(pos, attrs) {
|
|
140
112
|
return function (state, dispatch) {
|
|
141
113
|
var tr = state.tr;
|
|
@@ -9,16 +9,16 @@ Object.defineProperty(exports, "replaceExternalMedia", {
|
|
|
9
9
|
return _helpers.replaceExternalMedia;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "updateAllMediaSingleNodesAttrs", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _helpers.
|
|
15
|
+
return _helpers.updateAllMediaSingleNodesAttrs;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "updateMediaSingleNodeAttrs", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return _helpers.
|
|
21
|
+
return _helpers.updateMediaSingleNodeAttrs;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
var _helpers = require("./helpers");
|