@atlaskit/editor-core 171.0.1 → 172.0.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 +84 -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/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 +8 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- 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/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 +8 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- 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/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 +8 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- 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
|
@@ -11,8 +11,9 @@ import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '../../ui/
|
|
|
11
11
|
import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
|
|
12
12
|
import { addAnalytics, ACTION_SUBJECT_ID } from '../analytics';
|
|
13
13
|
import { buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
14
|
-
|
|
14
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
15
15
|
|
|
16
|
+
/* type guard for edit links */
|
|
16
17
|
function isEditLink(linkMark) {
|
|
17
18
|
return linkMark.pos !== undefined;
|
|
18
19
|
}
|
|
@@ -41,7 +42,7 @@ function getLinkText(activeLinkMark, state) {
|
|
|
41
42
|
return activeLinkMark.node.text;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
export const getToolbarConfig = (state, intl, providerFactory
|
|
45
|
+
export const getToolbarConfig = options => (state, intl, providerFactory) => {
|
|
45
46
|
const {
|
|
46
47
|
formatMessage
|
|
47
48
|
} = intl;
|
|
@@ -95,7 +96,7 @@ export const getToolbarConfig = (state, intl, providerFactory, cardOptions) => {
|
|
|
95
96
|
intl: intl,
|
|
96
97
|
editorView: editorView,
|
|
97
98
|
editorState: state,
|
|
98
|
-
cardOptions: cardOptions,
|
|
99
|
+
cardOptions: options === null || options === void 0 ? void 0 : options.cardOptions,
|
|
99
100
|
providerFactory: providerFactory // platform={} // TODO: pass platform
|
|
100
101
|
|
|
101
102
|
});
|
|
@@ -133,7 +134,9 @@ export const getToolbarConfig = (state, intl, providerFactory, cardOptions) => {
|
|
|
133
134
|
title: labelUnlink,
|
|
134
135
|
icon: UnlinkIcon,
|
|
135
136
|
tabIndex: null
|
|
136
|
-
}
|
|
137
|
+
}, ...(state && showCopyButton(state) ? [{
|
|
138
|
+
type: 'separator'
|
|
139
|
+
}, getCopyButtonConfig(state, intl.formatMessage, hyperLinkToolbar.nodeType)] : [])]
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
142
|
|
|
@@ -162,11 +165,14 @@ export const getToolbarConfig = (state, intl, providerFactory, cardOptions) => {
|
|
|
162
165
|
return /*#__PURE__*/React.createElement(HyperlinkAddToolbar, {
|
|
163
166
|
view: view,
|
|
164
167
|
key: idx,
|
|
168
|
+
linkPickerOptions: options === null || options === void 0 ? void 0 : options.linkPicker,
|
|
165
169
|
displayUrl: link,
|
|
166
170
|
displayText: displayText || '',
|
|
167
171
|
providerFactory: providerFactory,
|
|
168
172
|
onSubmit: (href, title = '', displayText, inputMethod) => {
|
|
169
|
-
|
|
173
|
+
var _options$cardOptions;
|
|
174
|
+
|
|
175
|
+
isEditLink(activeLinkMark) ? updateLink(href, displayText || title, activeLinkMark.pos)(view.state, view.dispatch) : insertLinkWithAnalytics(inputMethod, activeLinkMark.from, activeLinkMark.to, href, title, displayText, !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider))(view.state, view.dispatch);
|
|
170
176
|
view.focus();
|
|
171
177
|
}
|
|
172
178
|
});
|
|
@@ -21,9 +21,11 @@ const hyperlinkPlugin = options => ({
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
pmPlugins() {
|
|
24
|
+
var _options$cardOptions;
|
|
25
|
+
|
|
24
26
|
// Skip analytics if card provider is available, as they will be
|
|
25
27
|
// sent on handleRejected upon attempting to resolve smart link.
|
|
26
|
-
const skipAnalytics = !!options &&
|
|
28
|
+
const skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
|
|
27
29
|
return [{
|
|
28
30
|
name: 'hyperlink',
|
|
29
31
|
plugin: ({
|
|
@@ -73,9 +75,7 @@ const hyperlinkPlugin = options => ({
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
}],
|
|
76
|
-
floatingToolbar: (
|
|
77
|
-
return getToolbarConfig(state, intl, providerFactory, options);
|
|
78
|
-
}
|
|
78
|
+
floatingToolbar: getToolbarConfig(options)
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { LinkPicker } from '@atlaskit/link-picker';
|
|
4
|
+
import { hideLinkToolbar as cardHideLinkToolbar } from '../../../card/pm-plugins/actions';
|
|
5
|
+
import { hideLinkToolbar } from '../../commands';
|
|
6
|
+
import { useEscapeClickaway } from './useEscapeClickaway';
|
|
7
|
+
export const EditorLinkPicker = ({
|
|
8
|
+
view,
|
|
9
|
+
...restProps
|
|
10
|
+
}) => {
|
|
11
|
+
const onEscape = useCallback(() => {
|
|
12
|
+
hideLinkToolbar()(view.state, view.dispatch);
|
|
13
|
+
view.dispatch(cardHideLinkToolbar(view.state.tr));
|
|
14
|
+
}, [view]);
|
|
15
|
+
const onClickAway = useCallback(() => {
|
|
16
|
+
hideLinkToolbar()(view.state, view.dispatch);
|
|
17
|
+
}, [view]);
|
|
18
|
+
const ref = useEscapeClickaway(onEscape, onClickAway);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
ref: ref
|
|
21
|
+
}, /*#__PURE__*/React.createElement(LinkPicker, _extends({}, restProps, {
|
|
22
|
+
onCancel: onEscape
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export const useEscapeClickaway = (onEscape, onClickAway) => {
|
|
3
|
+
const ref = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const handleClickAway = event => {
|
|
6
|
+
const el = ref.current;
|
|
7
|
+
|
|
8
|
+
if (event.target instanceof Element && el && !el.contains(event.target)) {
|
|
9
|
+
onClickAway();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const handleKeydown = event => {
|
|
14
|
+
if (event.key === 'Escape') {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
onEscape();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
document.addEventListener('mousedown', handleClickAway);
|
|
21
|
+
document.addEventListener('keydown', handleKeydown);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener('mousedown', handleClickAway);
|
|
24
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
25
|
+
};
|
|
26
|
+
}, [onClickAway, onEscape]);
|
|
27
|
+
return ref;
|
|
28
|
+
};
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import HyperlinkAddToolbarComp from './HyperlinkAddToolbar';
|
|
5
|
+
import { INPUT_METHOD } from '../../../analytics';
|
|
4
6
|
import { stateKey as pluginKey } from '../../pm-plugins/main';
|
|
5
7
|
import WithPluginState from '../../../../ui/WithPluginState';
|
|
8
|
+
import { getFeatureFlags } from '../../../feature-flags-context';
|
|
9
|
+
import { EditorLinkPicker } from '../EditorLinkPicker';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps around the editor's onSubmit handler so that the plugin can interface with the link picker
|
|
13
|
+
*/
|
|
14
|
+
const onSubmitInterface = onSubmit => ({
|
|
15
|
+
url,
|
|
16
|
+
title,
|
|
17
|
+
displayText,
|
|
18
|
+
rawUrl,
|
|
19
|
+
meta
|
|
20
|
+
}) => {
|
|
21
|
+
onSubmit(url, title !== null && title !== void 0 ? title : rawUrl, displayText || undefined, meta.inputMethod === 'manual' ? INPUT_METHOD.MANUAL : INPUT_METHOD.TYPEAHEAD);
|
|
22
|
+
};
|
|
23
|
+
|
|
6
24
|
export default class HyperlinkAddToolbar extends React.PureComponent {
|
|
7
25
|
render() {
|
|
8
26
|
const {
|
|
27
|
+
linkPickerOptions = {},
|
|
9
28
|
onSubmit,
|
|
10
29
|
displayText,
|
|
11
30
|
displayUrl,
|
|
@@ -25,15 +44,37 @@ export default class HyperlinkAddToolbar extends React.PureComponent {
|
|
|
25
44
|
},
|
|
26
45
|
render: ({
|
|
27
46
|
hyperlinkPluginState
|
|
28
|
-
}) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
}) => {
|
|
48
|
+
var _linkPickerOptions$pl;
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
lpLinkPicker
|
|
52
|
+
} = getFeatureFlags(view.state);
|
|
53
|
+
/**
|
|
54
|
+
* If activityProvider or searchProvider are present then only enable if there are plugins supplied to
|
|
55
|
+
* faciliate providing link search capabilities
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
if (lpLinkPicker && (!activityProvider && !searchProvider || Boolean(linkPickerOptions === null || linkPickerOptions === void 0 ? void 0 : (_linkPickerOptions$pl = linkPickerOptions.plugins) === null || _linkPickerOptions$pl === void 0 ? void 0 : _linkPickerOptions$pl.length))) {
|
|
59
|
+
return /*#__PURE__*/React.createElement(EditorLinkPicker, _extends({
|
|
60
|
+
view: view
|
|
61
|
+
}, linkPickerOptions, {
|
|
62
|
+
url: displayUrl,
|
|
63
|
+
displayText: displayText,
|
|
64
|
+
onSubmit: onSubmitInterface(onSubmit)
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React.createElement(HyperlinkAddToolbarComp, {
|
|
69
|
+
activityProvider: activityProvider,
|
|
70
|
+
searchProvider: searchProvider,
|
|
71
|
+
onSubmit: onSubmit,
|
|
72
|
+
displayText: displayText,
|
|
73
|
+
displayUrl: displayUrl,
|
|
74
|
+
pluginState: hyperlinkPluginState,
|
|
75
|
+
view: view
|
|
76
|
+
});
|
|
77
|
+
}
|
|
37
78
|
})
|
|
38
79
|
});
|
|
39
80
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { toggleBlockMark } from '../../../commands';
|
|
2
2
|
import { createAnalyticsDispatch } from './utils';
|
|
3
|
-
import { INDENT_DIRECTION } from '../../analytics';
|
|
3
|
+
import { INDENT_DIRECTION, INPUT_METHOD } from '../../analytics';
|
|
4
4
|
import getAttrsWithChangesRecorder from '../../../utils/getAttrsWithChangesRecorder';
|
|
5
|
-
const MAX_INDENTATION_LEVEL = 6;
|
|
6
|
-
|
|
7
|
-
const isIndentationAllowed = (schema, node) => {
|
|
5
|
+
export const MAX_INDENTATION_LEVEL = 6;
|
|
6
|
+
export const isIndentationAllowed = (schema, node) => {
|
|
8
7
|
const {
|
|
9
8
|
nodes: {
|
|
10
9
|
paragraph,
|
|
@@ -31,7 +30,6 @@ const isIndentationAllowed = (schema, node) => {
|
|
|
31
30
|
* @param getNewIndentationAttrs Function to handle new indentation level
|
|
32
31
|
*/
|
|
33
32
|
|
|
34
|
-
|
|
35
33
|
function createIndentationCommand(getNewIndentationAttrs) {
|
|
36
34
|
return (state, dispatch) => {
|
|
37
35
|
const {
|
|
@@ -41,7 +39,11 @@ function createIndentationCommand(getNewIndentationAttrs) {
|
|
|
41
39
|
};
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
function createIndentationCommandWithAnalytics(
|
|
42
|
+
function createIndentationCommandWithAnalytics({
|
|
43
|
+
getNewIndentationAttrs,
|
|
44
|
+
direction,
|
|
45
|
+
inputMethod
|
|
46
|
+
}) {
|
|
45
47
|
// Create a new getAttrs function to record the changes
|
|
46
48
|
const {
|
|
47
49
|
getAttrs,
|
|
@@ -53,7 +55,12 @@ function createIndentationCommandWithAnalytics(getNewIndentationAttrs, direction
|
|
|
53
55
|
const indentationCommand = createIndentationCommand(getAttrs); // Return a new command where we change dispatch for our analytics dispatch
|
|
54
56
|
|
|
55
57
|
return (state, dispatch) => {
|
|
56
|
-
return indentationCommand(state, createAnalyticsDispatch(
|
|
58
|
+
return indentationCommand(state, createAnalyticsDispatch({
|
|
59
|
+
getAttrsChanges: getAndResetAttrsChanges,
|
|
60
|
+
inputMethod,
|
|
61
|
+
state,
|
|
62
|
+
dispatch
|
|
63
|
+
}));
|
|
57
64
|
};
|
|
58
65
|
}
|
|
59
66
|
/**
|
|
@@ -85,7 +92,11 @@ const getIndentAttrs = oldAttr => {
|
|
|
85
92
|
}; // Otherwise, increase the level by one
|
|
86
93
|
};
|
|
87
94
|
|
|
88
|
-
export const
|
|
95
|
+
export const getIndentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
96
|
+
getNewIndentationAttrs: getIndentAttrs,
|
|
97
|
+
direction: INDENT_DIRECTION.INDENT,
|
|
98
|
+
inputMethod
|
|
99
|
+
});
|
|
89
100
|
/**
|
|
90
101
|
* Get new level for outdent
|
|
91
102
|
* @param oldAttr Old attributes for the mark, undefined if the mark doesn't exit
|
|
@@ -112,5 +123,9 @@ const getOutdentAttrs = oldAttr => {
|
|
|
112
123
|
}; // Decrease the level on other cases
|
|
113
124
|
};
|
|
114
125
|
|
|
115
|
-
export const
|
|
126
|
+
export const getOutdentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
127
|
+
getNewIndentationAttrs: getOutdentAttrs,
|
|
128
|
+
direction: INDENT_DIRECTION.OUTDENT,
|
|
129
|
+
inputMethod
|
|
130
|
+
});
|
|
116
131
|
export const removeIndentation = (state, dispatch) => toggleBlockMark(state.schema.marks.indentation, () => false)(state, dispatch);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addAnalytics, INDENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
1
|
+
import { addAnalytics, INDENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
2
2
|
const indentTypes = {
|
|
3
3
|
paragraph: INDENT_TYPE.PARAGRAPH,
|
|
4
4
|
heading: INDENT_TYPE.HEADING
|
|
@@ -40,7 +40,12 @@ export function getPrevIndentLevel(prevAttrs) {
|
|
|
40
40
|
* @returns
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
|
-
export function createAnalyticsDispatch(
|
|
43
|
+
export function createAnalyticsDispatch({
|
|
44
|
+
getAttrsChanges,
|
|
45
|
+
inputMethod,
|
|
46
|
+
state,
|
|
47
|
+
dispatch
|
|
48
|
+
}) {
|
|
44
49
|
return tr => {
|
|
45
50
|
let currentTr = tr;
|
|
46
51
|
const changes = getAttrsChanges(); // Get all attributes changes
|
|
@@ -66,7 +71,7 @@ export function createAnalyticsDispatch(getAttrsChanges, state, dispatch) {
|
|
|
66
71
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
67
72
|
eventType: EVENT_TYPE.TRACK,
|
|
68
73
|
attributes: {
|
|
69
|
-
inputMethod
|
|
74
|
+
inputMethod,
|
|
70
75
|
previousIndentationLevel: getPrevIndentLevel(prevAttrs),
|
|
71
76
|
newIndentLevel: getNewIndentLevel(prevAttrs, newAttrs),
|
|
72
77
|
direction,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { keymap } from 'prosemirror-keymap';
|
|
2
2
|
import * as keymaps from '../../../keymaps';
|
|
3
3
|
import { isTextSelection } from '../../../utils';
|
|
4
|
-
import {
|
|
4
|
+
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
|
+
import { INPUT_METHOD } from '../../analytics';
|
|
5
6
|
export function keymapPlugin() {
|
|
6
7
|
const list = {};
|
|
7
|
-
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.indent),
|
|
8
|
-
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.outdent),
|
|
8
|
+
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.indent), getIndentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
+
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.outdent), getOutdentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
9
10
|
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.backspace), (state, dispatch) => {
|
|
10
11
|
const {
|
|
11
12
|
selection
|
|
12
13
|
} = state;
|
|
13
14
|
|
|
14
15
|
if (isTextSelection(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
15
|
-
return dispatch ?
|
|
16
|
+
return dispatch ? getOutdentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
return false;
|
|
@@ -10,6 +10,7 @@ import { toolbarMessages } from './toolbar-messages';
|
|
|
10
10
|
import commonMessages from '../../messages';
|
|
11
11
|
import { setPresetLayout, deleteActiveLayoutNode, getPresetLayout } from './actions';
|
|
12
12
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
13
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
13
14
|
const LAYOUT_TYPES = [{
|
|
14
15
|
id: 'editor.layout.twoEquals',
|
|
15
16
|
type: 'two_equal',
|
|
@@ -84,7 +85,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
84
85
|
title: layoutToolbarTitle,
|
|
85
86
|
getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
|
|
86
87
|
nodeType,
|
|
87
|
-
items: [...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)) : []), separator, deleteButton]
|
|
88
|
+
items: [...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)) : []), ...(state && showCopyButton(state) ? [separator, getCopyButtonConfig(state, intl.formatMessage, nodeType)] : []), separator, deleteButton]
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -21,6 +21,7 @@ import { FilePreviewItem } from './filePreviewItem';
|
|
|
21
21
|
import { downloadMedia, removeMediaGroupNode } from './utils';
|
|
22
22
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard } from './commands';
|
|
23
23
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
24
|
+
import { getCopyButtonConfig, showCopyButton } from '../../copy-button/toolbar';
|
|
24
25
|
|
|
25
26
|
const remove = (state, dispatch) => {
|
|
26
27
|
if (dispatch) {
|
|
@@ -90,7 +91,9 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
90
91
|
title: intl.formatMessage(messages.download)
|
|
91
92
|
}, {
|
|
92
93
|
type: 'separator'
|
|
93
|
-
}, {
|
|
94
|
+
}, ...(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaGroup), {
|
|
95
|
+
type: 'separator'
|
|
96
|
+
}] : []), {
|
|
94
97
|
id: 'editor.media.delete',
|
|
95
98
|
type: 'button',
|
|
96
99
|
appearance: 'danger',
|
|
@@ -156,7 +159,9 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
156
159
|
title: intl.formatMessage(messages.download)
|
|
157
160
|
}, {
|
|
158
161
|
type: 'separator'
|
|
159
|
-
}, {
|
|
162
|
+
}, ...(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaInline), {
|
|
163
|
+
type: 'separator'
|
|
164
|
+
}] : []), {
|
|
160
165
|
id: 'editor.media.delete',
|
|
161
166
|
type: 'button',
|
|
162
167
|
appearance: 'danger',
|
|
@@ -262,7 +267,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
262
267
|
onClick: remove,
|
|
263
268
|
testId: 'media-toolbar-remove-button'
|
|
264
269
|
};
|
|
265
|
-
const items = [...toolbarButtons,
|
|
270
|
+
const items = [...toolbarButtons, ...(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, mediaSingle), {
|
|
271
|
+
type: 'separator'
|
|
272
|
+
}] : []), removeButton];
|
|
266
273
|
return items;
|
|
267
274
|
};
|
|
268
275
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
2
2
|
import { isSpecialMention } from '@atlaskit/mention/resource';
|
|
3
|
-
import { name as packageName, version as packageVersion } from '../../version
|
|
3
|
+
import { name as packageName, version as packageVersion } from '../../version-wrapper';
|
|
4
4
|
import { isTeamType } from './utils';
|
|
5
5
|
const componentName = 'mention';
|
|
6
6
|
export const buildAnalyticsPayload = (actionSubject, action, eventType, sessionId, otherAttributes = {}) => ({
|
|
@@ -16,7 +16,7 @@ import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
|
|
|
16
16
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
17
17
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
|
|
18
18
|
import { messages } from './message';
|
|
19
|
-
import { getCopyButtonConfig, showCopyButton } from '../copy-button/
|
|
19
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
20
20
|
export const panelIconMap = {
|
|
21
21
|
[PanelType.INFO]: {
|
|
22
22
|
shortName: ':info:',
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
1
2
|
import { insertSliceIntoRangeSelectionInsideList, insertSliceInsideOfPanelNodeSelected, insertSliceAtNodeEdge, insertSliceIntoEmptyNode } from './lists';
|
|
2
3
|
import { isListNode } from '../../list/utils/node';
|
|
3
4
|
import { isSelectionInsidePanel, isEmptyNode, isCursorSelectionAtTextStartOrEnd } from '../util';
|
|
4
5
|
export function insertSliceForLists({
|
|
5
6
|
tr,
|
|
6
|
-
slice
|
|
7
|
+
slice,
|
|
8
|
+
schema
|
|
7
9
|
}) {
|
|
10
|
+
var _slice$content$firstC;
|
|
11
|
+
|
|
8
12
|
const {
|
|
9
13
|
selection,
|
|
10
14
|
selection: {
|
|
@@ -42,9 +46,17 @@ export function insertSliceForLists({
|
|
|
42
46
|
tr,
|
|
43
47
|
slice
|
|
44
48
|
});
|
|
45
|
-
}
|
|
49
|
+
} // When pasting a single list item into an action or decision, we skip the special "insert at node edge"
|
|
50
|
+
// logic so that prosemirror pastes the list's content into the action/decision, rather than
|
|
51
|
+
// pasting a whole list node directly after the action/decision item. (But we still preserve the
|
|
52
|
+
// existing "insert at" node edge" behaviour if dealing with a list with more than one item, so that
|
|
53
|
+
// it still inserts whole list node after the action/decision item).
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const pastingIntoActionOrDecision = Boolean(findParentNodeOfType([schema.nodes.taskList, schema.nodes.decisionList])(selection));
|
|
57
|
+
const oneListItem = slice.content.childCount === 1 && isListNode(slice.content.firstChild) && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.childCount) === 1;
|
|
46
58
|
|
|
47
|
-
if (isCursorSelectionAtTextStartOrEnd(selection)) {
|
|
59
|
+
if (!(pastingIntoActionOrDecision && oneListItem) && isCursorSelectionAtTextStartOrEnd(selection)) {
|
|
48
60
|
return insertSliceAtNodeEdge({
|
|
49
61
|
tr,
|
|
50
62
|
slice
|
|
@@ -104,6 +104,29 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
104
104
|
dispatch(tr);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
return true;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export function handlePastePanelIntoList(slice) {
|
|
111
|
+
return (state, dispatch) => {
|
|
112
|
+
const {
|
|
113
|
+
schema,
|
|
114
|
+
tr
|
|
115
|
+
} = state;
|
|
116
|
+
const {
|
|
117
|
+
selection
|
|
118
|
+
} = tr; // Check this pasting action is related to copy content from panel node into a selected the list node
|
|
119
|
+
|
|
120
|
+
const selectionParentListNode = selection.$to.node(selection.$to.depth - 1);
|
|
121
|
+
const panelNode = slice.content.firstChild;
|
|
122
|
+
|
|
123
|
+
if (!dispatch || !selectionParentListNode || (selectionParentListNode === null || selectionParentListNode === void 0 ? void 0 : selectionParentListNode.type) !== schema.nodes.listItem || !panelNode || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.type) !== schema.nodes.panel || (panelNode === null || panelNode === void 0 ? void 0 : panelNode.content.firstChild) === undefined) {
|
|
124
|
+
return false;
|
|
125
|
+
} // Paste the panel node contents extracted instead of pasting the entire panel node
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
tr.replaceSelection(slice).scrollIntoView();
|
|
129
|
+
dispatch(tr);
|
|
107
130
|
return true;
|
|
108
131
|
};
|
|
109
132
|
} // If we paste a link onto some selected text, apply the link as a mark
|
|
@@ -646,7 +669,8 @@ export function handleRichText(slice) {
|
|
|
646
669
|
panel
|
|
647
670
|
} = state.schema.nodes;
|
|
648
671
|
const {
|
|
649
|
-
selection
|
|
672
|
+
selection,
|
|
673
|
+
schema
|
|
650
674
|
} = state;
|
|
651
675
|
const firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
652
676
|
const lastChildOfSlice = (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.lastChild; // In case user is pasting inline code,
|
|
@@ -678,7 +702,8 @@ export function handleRichText(slice) {
|
|
|
678
702
|
if (isSliceContentListNodes || isTargetPanelEmpty) {
|
|
679
703
|
insertSliceForLists({
|
|
680
704
|
tr,
|
|
681
|
-
slice
|
|
705
|
+
slice,
|
|
706
|
+
schema
|
|
682
707
|
});
|
|
683
708
|
} else if (noNeedForSafeInsert) {
|
|
684
709
|
tr.replaceSelection(slice);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
|
|
2
2
|
import { getPasteSource } from '../util';
|
|
3
|
-
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption } from '../handlers';
|
|
3
|
+
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelIntoList } from '../handlers';
|
|
4
4
|
import { pipe } from '../../../utils';
|
|
5
5
|
import { findParentNode } from 'prosemirror-utils';
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
@@ -242,6 +242,9 @@ export const handleMarkdownWithAnalytics = (view, event, slice) => pipe(handleMa
|
|
|
242
242
|
export const handleRichTextWithAnalytics = (view, event, slice) => pipe(handleRichText, pasteCommandWithAnalytics(view, event, slice, {
|
|
243
243
|
type: PasteTypes.richText
|
|
244
244
|
}))(slice);
|
|
245
|
+
export const handlePastePanelIntoListWithAnalytics = (view, event, slice) => pipe(handlePastePanelIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
246
|
+
type: PasteTypes.richText
|
|
247
|
+
}))(slice);
|
|
245
248
|
export const handleExpandWithAnalytics = (view, event, slice) => pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
|
|
246
249
|
type: PasteTypes.richText
|
|
247
250
|
}))(slice);
|
|
@@ -252,7 +255,12 @@ export const handlePasteLinkOnSelectedTextWithAnalytics = (view, event, slice, t
|
|
|
252
255
|
type,
|
|
253
256
|
hyperlinkPasteOnText: true
|
|
254
257
|
}))(slice);
|
|
255
|
-
export const createPasteMeasurePayload = (
|
|
258
|
+
export const createPasteMeasurePayload = ({
|
|
259
|
+
view,
|
|
260
|
+
duration,
|
|
261
|
+
content,
|
|
262
|
+
distortedDuration
|
|
263
|
+
}) => {
|
|
256
264
|
const pasteIntoNode = getActionSubjectId(view);
|
|
257
265
|
return {
|
|
258
266
|
action: ACTION.PASTED_TIMED,
|
|
@@ -261,7 +269,8 @@ export const createPasteMeasurePayload = (view, duration, content) => {
|
|
|
261
269
|
attributes: {
|
|
262
270
|
pasteIntoNode,
|
|
263
271
|
content,
|
|
264
|
-
time: duration
|
|
272
|
+
time: duration,
|
|
273
|
+
distortedDuration
|
|
265
274
|
}
|
|
266
275
|
};
|
|
267
276
|
};
|
|
@@ -12,7 +12,7 @@ import { linkifyContent } from '../../hyperlink/utils';
|
|
|
12
12
|
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
13
13
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
14
14
|
import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
|
|
15
|
-
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics } from './analytics';
|
|
15
|
+
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelIntoListWithAnalytics } from './analytics';
|
|
16
16
|
import { analyticsPluginKey, PasteTypes } from '../../analytics';
|
|
17
17
|
import { insideTable, measurements } from '../../../utils';
|
|
18
18
|
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
@@ -139,8 +139,16 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
|
|
|
139
139
|
const content = getContentNodeTypes(slice.content);
|
|
140
140
|
const pasteId = uuid();
|
|
141
141
|
const measureName = `${measurements.PASTE}_${pasteId}`;
|
|
142
|
-
measureRender(measureName,
|
|
143
|
-
|
|
142
|
+
measureRender(measureName, ({
|
|
143
|
+
duration,
|
|
144
|
+
distortedDuration
|
|
145
|
+
}) => {
|
|
146
|
+
const payload = createPasteMeasurePayload({
|
|
147
|
+
view,
|
|
148
|
+
duration,
|
|
149
|
+
content,
|
|
150
|
+
distortedDuration
|
|
151
|
+
});
|
|
144
152
|
|
|
145
153
|
if (payload) {
|
|
146
154
|
dispatchAnalyticsEvent(payload);
|
|
@@ -195,7 +203,15 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
|
|
|
195
203
|
let markdownSlice;
|
|
196
204
|
|
|
197
205
|
if (isPlainText) {
|
|
198
|
-
|
|
206
|
+
var _markdownSlice;
|
|
207
|
+
|
|
208
|
+
markdownSlice = getMarkdownSlice(text, slice.openStart, slice.openEnd); // https://product-fabric.atlassian.net/browse/ED-15134
|
|
209
|
+
// Lists are not allowed within Blockquotes at this time. Attempting to
|
|
210
|
+
// paste a markdown list ie. ">- foo" will yeild a markdownSlice of size 0.
|
|
211
|
+
// Rather then blocking the paste action with no UI feedback, this will instead
|
|
212
|
+
// force a "paste as plain text" action by clearing the markdownSlice.
|
|
213
|
+
|
|
214
|
+
markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
|
|
199
215
|
|
|
200
216
|
if (markdownSlice) {
|
|
201
217
|
// linkify text prior to converting to macro
|
|
@@ -322,6 +338,10 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
|
|
|
322
338
|
return true;
|
|
323
339
|
}
|
|
324
340
|
|
|
341
|
+
if (handlePastePanelIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
|
|
325
345
|
return handleRichTextWithAnalytics(view, event, slice)(state, dispatch);
|
|
326
346
|
}
|
|
327
347
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { name as packageName, version as packageVersion } from '../../version
|
|
1
|
+
import { name as packageName, version as packageVersion } from '../../version-wrapper';
|
|
2
2
|
export const FABRIC_CHANNEL = 'fabric-elements';
|
|
3
3
|
export const createStatusAnalyticsAndFire = createAnalyticsEvent => payload => {
|
|
4
4
|
if (createAnalyticsEvent && payload) {
|
|
@@ -15,7 +15,7 @@ import tableMessages from './ui/messages';
|
|
|
15
15
|
import { messages as ContextualMenuMessages } from './ui/FloatingContextualMenu/ContextualMenu';
|
|
16
16
|
import { findParentDomRefOfType } from 'prosemirror-utils';
|
|
17
17
|
import { closestElement } from '../../utils/dom';
|
|
18
|
-
import { getCopyButtonConfig, showCopyButton } from '../copy-button/
|
|
18
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar'; // TODO: ED-14403 investigate why these translations don't work
|
|
19
19
|
|
|
20
20
|
export const messages = defineMessages({
|
|
21
21
|
tableOptions: {
|