@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
|
|
3
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -17,8 +18,9 @@ import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '../../ui/
|
|
|
17
18
|
import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
|
|
18
19
|
import { addAnalytics, ACTION_SUBJECT_ID } from '../analytics';
|
|
19
20
|
import { buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
20
|
-
|
|
21
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
21
22
|
|
|
23
|
+
/* type guard for edit links */
|
|
22
24
|
function isEditLink(linkMark) {
|
|
23
25
|
return linkMark.pos !== undefined;
|
|
24
26
|
}
|
|
@@ -51,145 +53,152 @@ function getLinkText(activeLinkMark, state) {
|
|
|
51
53
|
return activeLinkMark.node.text;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
export var getToolbarConfig = function getToolbarConfig(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
var link = linkMark[0] && linkMark[0].attrs.href;
|
|
79
|
-
var isValidUrl = isSafeUrl(link);
|
|
80
|
-
var labelOpenLink = formatMessage(isValidUrl ? linkMessages.openLink : linkToolbarCommonMessages.unableToOpenLink); // TODO: ED-14403 investigate why these are not translating?
|
|
81
|
-
|
|
82
|
-
var labelUnlink = formatMessage(linkToolbarCommonMessages.unlink);
|
|
83
|
-
var editLink = formatMessage(linkToolbarCommonMessages.editLink);
|
|
84
|
-
var metadata = {
|
|
85
|
-
url: link,
|
|
86
|
-
title: ''
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
if (activeLinkMark.node.text) {
|
|
90
|
-
metadata.title = activeLinkMark.node.text;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return _objectSpread(_objectSpread({}, hyperLinkToolbar), {}, {
|
|
94
|
-
height: 32,
|
|
95
|
-
width: 250,
|
|
96
|
-
items: [{
|
|
97
|
-
type: 'custom',
|
|
98
|
-
fallback: [],
|
|
99
|
-
render: function render(editorView) {
|
|
100
|
-
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
|
|
101
|
-
key: "link-appearance",
|
|
102
|
-
url: link,
|
|
103
|
-
intl: intl,
|
|
104
|
-
editorView: editorView,
|
|
105
|
-
editorState: state,
|
|
106
|
-
cardOptions: cardOptions,
|
|
107
|
-
providerFactory: providerFactory // platform={} // TODO: pass platform
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}, {
|
|
112
|
-
id: 'editor.link.edit',
|
|
113
|
-
type: 'button',
|
|
114
|
-
onClick: editInsertedLink(),
|
|
115
|
-
selected: false,
|
|
116
|
-
title: editLink,
|
|
117
|
-
showTitle: true,
|
|
118
|
-
metadata: metadata
|
|
119
|
-
}, {
|
|
120
|
-
type: 'separator'
|
|
121
|
-
}, {
|
|
122
|
-
id: 'editor.link.openLink',
|
|
123
|
-
type: 'button',
|
|
124
|
-
disabled: !isValidUrl,
|
|
125
|
-
target: '_blank',
|
|
126
|
-
href: isValidUrl ? link : undefined,
|
|
127
|
-
onClick: visitHyperlink(),
|
|
128
|
-
selected: false,
|
|
129
|
-
title: labelOpenLink,
|
|
130
|
-
icon: OpenIcon,
|
|
131
|
-
className: 'hyperlink-open-link',
|
|
132
|
-
metadata: metadata,
|
|
133
|
-
tabIndex: null
|
|
134
|
-
}, {
|
|
135
|
-
type: 'separator'
|
|
136
|
-
}, {
|
|
137
|
-
id: 'editor.link.unlink',
|
|
138
|
-
type: 'button',
|
|
139
|
-
onClick: removeLink(pos),
|
|
140
|
-
selected: false,
|
|
141
|
-
title: labelUnlink,
|
|
142
|
-
icon: UnlinkIcon,
|
|
143
|
-
tabIndex: null
|
|
144
|
-
}]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
case 'EDIT_INSERTED':
|
|
149
|
-
case 'INSERT':
|
|
150
|
-
{
|
|
151
|
-
var _link;
|
|
152
|
-
|
|
153
|
-
if (isEditLink(activeLinkMark) && activeLinkMark.node) {
|
|
154
|
-
var _linkMark = activeLinkMark.node.marks.filter(function (mark) {
|
|
56
|
+
export var getToolbarConfig = function getToolbarConfig(options) {
|
|
57
|
+
return function (state, intl, providerFactory) {
|
|
58
|
+
var formatMessage = intl.formatMessage;
|
|
59
|
+
var linkState = stateKey.getState(state);
|
|
60
|
+
|
|
61
|
+
if (linkState && linkState.activeLinkMark) {
|
|
62
|
+
var activeLinkMark = linkState.activeLinkMark;
|
|
63
|
+
var hyperLinkToolbar = {
|
|
64
|
+
title: 'Hyperlink floating controls',
|
|
65
|
+
nodeType: [state.schema.nodes.text, state.schema.nodes.paragraph, state.schema.nodes.heading, state.schema.nodes.taskItem, state.schema.nodes.decisionItem, state.schema.nodes.caption].filter(function (nodeType) {
|
|
66
|
+
return !!nodeType;
|
|
67
|
+
}),
|
|
68
|
+
// Use only the node types existing in the schema ED-6745
|
|
69
|
+
align: 'left',
|
|
70
|
+
className: activeLinkMark.type.match('INSERT|EDIT_INSERTED') ? 'hyperlink-floating-toolbar' : ''
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
switch (activeLinkMark.type) {
|
|
74
|
+
case 'EDIT':
|
|
75
|
+
{
|
|
76
|
+
var pos = activeLinkMark.pos,
|
|
77
|
+
node = activeLinkMark.node;
|
|
78
|
+
var linkMark = node.marks.filter(function (mark) {
|
|
155
79
|
return mark.type === state.schema.marks.link;
|
|
156
80
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
81
|
+
var link = linkMark[0] && linkMark[0].attrs.href;
|
|
82
|
+
var isValidUrl = isSafeUrl(link);
|
|
83
|
+
var labelOpenLink = formatMessage(isValidUrl ? linkMessages.openLink : linkToolbarCommonMessages.unableToOpenLink); // TODO: ED-14403 investigate why these are not translating?
|
|
84
|
+
|
|
85
|
+
var labelUnlink = formatMessage(linkToolbarCommonMessages.unlink);
|
|
86
|
+
var editLink = formatMessage(linkToolbarCommonMessages.editLink);
|
|
87
|
+
var metadata = {
|
|
88
|
+
url: link,
|
|
89
|
+
title: ''
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (activeLinkMark.node.text) {
|
|
93
|
+
metadata.title = activeLinkMark.node.text;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return _objectSpread(_objectSpread({}, hyperLinkToolbar), {}, {
|
|
97
|
+
height: 32,
|
|
98
|
+
width: 250,
|
|
99
|
+
items: [{
|
|
100
|
+
type: 'custom',
|
|
101
|
+
fallback: [],
|
|
102
|
+
render: function render(editorView) {
|
|
103
|
+
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
|
|
104
|
+
key: "link-appearance",
|
|
105
|
+
url: link,
|
|
106
|
+
intl: intl,
|
|
107
|
+
editorView: editorView,
|
|
108
|
+
editorState: state,
|
|
109
|
+
cardOptions: options === null || options === void 0 ? void 0 : options.cardOptions,
|
|
110
|
+
providerFactory: providerFactory // platform={} // TODO: pass platform
|
|
111
|
+
|
|
112
|
+
});
|
|
171
113
|
}
|
|
114
|
+
}, {
|
|
115
|
+
id: 'editor.link.edit',
|
|
116
|
+
type: 'button',
|
|
117
|
+
onClick: editInsertedLink(),
|
|
118
|
+
selected: false,
|
|
119
|
+
title: editLink,
|
|
120
|
+
showTitle: true,
|
|
121
|
+
metadata: metadata
|
|
122
|
+
}, {
|
|
123
|
+
type: 'separator'
|
|
124
|
+
}, {
|
|
125
|
+
id: 'editor.link.openLink',
|
|
126
|
+
type: 'button',
|
|
127
|
+
disabled: !isValidUrl,
|
|
128
|
+
target: '_blank',
|
|
129
|
+
href: isValidUrl ? link : undefined,
|
|
130
|
+
onClick: visitHyperlink(),
|
|
131
|
+
selected: false,
|
|
132
|
+
title: labelOpenLink,
|
|
133
|
+
icon: OpenIcon,
|
|
134
|
+
className: 'hyperlink-open-link',
|
|
135
|
+
metadata: metadata,
|
|
136
|
+
tabIndex: null
|
|
137
|
+
}, {
|
|
138
|
+
type: 'separator'
|
|
139
|
+
}, {
|
|
140
|
+
id: 'editor.link.unlink',
|
|
141
|
+
type: 'button',
|
|
142
|
+
onClick: removeLink(pos),
|
|
143
|
+
selected: false,
|
|
144
|
+
title: labelUnlink,
|
|
145
|
+
icon: UnlinkIcon,
|
|
146
|
+
tabIndex: null
|
|
147
|
+
}].concat(_toConsumableArray(state && showCopyButton(state) ? [{
|
|
148
|
+
type: 'separator'
|
|
149
|
+
}, getCopyButtonConfig(state, intl.formatMessage, hyperLinkToolbar.nodeType)] : []))
|
|
150
|
+
});
|
|
151
|
+
}
|
|
172
152
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
153
|
+
case 'EDIT_INSERTED':
|
|
154
|
+
case 'INSERT':
|
|
155
|
+
{
|
|
156
|
+
var _link;
|
|
157
|
+
|
|
158
|
+
if (isEditLink(activeLinkMark) && activeLinkMark.node) {
|
|
159
|
+
var _linkMark = activeLinkMark.node.marks.filter(function (mark) {
|
|
160
|
+
return mark.type === state.schema.marks.link;
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
_link = _linkMark[0] && _linkMark[0].attrs.href;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var displayText = isEditLink(activeLinkMark) ? getLinkText(activeLinkMark, state) : linkState.activeText;
|
|
167
|
+
return _objectSpread(_objectSpread({}, hyperLinkToolbar), {}, {
|
|
168
|
+
height: RECENT_SEARCH_HEIGHT_IN_PX,
|
|
169
|
+
width: RECENT_SEARCH_WIDTH_IN_PX,
|
|
170
|
+
items: [{
|
|
171
|
+
type: 'custom',
|
|
172
|
+
fallback: [],
|
|
173
|
+
render: function render(view, idx) {
|
|
174
|
+
if (!view) {
|
|
175
|
+
return null;
|
|
185
176
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
177
|
+
|
|
178
|
+
return /*#__PURE__*/React.createElement(HyperlinkAddToolbar, {
|
|
179
|
+
view: view,
|
|
180
|
+
key: idx,
|
|
181
|
+
linkPickerOptions: options === null || options === void 0 ? void 0 : options.linkPicker,
|
|
182
|
+
displayUrl: _link,
|
|
183
|
+
displayText: displayText || '',
|
|
184
|
+
providerFactory: providerFactory,
|
|
185
|
+
onSubmit: function onSubmit(href) {
|
|
186
|
+
var _options$cardOptions;
|
|
187
|
+
|
|
188
|
+
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
189
|
+
var displayText = arguments.length > 2 ? arguments[2] : undefined;
|
|
190
|
+
var inputMethod = arguments.length > 3 ? arguments[3] : undefined;
|
|
191
|
+
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);
|
|
192
|
+
view.focus();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
191
200
|
}
|
|
192
|
-
}
|
|
193
201
|
|
|
194
|
-
|
|
202
|
+
return;
|
|
203
|
+
};
|
|
195
204
|
};
|
|
@@ -20,9 +20,11 @@ var hyperlinkPlugin = function hyperlinkPlugin(options) {
|
|
|
20
20
|
}];
|
|
21
21
|
},
|
|
22
22
|
pmPlugins: function pmPlugins() {
|
|
23
|
+
var _options$cardOptions;
|
|
24
|
+
|
|
23
25
|
// Skip analytics if card provider is available, as they will be
|
|
24
26
|
// sent on handleRejected upon attempting to resolve smart link.
|
|
25
|
-
var skipAnalytics = !!options &&
|
|
27
|
+
var skipAnalytics = !!(options !== null && options !== void 0 && (_options$cardOptions = options.cardOptions) !== null && _options$cardOptions !== void 0 && _options$cardOptions.provider);
|
|
26
28
|
return [{
|
|
27
29
|
name: 'hyperlink',
|
|
28
30
|
plugin: function plugin(_ref) {
|
|
@@ -78,9 +80,7 @@ var hyperlinkPlugin = function hyperlinkPlugin(options) {
|
|
|
78
80
|
}
|
|
79
81
|
}];
|
|
80
82
|
},
|
|
81
|
-
floatingToolbar:
|
|
82
|
-
return getToolbarConfig(state, intl, providerFactory, options);
|
|
83
|
-
}
|
|
83
|
+
floatingToolbar: getToolbarConfig(options)
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["view"];
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
import { LinkPicker } from '@atlaskit/link-picker';
|
|
6
|
+
import { hideLinkToolbar as cardHideLinkToolbar } from '../../../card/pm-plugins/actions';
|
|
7
|
+
import { hideLinkToolbar } from '../../commands';
|
|
8
|
+
import { useEscapeClickaway } from './useEscapeClickaway';
|
|
9
|
+
export var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
10
|
+
var view = _ref.view,
|
|
11
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
var onEscape = useCallback(function () {
|
|
14
|
+
hideLinkToolbar()(view.state, view.dispatch);
|
|
15
|
+
view.dispatch(cardHideLinkToolbar(view.state.tr));
|
|
16
|
+
}, [view]);
|
|
17
|
+
var onClickAway = useCallback(function () {
|
|
18
|
+
hideLinkToolbar()(view.state, view.dispatch);
|
|
19
|
+
}, [view]);
|
|
20
|
+
var ref = useEscapeClickaway(onEscape, onClickAway);
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
ref: ref
|
|
23
|
+
}, /*#__PURE__*/React.createElement(LinkPicker, _extends({}, restProps, {
|
|
24
|
+
onCancel: onEscape
|
|
25
|
+
})));
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export var useEscapeClickaway = function useEscapeClickaway(onEscape, onClickAway) {
|
|
3
|
+
var ref = useRef(null);
|
|
4
|
+
useEffect(function () {
|
|
5
|
+
var handleClickAway = function handleClickAway(event) {
|
|
6
|
+
var el = ref.current;
|
|
7
|
+
|
|
8
|
+
if (event.target instanceof Element && el && !el.contains(event.target)) {
|
|
9
|
+
onClickAway();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
var handleKeydown = function 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 function () {
|
|
23
|
+
document.removeEventListener('mousedown', handleClickAway);
|
|
24
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
25
|
+
};
|
|
26
|
+
}, [onClickAway, onEscape]);
|
|
27
|
+
return ref;
|
|
28
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -11,8 +12,25 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
13
14
|
import HyperlinkAddToolbarComp from './HyperlinkAddToolbar';
|
|
15
|
+
import { INPUT_METHOD } from '../../../analytics';
|
|
14
16
|
import { stateKey as pluginKey } from '../../pm-plugins/main';
|
|
15
17
|
import WithPluginState from '../../../../ui/WithPluginState';
|
|
18
|
+
import { getFeatureFlags } from '../../../feature-flags-context';
|
|
19
|
+
import { EditorLinkPicker } from '../EditorLinkPicker';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Wraps around the editor's onSubmit handler so that the plugin can interface with the link picker
|
|
23
|
+
*/
|
|
24
|
+
var onSubmitInterface = function onSubmitInterface(onSubmit) {
|
|
25
|
+
return function (_ref) {
|
|
26
|
+
var url = _ref.url,
|
|
27
|
+
title = _ref.title,
|
|
28
|
+
displayText = _ref.displayText,
|
|
29
|
+
rawUrl = _ref.rawUrl,
|
|
30
|
+
meta = _ref.meta;
|
|
31
|
+
onSubmit(url, title !== null && title !== void 0 ? title : rawUrl, displayText || undefined, meta.inputMethod === 'manual' ? INPUT_METHOD.MANUAL : INPUT_METHOD.TYPEAHEAD);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
16
34
|
|
|
17
35
|
var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
18
36
|
_inherits(HyperlinkAddToolbar, _React$PureComponent);
|
|
@@ -29,6 +47,8 @@ var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
29
47
|
key: "render",
|
|
30
48
|
value: function render() {
|
|
31
49
|
var _this$props = this.props,
|
|
50
|
+
_this$props$linkPicke = _this$props.linkPickerOptions,
|
|
51
|
+
linkPickerOptions = _this$props$linkPicke === void 0 ? {} : _this$props$linkPicke,
|
|
32
52
|
onSubmit = _this$props.onSubmit,
|
|
33
53
|
displayText = _this$props.displayText,
|
|
34
54
|
displayUrl = _this$props.displayUrl,
|
|
@@ -37,16 +57,37 @@ var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
37
57
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
38
58
|
providers: ['activityProvider', 'searchProvider'],
|
|
39
59
|
providerFactory: providerFactory,
|
|
40
|
-
renderNode: function renderNode(
|
|
41
|
-
var activityProvider =
|
|
42
|
-
searchProvider =
|
|
60
|
+
renderNode: function renderNode(_ref2) {
|
|
61
|
+
var activityProvider = _ref2.activityProvider,
|
|
62
|
+
searchProvider = _ref2.searchProvider;
|
|
43
63
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
44
64
|
editorView: view,
|
|
45
65
|
plugins: {
|
|
46
66
|
hyperlinkPluginState: pluginKey
|
|
47
67
|
},
|
|
48
|
-
render: function render(
|
|
49
|
-
var
|
|
68
|
+
render: function render(_ref3) {
|
|
69
|
+
var _linkPickerOptions$pl;
|
|
70
|
+
|
|
71
|
+
var hyperlinkPluginState = _ref3.hyperlinkPluginState;
|
|
72
|
+
|
|
73
|
+
var _getFeatureFlags = getFeatureFlags(view.state),
|
|
74
|
+
lpLinkPicker = _getFeatureFlags.lpLinkPicker;
|
|
75
|
+
/**
|
|
76
|
+
* If activityProvider or searchProvider are present then only enable if there are plugins supplied to
|
|
77
|
+
* faciliate providing link search capabilities
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
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))) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(EditorLinkPicker, _extends({
|
|
83
|
+
view: view
|
|
84
|
+
}, linkPickerOptions, {
|
|
85
|
+
url: displayUrl,
|
|
86
|
+
displayText: displayText,
|
|
87
|
+
onSubmit: onSubmitInterface(onSubmit)
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
|
|
50
91
|
return /*#__PURE__*/React.createElement(HyperlinkAddToolbarComp, {
|
|
51
92
|
activityProvider: activityProvider,
|
|
52
93
|
searchProvider: searchProvider,
|
|
@@ -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
|
-
var MAX_INDENTATION_LEVEL = 6;
|
|
6
|
-
|
|
7
|
-
var isIndentationAllowed = function isIndentationAllowed(schema, node) {
|
|
5
|
+
export var MAX_INDENTATION_LEVEL = 6;
|
|
6
|
+
export var isIndentationAllowed = function isIndentationAllowed(schema, node) {
|
|
8
7
|
var _schema$nodes = schema.nodes,
|
|
9
8
|
paragraph = _schema$nodes.paragraph,
|
|
10
9
|
heading = _schema$nodes.heading,
|
|
@@ -28,7 +27,6 @@ var isIndentationAllowed = function isIndentationAllowed(schema, node) {
|
|
|
28
27
|
* @param getNewIndentationAttrs Function to handle new indentation level
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
|
-
|
|
32
30
|
function createIndentationCommand(getNewIndentationAttrs) {
|
|
33
31
|
return function (state, dispatch) {
|
|
34
32
|
var indentation = state.schema.marks.indentation;
|
|
@@ -36,7 +34,11 @@ function createIndentationCommand(getNewIndentationAttrs) {
|
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
function createIndentationCommandWithAnalytics(
|
|
37
|
+
function createIndentationCommandWithAnalytics(_ref) {
|
|
38
|
+
var getNewIndentationAttrs = _ref.getNewIndentationAttrs,
|
|
39
|
+
direction = _ref.direction,
|
|
40
|
+
inputMethod = _ref.inputMethod;
|
|
41
|
+
|
|
40
42
|
// Create a new getAttrs function to record the changes
|
|
41
43
|
var _getAttrsWithChangesR = getAttrsWithChangesRecorder(getNewIndentationAttrs, {
|
|
42
44
|
direction: direction
|
|
@@ -48,7 +50,12 @@ function createIndentationCommandWithAnalytics(getNewIndentationAttrs, direction
|
|
|
48
50
|
var indentationCommand = createIndentationCommand(getAttrs); // Return a new command where we change dispatch for our analytics dispatch
|
|
49
51
|
|
|
50
52
|
return function (state, dispatch) {
|
|
51
|
-
return indentationCommand(state, createAnalyticsDispatch(
|
|
53
|
+
return indentationCommand(state, createAnalyticsDispatch({
|
|
54
|
+
getAttrsChanges: getAndResetAttrsChanges,
|
|
55
|
+
inputMethod: inputMethod,
|
|
56
|
+
state: state,
|
|
57
|
+
dispatch: dispatch
|
|
58
|
+
}));
|
|
52
59
|
};
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
@@ -78,7 +85,14 @@ var getIndentAttrs = function getIndentAttrs(oldAttr) {
|
|
|
78
85
|
}; // Otherwise, increase the level by one
|
|
79
86
|
};
|
|
80
87
|
|
|
81
|
-
export var
|
|
88
|
+
export var getIndentCommand = function getIndentCommand() {
|
|
89
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
|
|
90
|
+
return createIndentationCommandWithAnalytics({
|
|
91
|
+
getNewIndentationAttrs: getIndentAttrs,
|
|
92
|
+
direction: INDENT_DIRECTION.INDENT,
|
|
93
|
+
inputMethod: inputMethod
|
|
94
|
+
});
|
|
95
|
+
};
|
|
82
96
|
/**
|
|
83
97
|
* Get new level for outdent
|
|
84
98
|
* @param oldAttr Old attributes for the mark, undefined if the mark doesn't exit
|
|
@@ -103,7 +117,14 @@ var getOutdentAttrs = function getOutdentAttrs(oldAttr) {
|
|
|
103
117
|
}; // Decrease the level on other cases
|
|
104
118
|
};
|
|
105
119
|
|
|
106
|
-
export var
|
|
120
|
+
export var getOutdentCommand = function getOutdentCommand() {
|
|
121
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
|
|
122
|
+
return createIndentationCommandWithAnalytics({
|
|
123
|
+
getNewIndentationAttrs: getOutdentAttrs,
|
|
124
|
+
direction: INDENT_DIRECTION.OUTDENT,
|
|
125
|
+
inputMethod: inputMethod
|
|
126
|
+
});
|
|
127
|
+
};
|
|
107
128
|
export var removeIndentation = function removeIndentation(state, dispatch) {
|
|
108
129
|
return toggleBlockMark(state.schema.marks.indentation, function () {
|
|
109
130
|
return false;
|
|
@@ -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
|
var indentTypes = {
|
|
3
3
|
paragraph: INDENT_TYPE.PARAGRAPH,
|
|
4
4
|
heading: INDENT_TYPE.HEADING
|
|
@@ -40,17 +40,21 @@ export function getPrevIndentLevel(prevAttrs) {
|
|
|
40
40
|
* @returns
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
|
-
export function createAnalyticsDispatch(
|
|
43
|
+
export function createAnalyticsDispatch(_ref) {
|
|
44
|
+
var getAttrsChanges = _ref.getAttrsChanges,
|
|
45
|
+
inputMethod = _ref.inputMethod,
|
|
46
|
+
state = _ref.state,
|
|
47
|
+
dispatch = _ref.dispatch;
|
|
44
48
|
return function (tr) {
|
|
45
49
|
var currentTr = tr;
|
|
46
50
|
var changes = getAttrsChanges(); // Get all attributes changes
|
|
47
51
|
// Add analytics event for each change stored.
|
|
48
52
|
|
|
49
|
-
changes.forEach(function (
|
|
50
|
-
var node =
|
|
51
|
-
prevAttrs =
|
|
52
|
-
newAttrs =
|
|
53
|
-
direction =
|
|
53
|
+
changes.forEach(function (_ref2) {
|
|
54
|
+
var node = _ref2.node,
|
|
55
|
+
prevAttrs = _ref2.prevAttrs,
|
|
56
|
+
newAttrs = _ref2.newAttrs,
|
|
57
|
+
direction = _ref2.options.direction;
|
|
54
58
|
var indentType = indentTypes[node.type.name];
|
|
55
59
|
|
|
56
60
|
if (!indentType) {
|
|
@@ -63,7 +67,7 @@ export function createAnalyticsDispatch(getAttrsChanges, state, dispatch) {
|
|
|
63
67
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
64
68
|
eventType: EVENT_TYPE.TRACK,
|
|
65
69
|
attributes: {
|
|
66
|
-
inputMethod:
|
|
70
|
+
inputMethod: inputMethod,
|
|
67
71
|
previousIndentationLevel: getPrevIndentLevel(prevAttrs),
|
|
68
72
|
newIndentLevel: getNewIndentLevel(prevAttrs, newAttrs),
|
|
69
73
|
direction: direction,
|
|
@@ -1,16 +1,17 @@
|
|
|
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
|
var 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), function (state, dispatch) {
|
|
10
11
|
var selection = state.selection;
|
|
11
12
|
|
|
12
13
|
if (isTextSelection(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
13
|
-
return dispatch ?
|
|
14
|
+
return dispatch ? getOutdentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
return false;
|
|
@@ -11,6 +11,7 @@ import { toolbarMessages } from './toolbar-messages';
|
|
|
11
11
|
import commonMessages from '../../messages';
|
|
12
12
|
import { setPresetLayout, deleteActiveLayoutNode, getPresetLayout } from './actions';
|
|
13
13
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
14
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
|
|
14
15
|
var LAYOUT_TYPES = [{
|
|
15
16
|
id: 'editor.layout.twoEquals',
|
|
16
17
|
type: 'two_equal',
|
|
@@ -93,7 +94,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
93
94
|
return buildLayoutButton(intl, i, currentLayout);
|
|
94
95
|
})), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
95
96
|
return buildLayoutButton(intl, i, currentLayout);
|
|
96
|
-
}) : []), [separator, deleteButton])
|
|
97
|
+
}) : []), _toConsumableArray(state && showCopyButton(state) ? [separator, getCopyButtonConfig(state, intl.formatMessage, nodeType)] : []), [separator, deleteButton])
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
|