@atlaskit/editor-core 171.0.0 → 172.0.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 +96 -0
- package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
- package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
- package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +13 -4
- package/dist/cjs/create-editor/create-plugins-list.js +21 -12
- package/dist/cjs/editor.js +8 -23
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/nodeviews/context-adapter.js +2 -2
- package/dist/cjs/plugins/analytics/plugin.js +24 -11
- package/dist/cjs/plugins/base/index.js +3 -3
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
- package/dist/cjs/plugins/card/index.js +1 -1
- package/dist/cjs/plugins/card/toolbar.js +11 -5
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/code-block/actions.js +13 -0
- package/dist/cjs/plugins/code-block/index.js +7 -0
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
- package/dist/cjs/plugins/code-block/styles.js +3 -36
- package/dist/cjs/plugins/code-block/toolbar.js +9 -0
- package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
- package/dist/cjs/plugins/copy-button/commands.js +40 -20
- package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
- package/dist/cjs/plugins/copy-button/utils.js +16 -38
- package/dist/cjs/plugins/expand/toolbar.js +8 -2
- package/dist/cjs/plugins/extension/toolbar.js +5 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
- package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
- package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
- package/dist/cjs/plugins/hyperlink/index.js +4 -4
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
- package/dist/cjs/plugins/indentation/commands/index.js +35 -7
- package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
- package/dist/cjs/plugins/layout/toolbar.js +3 -1
- package/dist/cjs/plugins/media/toolbar/index.js +13 -5
- package/dist/cjs/plugins/mentions/analytics.js +5 -5
- package/dist/cjs/plugins/panel/toolbar.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
- package/dist/cjs/plugins/paste/handlers.js +25 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
- package/dist/cjs/plugins/status/analytics.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +2 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
- package/dist/cjs/types/browser.js +6 -0
- package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +1 -3
- package/dist/cjs/ui/DropList/index.js +215 -0
- package/dist/cjs/ui/Dropdown/index.js +2 -5
- package/dist/cjs/ui/DropdownMenu/index.js +140 -86
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
- package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
- package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
- package/dist/cjs/ui/Layer/index.js +245 -0
- package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
- package/dist/cjs/ui/PortalProvider/index.js +7 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +15 -4
- package/dist/es2019/create-editor/create-plugins-list.js +21 -11
- package/dist/es2019/editor.js +9 -23
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/nodeviews/context-adapter.js +2 -2
- package/dist/es2019/plugins/analytics/plugin.js +19 -4
- package/dist/es2019/plugins/base/index.js +3 -3
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
- package/dist/es2019/plugins/card/index.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +10 -5
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/code-block/actions.js +12 -0
- package/dist/es2019/plugins/code-block/index.js +4 -0
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
- package/dist/es2019/plugins/code-block/styles.js +2 -159
- package/dist/es2019/plugins/code-block/toolbar.js +8 -0
- package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
- package/dist/es2019/plugins/copy-button/commands.js +35 -15
- package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
- package/dist/es2019/plugins/copy-button/utils.js +15 -27
- package/dist/es2019/plugins/expand/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
- package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
- package/dist/es2019/plugins/hyperlink/index.js +4 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
- package/dist/es2019/plugins/indentation/commands/index.js +24 -9
- package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/es2019/plugins/layout/toolbar.js +2 -1
- package/dist/es2019/plugins/media/toolbar/index.js +10 -3
- package/dist/es2019/plugins/mentions/analytics.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
- package/dist/es2019/plugins/paste/handlers.js +27 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
- package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
- package/dist/es2019/plugins/status/analytics.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +2 -0
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/es2019/types/browser.js +2 -0
- package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +5 -9
- package/dist/es2019/ui/DropList/index.js +186 -0
- package/dist/es2019/ui/Dropdown/index.js +2 -6
- package/dist/es2019/ui/DropdownMenu/index.js +124 -75
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
- package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
- package/dist/es2019/ui/Layer/index.js +195 -0
- package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
- package/dist/es2019/ui/PortalProvider/index.js +5 -23
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +13 -4
- package/dist/esm/create-editor/create-plugins-list.js +21 -12
- package/dist/esm/editor.js +9 -23
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/nodeviews/context-adapter.js +2 -2
- package/dist/esm/plugins/analytics/plugin.js +24 -11
- package/dist/esm/plugins/base/index.js +3 -3
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
- package/dist/esm/plugins/card/index.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +11 -5
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/code-block/actions.js +12 -0
- package/dist/esm/plugins/code-block/index.js +6 -0
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
- package/dist/esm/plugins/code-block/styles.js +4 -32
- package/dist/esm/plugins/code-block/toolbar.js +8 -0
- package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
- package/dist/esm/plugins/copy-button/commands.js +35 -15
- package/dist/esm/plugins/copy-button/toolbar.js +31 -0
- package/dist/esm/plugins/copy-button/utils.js +14 -29
- package/dist/esm/plugins/expand/toolbar.js +6 -2
- package/dist/esm/plugins/extension/toolbar.js +4 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
- package/dist/esm/plugins/hyperlink/index.js +4 -4
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
- package/dist/esm/plugins/indentation/commands/index.js +30 -9
- package/dist/esm/plugins/indentation/commands/utils.js +12 -8
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/esm/plugins/layout/toolbar.js +2 -1
- package/dist/esm/plugins/media/toolbar/index.js +12 -5
- package/dist/esm/plugins/mentions/analytics.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
- package/dist/esm/plugins/paste/handlers.js +23 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
- package/dist/esm/plugins/status/analytics.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/esm/types/browser.js +2 -0
- package/dist/esm/ui/Addon/click-area-helper.js +37 -18
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +2 -4
- package/dist/esm/ui/DropList/index.js +203 -0
- package/dist/esm/ui/Dropdown/index.js +2 -6
- package/dist/esm/ui/DropdownMenu/index.js +134 -88
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
- package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/esm/ui/ElementBrowser/constants.js +1 -4
- package/dist/esm/ui/Layer/index.js +228 -0
- package/dist/esm/ui/Layer/internal/helpers.js +62 -0
- package/dist/esm/ui/PortalProvider/index.js +7 -26
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/plugins/analytics/plugin.d.ts +5 -1
- package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
- package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
- package/dist/types/plugins/card/index.d.ts +2 -7
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +3 -5
- package/dist/types/plugins/card/types.d.ts +2 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
- package/dist/types/plugins/code-block/styles.d.ts +0 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -6
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/index.d.ts +2 -2
- package/dist/types/plugins/hyperlink/types.d.ts +30 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
- package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
- package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
- package/dist/types/plugins/paste/handlers.d.ts +1 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/types/browser.d.ts +10 -0
- package/dist/types/types/editor-props.d.ts +6 -5
- package/dist/types/types/feature-flags.d.ts +29 -24
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/DropList/index.d.ts +22 -0
- package/dist/types/ui/Dropdown/index.d.ts +2 -1
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
- package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
- package/dist/types/ui/Layer/index.d.ts +47 -0
- package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
- package/package.json +23 -18
- package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
- package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
- package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
- package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
- package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
- package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
- package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import rafSchedule from 'raf-schd';
|
|
4
|
+
import Popper from 'popper.js'; // eslint-disable-line import/extensions
|
|
5
|
+
|
|
6
|
+
import { positionPropToPopperPosition } from './internal/helpers';
|
|
7
|
+
const defaultState = {
|
|
8
|
+
hasExtractedStyles: false,
|
|
9
|
+
// We set these default offsets to prevent a flash of popper content in the wrong position
|
|
10
|
+
// which can cause incorrect height calculations. Popper will calculate these values
|
|
11
|
+
offsets: {
|
|
12
|
+
popper: {
|
|
13
|
+
left: -9999,
|
|
14
|
+
top: -9999,
|
|
15
|
+
position: null
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
// fix Safari parent width: https://product-fabric.atlassian.net/browse/ED-1784
|
|
19
|
+
cssPosition: 'absolute',
|
|
20
|
+
originalHeight: null,
|
|
21
|
+
maxHeight: null
|
|
22
|
+
};
|
|
23
|
+
export default class Layer extends Component {
|
|
24
|
+
// working with extract-react-types
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
|
|
28
|
+
_defineProperty(this, "targetRef", /*#__PURE__*/React.createRef());
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "contentRef", /*#__PURE__*/React.createRef());
|
|
31
|
+
|
|
32
|
+
_defineProperty(this, "extractStyles", state => {
|
|
33
|
+
if (state) {
|
|
34
|
+
const popperHeight = state.offsets.popper.height;
|
|
35
|
+
const left = Math.round(state.offsets.popper.left);
|
|
36
|
+
const top = Math.round(state.offsets.popper.top);
|
|
37
|
+
const cssPosition = 'absolute';
|
|
38
|
+
const originalHeight = this.state.originalHeight || popperHeight;
|
|
39
|
+
const maxHeight = this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition);
|
|
40
|
+
this.setState({
|
|
41
|
+
// position: fixed or absolute
|
|
42
|
+
cssPosition,
|
|
43
|
+
hasExtractedStyles: true,
|
|
44
|
+
transform: `translate3d(${left}px, ${top}px, 0px)`,
|
|
45
|
+
originalHeight,
|
|
46
|
+
maxHeight
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
this.state = defaultState;
|
|
52
|
+
this.extractStyles = rafSchedule(this.extractStyles.bind(this));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidMount() {
|
|
56
|
+
this.applyPopper(this.props);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
60
|
+
this.applyPopper(nextProps);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
componentDidUpdate(prevProps, prevState) {
|
|
64
|
+
const {
|
|
65
|
+
onPositioned
|
|
66
|
+
} = this.props;
|
|
67
|
+
const {
|
|
68
|
+
hasExtractedStyles
|
|
69
|
+
} = this.state; // This flag is set the first time the position is calculated from Popper and applied to the content
|
|
70
|
+
|
|
71
|
+
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) {
|
|
72
|
+
onPositioned();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
componentWillUnmount() {
|
|
77
|
+
// this.extractStyles.cancel();
|
|
78
|
+
if (this.popper) {
|
|
79
|
+
this.popper.destroy();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent
|
|
83
|
+
* the bottom of the popper not being viewable.
|
|
84
|
+
* Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
|
|
89
|
+
let DocumentElementClientHeight = 0;
|
|
90
|
+
|
|
91
|
+
if (document.documentElement) {
|
|
92
|
+
DocumentElementClientHeight = document.documentElement.clientHeight;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (cssPosition !== 'fixed') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0);
|
|
100
|
+
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? // allow some spacing either side of viewport height
|
|
101
|
+
viewportHeight - 12 : null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
applyPopper(props) {
|
|
105
|
+
if (!this.targetRef.current || !this.contentRef.current) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.popper) {
|
|
110
|
+
this.popper.destroy();
|
|
111
|
+
} // "new Popper(...)" operation is very expensive when called on virtual DOM.
|
|
112
|
+
// This condition reduces the number of calls so we can run our tests faster
|
|
113
|
+
// (time was reduced from 100s to 13s).
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if (!props.content) {
|
|
117
|
+
return;
|
|
118
|
+
} // we wrap our target in a div so that we can safely get a reference to it, but we pass the
|
|
119
|
+
// actual target to popper
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const isAlwaysFixed = false;
|
|
123
|
+
const actualTarget = this.targetRef.current.children[0];
|
|
124
|
+
const popperOpts = {
|
|
125
|
+
placement: positionPropToPopperPosition(props.position),
|
|
126
|
+
onCreate: this.extractStyles,
|
|
127
|
+
onUpdate: this.extractStyles,
|
|
128
|
+
modifiers: {
|
|
129
|
+
applyStyle: {
|
|
130
|
+
enabled: false
|
|
131
|
+
},
|
|
132
|
+
hide: {
|
|
133
|
+
enabled: false
|
|
134
|
+
},
|
|
135
|
+
offset: {
|
|
136
|
+
enabled: true,
|
|
137
|
+
offset: this.props.offset
|
|
138
|
+
},
|
|
139
|
+
flip: {
|
|
140
|
+
enabled: false,
|
|
141
|
+
flipVariations: true,
|
|
142
|
+
boundariesElement: 'viewport',
|
|
143
|
+
padding: 0 // leave 0 pixels between popper and the boundariesElement
|
|
144
|
+
|
|
145
|
+
},
|
|
146
|
+
preventOverflow: {
|
|
147
|
+
enabled: false,
|
|
148
|
+
escapeWithReference: true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
positionFixed: isAlwaysFixed
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
if (actualTarget) {
|
|
155
|
+
this.popper = new Popper(actualTarget, this.contentRef.current, popperOpts);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
render() {
|
|
160
|
+
const {
|
|
161
|
+
transform,
|
|
162
|
+
hasExtractedStyles,
|
|
163
|
+
maxHeight
|
|
164
|
+
} = this.state;
|
|
165
|
+
const opacity = hasExtractedStyles ? {} : {
|
|
166
|
+
opacity: 0
|
|
167
|
+
};
|
|
168
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
ref: this.targetRef
|
|
170
|
+
}, this.props.children), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
ref: this.contentRef,
|
|
172
|
+
style: {
|
|
173
|
+
top: 0,
|
|
174
|
+
left: 0,
|
|
175
|
+
position: 'absolute',
|
|
176
|
+
transform,
|
|
177
|
+
maxHeight: maxHeight ? maxHeight : 'auto',
|
|
178
|
+
...opacity
|
|
179
|
+
}
|
|
180
|
+
}, this.props.content));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
_defineProperty(Layer, "defaultProps", {
|
|
186
|
+
boundariesElement: 'viewport',
|
|
187
|
+
children: null,
|
|
188
|
+
content: null,
|
|
189
|
+
offset: '0, 0',
|
|
190
|
+
position: 'right middle',
|
|
191
|
+
zIndex: 400,
|
|
192
|
+
lockScroll: false,
|
|
193
|
+
isAlwaysFixed: false,
|
|
194
|
+
onPositioned: () => {}
|
|
195
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const positionMap = {
|
|
2
|
+
'top left': {
|
|
3
|
+
position: 'top-start',
|
|
4
|
+
animation: 'top'
|
|
5
|
+
},
|
|
6
|
+
'top center': {
|
|
7
|
+
position: 'top',
|
|
8
|
+
animation: 'top'
|
|
9
|
+
},
|
|
10
|
+
'top right': {
|
|
11
|
+
position: 'top-end',
|
|
12
|
+
animation: 'top'
|
|
13
|
+
},
|
|
14
|
+
'right top': {
|
|
15
|
+
position: 'right-start',
|
|
16
|
+
animation: 'right'
|
|
17
|
+
},
|
|
18
|
+
'right middle': {
|
|
19
|
+
position: 'right',
|
|
20
|
+
animation: 'right'
|
|
21
|
+
},
|
|
22
|
+
'right bottom': {
|
|
23
|
+
position: 'right-end',
|
|
24
|
+
animation: 'right'
|
|
25
|
+
},
|
|
26
|
+
'bottom left': {
|
|
27
|
+
position: 'bottom-start',
|
|
28
|
+
animation: 'bottom'
|
|
29
|
+
},
|
|
30
|
+
'bottom center': {
|
|
31
|
+
position: 'bottom',
|
|
32
|
+
animation: 'bottom'
|
|
33
|
+
},
|
|
34
|
+
'bottom right': {
|
|
35
|
+
position: 'bottom-end',
|
|
36
|
+
animation: 'bottom'
|
|
37
|
+
},
|
|
38
|
+
'left top': {
|
|
39
|
+
position: 'left-start',
|
|
40
|
+
animation: 'left'
|
|
41
|
+
},
|
|
42
|
+
'left middle': {
|
|
43
|
+
position: 'left',
|
|
44
|
+
animation: 'left'
|
|
45
|
+
},
|
|
46
|
+
'left bottom': {
|
|
47
|
+
position: 'left-end',
|
|
48
|
+
animation: 'left'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const POSITION_ATTRIBUTE_ENUM = {
|
|
52
|
+
values: ['top left', 'top center', 'top right', 'right top', 'right middle', 'right bottom', 'bottom left', 'bottom center', 'bottom right', 'left top', 'left middle', 'left bottom'],
|
|
53
|
+
default: 'right middle'
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function positionToPopper(position) {
|
|
57
|
+
return position && positionMap[position] ? positionMap[position].position : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function positionPropToPopperPosition(position) {
|
|
61
|
+
return positionToPopper(position) || positionMap[POSITION_ATTRIBUTE_ENUM.default].position;
|
|
62
|
+
}
|
|
@@ -28,34 +28,16 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
render(children, container, hasAnalyticsContext = false, hasIntlContext = false) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, children());
|
|
35
|
-
|
|
36
|
-
this.portals.set(container, {
|
|
37
|
-
children: childrenWithThemeProviders,
|
|
38
|
-
hasAnalyticsContext,
|
|
39
|
-
hasIntlContext
|
|
40
|
-
});
|
|
41
|
-
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
42
|
-
|
|
43
|
-
if (hasIntlContext) {
|
|
44
|
-
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
45
|
-
value: this.intl
|
|
46
|
-
}, wrappedChildren);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
31
|
+
const childrenWithThemeProviders = () => /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
32
|
+
mode: this.themeMode
|
|
33
|
+
}, children());
|
|
52
34
|
|
|
53
35
|
this.portals.set(container, {
|
|
54
|
-
children,
|
|
36
|
+
children: childrenWithThemeProviders,
|
|
55
37
|
hasAnalyticsContext,
|
|
56
38
|
hasIntlContext
|
|
57
39
|
});
|
|
58
|
-
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null,
|
|
40
|
+
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
59
41
|
|
|
60
42
|
if (hasIntlContext) {
|
|
61
43
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
package/dist/es2019/version.json
CHANGED
|
@@ -478,15 +478,18 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
478
478
|
});
|
|
479
479
|
|
|
480
480
|
_defineProperty(_assertThisInitialized(_this), "createEditorView", function (node) {
|
|
481
|
-
measureRender(measurements.PROSEMIRROR_RENDERED, function (
|
|
481
|
+
measureRender(measurements.PROSEMIRROR_RENDERED, function (_ref3) {
|
|
482
482
|
var _this$props$editorPro5, _this$props$editorPro6, _proseMirrorRenderedT, _proseMirrorRenderedT2;
|
|
483
483
|
|
|
484
|
+
var duration = _ref3.duration,
|
|
485
|
+
startTime = _ref3.startTime,
|
|
486
|
+
distortedDuration = _ref3.distortedDuration;
|
|
484
487
|
var proseMirrorRenderedTracking = (_this$props$editorPro5 = _this.props.editorProps) === null || _this$props$editorPro5 === void 0 ? void 0 : (_this$props$editorPro6 = _this$props$editorPro5.performanceTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.proseMirrorRenderedTracking;
|
|
485
488
|
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
|
|
486
489
|
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
487
490
|
|
|
488
491
|
if (_this.view) {
|
|
489
|
-
var _getContextIdentifier, _this$
|
|
492
|
+
var _getContextIdentifier, _this$experienceStore10;
|
|
490
493
|
|
|
491
494
|
var nodes = getNodesCount(_this.view.state.doc);
|
|
492
495
|
var ttfb = getResponseEndTime();
|
|
@@ -500,12 +503,18 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
500
503
|
nodes: nodes,
|
|
501
504
|
ttfb: ttfb,
|
|
502
505
|
severity: _this.proseMirrorRenderedSeverity,
|
|
503
|
-
objectId: (_getContextIdentifier = getContextIdentifier(_this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId
|
|
506
|
+
objectId: (_getContextIdentifier = getContextIdentifier(_this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId,
|
|
507
|
+
distortedDuration: distortedDuration
|
|
504
508
|
},
|
|
505
509
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
506
510
|
});
|
|
507
511
|
|
|
508
|
-
(
|
|
512
|
+
if (!distortedDuration) {
|
|
513
|
+
var _this$experienceStore9;
|
|
514
|
+
|
|
515
|
+
(_this$experienceStore9 = _this.experienceStore) === null || _this$experienceStore9 === void 0 ? void 0 : _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
516
|
+
}
|
|
517
|
+
|
|
509
518
|
(_this$experienceStore10 = _this.experienceStore) === null || _this$experienceStore10 === void 0 ? void 0 : _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
|
|
510
519
|
nodes: nodes,
|
|
511
520
|
ttfb: ttfb
|
|
@@ -46,11 +46,12 @@ export function getScrollGutterOptions(props) {
|
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
48
|
export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
49
|
-
var _props$performanceTra, _props$featureFlags, _props$performanceTra2, _props$textFormatting;
|
|
49
|
+
var _props$performanceTra, _props$linking, _props$featureFlags, _props$performanceTra2, _props$textFormatting, _props$linking2;
|
|
50
50
|
|
|
51
51
|
var appearance = props.appearance;
|
|
52
52
|
var isMobile = appearance === 'mobile';
|
|
53
53
|
var inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
|
|
54
|
+
var cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
|
|
54
55
|
return {
|
|
55
56
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
56
57
|
typeAhead: {
|
|
@@ -59,7 +60,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
59
60
|
},
|
|
60
61
|
featureFlags: createFeatureFlagsFromProps(props),
|
|
61
62
|
paste: {
|
|
62
|
-
cardOptions:
|
|
63
|
+
cardOptions: cardOptions,
|
|
63
64
|
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
64
65
|
plainTextPasteLinkification: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.plainTextPasteLinkification) === true
|
|
65
66
|
},
|
|
@@ -95,7 +96,11 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
95
96
|
selection: {
|
|
96
97
|
useLongPressSelection: false
|
|
97
98
|
},
|
|
98
|
-
cardOptions:
|
|
99
|
+
cardOptions: cardOptions,
|
|
100
|
+
hyperlinkOptions: {
|
|
101
|
+
linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker,
|
|
102
|
+
cardOptions: cardOptions
|
|
103
|
+
},
|
|
99
104
|
codeBlock: _objectSpread(_objectSpread({}, props.codeBlock), {}, {
|
|
100
105
|
useLongPressSelection: false,
|
|
101
106
|
appearance: props.appearance,
|
|
@@ -111,6 +116,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
111
116
|
*/
|
|
112
117
|
|
|
113
118
|
export default function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
119
|
+
var _props$linking3;
|
|
120
|
+
|
|
114
121
|
var appearance = props.appearance;
|
|
115
122
|
var isMobile = appearance === 'mobile';
|
|
116
123
|
var isComment = appearance === 'comment';
|
|
@@ -318,12 +325,15 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
318
325
|
})]);
|
|
319
326
|
}
|
|
320
327
|
|
|
321
|
-
if (props.smartLinks || props.UNSAFE_cards) {
|
|
328
|
+
if ((_props$linking3 = props.linking) !== null && _props$linking3 !== void 0 && _props$linking3.smartLinks || props.smartLinks || props.UNSAFE_cards) {
|
|
329
|
+
var _props$linking4, _props$linking5;
|
|
330
|
+
|
|
322
331
|
var fullWidthMode = props.appearance === 'full-width';
|
|
323
|
-
preset.add([cardPlugin, _objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), {}, {
|
|
332
|
+
preset.add([cardPlugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking4 = props.linking) === null || _props$linking4 === void 0 ? void 0 : _props$linking4.smartLinks), {}, {
|
|
324
333
|
platform: isMobile ? 'mobile' : 'web',
|
|
325
334
|
fullWidthMode: fullWidthMode,
|
|
326
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
335
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
336
|
+
linkPicker: (_props$linking5 = props.linking) === null || _props$linking5 === void 0 ? void 0 : _props$linking5.linkPicker
|
|
327
337
|
})]);
|
|
328
338
|
}
|
|
329
339
|
|
|
@@ -364,7 +374,8 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
364
374
|
|
|
365
375
|
|
|
366
376
|
preset.add([toolbarListsIndentationPlugin, {
|
|
367
|
-
showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar
|
|
377
|
+
showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
|
|
378
|
+
allowHeadingAndParagraphIndentation: !!props.allowIndentation
|
|
368
379
|
}]);
|
|
369
380
|
preset.add([insertBlockPlugin, {
|
|
370
381
|
allowTables: !!props.allowTables,
|
|
@@ -412,11 +423,9 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
|
412
423
|
preset.add([viewUpdateSubscriptionPlugin]);
|
|
413
424
|
}
|
|
414
425
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}]);
|
|
419
|
-
}
|
|
426
|
+
preset.add([codeBidiWarningPlugin, {
|
|
427
|
+
appearance: props.appearance
|
|
428
|
+
}]);
|
|
420
429
|
|
|
421
430
|
if (featureFlags.floatingToolbarCopyButton) {
|
|
422
431
|
preset.add(copyButtonPlugin);
|
package/dist/esm/editor.js
CHANGED
|
@@ -38,7 +38,7 @@ import { getUiComponent } from './create-editor';
|
|
|
38
38
|
import EditorActions from './actions';
|
|
39
39
|
import { ReactEditorView } from './create-editor';
|
|
40
40
|
import EditorContext from './ui/EditorContext';
|
|
41
|
-
import {
|
|
41
|
+
import { PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalProvider';
|
|
42
42
|
import { nextMajorVersion } from './version-wrapper';
|
|
43
43
|
import { ContextAdapter } from './nodeviews/context-adapter';
|
|
44
44
|
import measurements from './utils/performance/measure-enum';
|
|
@@ -47,7 +47,6 @@ import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugin
|
|
|
47
47
|
import ErrorBoundary from './create-editor/ErrorBoundary';
|
|
48
48
|
import { createFeatureFlagsFromProps } from './plugins/feature-flags-context/feature-flags-from-props';
|
|
49
49
|
import { RenderTracking } from './utils/performance/components/RenderTracking';
|
|
50
|
-
import { checkIfMobileBridge } from './utils/check-if-mobile-bridge';
|
|
51
50
|
var fullHeight = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n"])));
|
|
52
51
|
|
|
53
52
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -412,8 +411,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
412
411
|
message: 'To integrate inline comments use experimental annotationProvider – <Editor annotationProviders={{ provider }} />',
|
|
413
412
|
type: 'removed'
|
|
414
413
|
},
|
|
415
|
-
|
|
416
|
-
message: '
|
|
414
|
+
smartLinks: {
|
|
415
|
+
message: 'To use smartLinks, pass the same object into the smartlinks key of linking - <Editor linking={{ smartLinks: {existing object} }}.',
|
|
417
416
|
type: 'removed'
|
|
418
417
|
}
|
|
419
418
|
};
|
|
@@ -455,6 +454,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
455
454
|
}, {
|
|
456
455
|
key: "handleProviders",
|
|
457
456
|
value: function handleProviders(props) {
|
|
457
|
+
var _linking$smartLinks;
|
|
458
|
+
|
|
458
459
|
var emojiProvider = props.emojiProvider,
|
|
459
460
|
mentionProvider = props.mentionProvider,
|
|
460
461
|
taskDecisionProvider = props.taskDecisionProvider,
|
|
@@ -469,7 +470,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
469
470
|
autoformattingProvider = props.autoformattingProvider,
|
|
470
471
|
searchProvider = props.searchProvider,
|
|
471
472
|
UNSAFE_cards = props.UNSAFE_cards,
|
|
472
|
-
smartLinks = props.smartLinks
|
|
473
|
+
smartLinks = props.smartLinks,
|
|
474
|
+
linking = props.linking;
|
|
473
475
|
var _this$state = this.state,
|
|
474
476
|
extensionProvider = _this$state.extensionProvider,
|
|
475
477
|
quickInsertProvider = _this$state.quickInsertProvider;
|
|
@@ -484,7 +486,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
484
486
|
this.providerFactory.setProvider('searchProvider', searchProvider);
|
|
485
487
|
this.providerFactory.setProvider('presenceProvider', presenceProvider);
|
|
486
488
|
this.providerFactory.setProvider('macroProvider', macroProvider);
|
|
487
|
-
var cardProvider = smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider;
|
|
489
|
+
var cardProvider = (linking === null || linking === void 0 ? void 0 : (_linking$smartLinks = linking.smartLinks) === null || _linking$smartLinks === void 0 ? void 0 : _linking$smartLinks.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider;
|
|
488
490
|
|
|
489
491
|
if (cardProvider) {
|
|
490
492
|
this.providerFactory.setProvider('cardProvider', cardProvider);
|
|
@@ -524,22 +526,6 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
524
526
|
var renderTracking = (_this$props$performan = this.props.performanceTracking) === null || _this$props$performan === void 0 ? void 0 : (_this$props$performan2 = _this$props$performan.renderTracking) === null || _this$props$performan2 === void 0 ? void 0 : _this$props$performan2.editor;
|
|
525
527
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
526
528
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
527
|
-
/**
|
|
528
|
-
* The PortalProviderWithThemeProviders renders portals with atlaskit
|
|
529
|
-
* and the deprecated styled components theme providers.
|
|
530
|
-
*
|
|
531
|
-
* Without this the node views react trees;
|
|
532
|
-
* - do not have access to the atlaskit theme via the `useGlobalTheme` hook
|
|
533
|
-
* - do not have access to the theme when using the `styled`${({theme}) => theme.}` api.
|
|
534
|
-
*
|
|
535
|
-
* Added for a mobile regression, which needed to be fixed on master.
|
|
536
|
-
* Once this makes it's way to develop, we should consider making it the default
|
|
537
|
-
* behaviour.
|
|
538
|
-
*
|
|
539
|
-
* https://product-fabric.atlassian.net/browse/ED-14204
|
|
540
|
-
*/
|
|
541
|
-
|
|
542
|
-
var EnvironmentDrivenPortalProvider = checkIfMobileBridge() ? PortalProviderWithThemeProviders : PortalProvider;
|
|
543
529
|
return jsx(FabricEditorAnalyticsContext, {
|
|
544
530
|
data: {
|
|
545
531
|
packageName: name,
|
|
@@ -564,7 +550,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
564
550
|
css: fullHeight
|
|
565
551
|
}, jsx(EditorContext, {
|
|
566
552
|
editorActions: _this5.editorActions
|
|
567
|
-
}, jsx(ContextAdapter, null, jsx(
|
|
553
|
+
}, jsx(ContextAdapter, null, jsx(PortalProviderWithThemeProviders, {
|
|
568
554
|
onAnalyticsEvent: _this5.handleAnalyticsEvent,
|
|
569
555
|
useAnalyticsContext: _this5.props.UNSAFE_useAnalyticsContext,
|
|
570
556
|
render: function render(portalProviderAPI) {
|
|
@@ -56,7 +56,11 @@ function useCreateEditor(config) {
|
|
|
56
56
|
|
|
57
57
|
setEditorSharedConfig(function (editorSharedConfig) {
|
|
58
58
|
if (!editorSharedConfig) {
|
|
59
|
-
measureRender(measurements.PROSEMIRROR_RENDERED, function (
|
|
59
|
+
measureRender(measurements.PROSEMIRROR_RENDERED, function (_ref) {
|
|
60
|
+
var duration = _ref.duration,
|
|
61
|
+
startTime = _ref.startTime,
|
|
62
|
+
distortedDuration = _ref.distortedDuration;
|
|
63
|
+
|
|
60
64
|
if (sharedConfig && sharedConfig.dispatch) {
|
|
61
65
|
sharedConfig.dispatch(analyticsEventKey, {
|
|
62
66
|
payload: {
|
|
@@ -64,6 +68,7 @@ function useCreateEditor(config) {
|
|
|
64
68
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
65
69
|
attributes: {
|
|
66
70
|
duration: duration,
|
|
71
|
+
distortedDuration: distortedDuration,
|
|
67
72
|
startTime: startTime,
|
|
68
73
|
nodes: getNodesCount(sharedConfig.editorView.state.doc),
|
|
69
74
|
ttfb: getResponseEndTime()
|
|
@@ -49,7 +49,7 @@ export function createDefaultPreset(options) {
|
|
|
49
49
|
preset.add([annotationPlugin, options.annotationProviders]);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
preset.add([hyperlinkPlugin, options.
|
|
52
|
+
preset.add([hyperlinkPlugin, options.hyperlinkOptions]);
|
|
53
53
|
preset.add([textFormattingPlugin, options.textFormatting]);
|
|
54
54
|
preset.add(widthPlugin);
|
|
55
55
|
preset.add([quickInsertPlugin, options.quickInsert]);
|
|
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
|
-
import {
|
|
15
|
+
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
16
16
|
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
17
17
|
|
|
18
18
|
function useContextMemoized(reactContext) {
|
|
@@ -32,7 +32,7 @@ function useContextMemoized(reactContext) {
|
|
|
32
32
|
|
|
33
33
|
export var ContextAdapter = function ContextAdapter(_ref) {
|
|
34
34
|
var children = _ref.children;
|
|
35
|
-
var card = useContextMemoized(
|
|
35
|
+
var card = useContextMemoized(SmartCardContext);
|
|
36
36
|
var analytics = useContextMemoized(AnalyticsReactContext);
|
|
37
37
|
return /*#__PURE__*/React.createElement(LegacyContextAdapter, {
|
|
38
38
|
card: card,
|
|
@@ -55,9 +55,18 @@ function createPlugin(options) {
|
|
|
55
55
|
// that has an analytics event.
|
|
56
56
|
if (hasRequiredPerformanceAPIs && tr.docChanged && payload.action !== ACTION.INSERTED && payload.action !== ACTION.DELETED) {
|
|
57
57
|
var measureName = "".concat(payload.actionSubject, ":").concat(payload.action, ":").concat(payload.actionSubjectId);
|
|
58
|
-
measureRender(
|
|
58
|
+
measureRender( // NOTE this name could be resulting in misleading data -- where if multiple payloads are
|
|
59
|
+
// received before a render completes -- the measurement value will be inaccurate (this is
|
|
60
|
+
// due to measureRender requiring unique measureNames)
|
|
61
|
+
measureName, function (_ref) {
|
|
62
|
+
var duration = _ref.duration,
|
|
63
|
+
distortedDuration = _ref.distortedDuration;
|
|
59
64
|
fireAnalyticsEvent(pluginState.createAnalyticsEvent)({
|
|
60
|
-
payload: extendPayload(
|
|
65
|
+
payload: extendPayload({
|
|
66
|
+
payload: payload,
|
|
67
|
+
duration: duration,
|
|
68
|
+
distortedDuration: distortedDuration
|
|
69
|
+
}),
|
|
61
70
|
channel: channel
|
|
62
71
|
});
|
|
63
72
|
});
|
|
@@ -92,10 +101,10 @@ var analyticsPlugin = function analyticsPlugin(options) {
|
|
|
92
101
|
}
|
|
93
102
|
}];
|
|
94
103
|
},
|
|
95
|
-
onEditorViewStateUpdated: function onEditorViewStateUpdated(
|
|
96
|
-
var originalTransaction =
|
|
97
|
-
transactions =
|
|
98
|
-
newEditorState =
|
|
104
|
+
onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref2) {
|
|
105
|
+
var originalTransaction = _ref2.originalTransaction,
|
|
106
|
+
transactions = _ref2.transactions,
|
|
107
|
+
newEditorState = _ref2.newEditorState;
|
|
99
108
|
var pluginState = analyticsPluginKey.getState(newEditorState);
|
|
100
109
|
|
|
101
110
|
if (!pluginState || !pluginState.createAnalyticsEvent) {
|
|
@@ -120,9 +129,9 @@ var analyticsPlugin = function analyticsPlugin(options) {
|
|
|
120
129
|
|
|
121
130
|
var createAnalyticsEvent = pluginState.createAnalyticsEvent;
|
|
122
131
|
var undoAnaltyicsEventTransformer = generateUndoRedoInputSoucePayload(originalTransaction);
|
|
123
|
-
steps.forEach(function (
|
|
124
|
-
var payload =
|
|
125
|
-
channel =
|
|
132
|
+
steps.forEach(function (_ref3) {
|
|
133
|
+
var payload = _ref3.payload,
|
|
134
|
+
channel = _ref3.channel;
|
|
126
135
|
var nextPayload = undoAnaltyicsEventTransformer(payload);
|
|
127
136
|
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
128
137
|
payload: nextPayload,
|
|
@@ -133,10 +142,14 @@ var analyticsPlugin = function analyticsPlugin(options) {
|
|
|
133
142
|
};
|
|
134
143
|
};
|
|
135
144
|
|
|
136
|
-
export function extendPayload(
|
|
145
|
+
export function extendPayload(_ref4) {
|
|
146
|
+
var payload = _ref4.payload,
|
|
147
|
+
duration = _ref4.duration,
|
|
148
|
+
distortedDuration = _ref4.distortedDuration;
|
|
137
149
|
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
138
150
|
attributes: _objectSpread(_objectSpread({}, payload.attributes), {}, {
|
|
139
|
-
duration: duration
|
|
151
|
+
duration: duration,
|
|
152
|
+
distortedDuration: distortedDuration
|
|
140
153
|
}),
|
|
141
154
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
142
155
|
});
|
|
@@ -11,7 +11,7 @@ import { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
|
11
11
|
import filterStepsPlugin from './pm-plugins/filter-steps';
|
|
12
12
|
import focusHandlerPlugin from './pm-plugins/focus-handler';
|
|
13
13
|
import fixChrome88SelectionPlugin from './pm-plugins/fix-chrome-88-selection';
|
|
14
|
-
import
|
|
14
|
+
import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
|
|
15
15
|
import contextIdentifierPlugin from './pm-plugins/context-identifier';
|
|
16
16
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
17
17
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
@@ -129,9 +129,9 @@ var basePlugin = function basePlugin(options) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
plugins.push({
|
|
132
|
-
name: '
|
|
132
|
+
name: 'disableSpellcheckingPlugin',
|
|
133
133
|
plugin: function plugin() {
|
|
134
|
-
return
|
|
134
|
+
return disableSpellcheckingPlugin();
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
return plugins;
|