@atlaskit/editor-core 180.1.0 → 181.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 +50 -0
- package/dist/cjs/actions/index.js +25 -10
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +0 -5
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +73 -103
- package/dist/cjs/create-editor/create-plugins-list.js +37 -5
- package/dist/cjs/create-editor/feature-flags-from-props.js +31 -26
- package/dist/cjs/create-editor/preset-utils.js +27 -0
- package/dist/cjs/editor-next/editor-internal.js +2 -2
- package/dist/cjs/editor-next/editor-migration-component.js +18 -2
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/cjs/editor-next/index.js +13 -9
- package/dist/cjs/editor-next/utils/getProvidersFromEditorProps.js +41 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +17 -22
- package/dist/cjs/editor.js +20 -13
- package/dist/cjs/keymaps/consts.js +1 -16
- package/dist/cjs/labs/next/presets/cxhtml.js +56 -55
- package/dist/cjs/labs/next/presets/default.js +15 -42
- package/dist/cjs/labs/next/presets/mobile.js +76 -89
- package/dist/cjs/labs/next/presets/universal.js +330 -257
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +36 -0
- package/dist/cjs/plugins/analytics/plugin.js +6 -0
- package/dist/cjs/plugins/annotation/utils.js +2 -36
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +2 -7
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -10
- package/dist/cjs/plugins/caption/index.js +0 -7
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +9 -4
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +6 -3
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main-state.js +2 -14
- package/dist/cjs/plugins/collab-edit/provider/index.js +1 -8
- package/dist/cjs/plugins/collab-edit/provider/types.js +1 -12
- package/dist/cjs/plugins/context-panel/index.js +1 -6
- package/dist/cjs/plugins/data-consumer/index.js +0 -8
- package/dist/cjs/plugins/date/utils/internal.js +0 -4
- package/dist/cjs/plugins/extension/commands.js +1 -8
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +9 -2
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/cjs/plugins/feedback-dialog/index.js +1 -4
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +7 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +24 -8
- package/dist/cjs/plugins/floating-toolbar/utils.js +0 -12
- package/dist/cjs/plugins/fragment/index.js +0 -8
- package/dist/cjs/plugins/help-dialog/commands.js +2 -6
- package/dist/cjs/plugins/image-upload/pm-plugins/main.js +50 -12
- package/dist/cjs/plugins/layout/styles.js +10 -1
- package/dist/cjs/plugins/list/utils/find.js +0 -28
- package/dist/cjs/plugins/list/utils/indentation.js +1 -25
- package/dist/cjs/plugins/list/utils/node.js +0 -5
- package/dist/cjs/plugins/list/utils/selection.js +2 -15
- package/dist/cjs/plugins/media/utils/media-common.js +1 -20
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +100 -16
- package/dist/cjs/plugins/mentions/type-ahead/index.js +1 -18
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +1 -3
- package/dist/cjs/plugins/mobile-dimensions/index.js +1 -4
- package/dist/cjs/plugins/paste/index.js +1 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +123 -87
- package/dist/cjs/plugins/paste/util/index.js +0 -46
- package/dist/cjs/plugins/quick-insert/assets/index.js +1 -27
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +49 -44
- package/dist/cjs/plugins/status/utils.js +1 -15
- package/dist/cjs/plugins/text-color/pm-plugins/main.js +0 -1
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/cjs/plugins/text-formatting/utils.js +1 -26
- package/dist/cjs/plugins/type-ahead/constants.js +1 -7
- package/dist/cjs/plugins/type-ahead/index.js +4 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +6 -37
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/cjs/plugins/type-ahead/utils.js +25 -24
- package/dist/cjs/test-utils.js +4 -12
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +43 -8
- package/dist/cjs/ui/ColorPalette/index.js +18 -0
- package/dist/cjs/ui/ColorPickerButton/index.js +6 -2
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/cjs/ui/ConfigPanel/utils.js +4 -17
- package/dist/cjs/ui/ContentStyles/index.js +1 -1
- package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +1 -3
- package/dist/cjs/ui/Resizer/utils.js +1 -3
- package/dist/cjs/ui/styles.js +3 -7
- package/dist/cjs/utils/get-editor-plugins.js +1 -3
- package/dist/cjs/utils/index.js +9 -269
- package/dist/cjs/utils/input-rules.js +1 -15
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +23 -9
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +0 -5
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +67 -82
- package/dist/es2019/create-editor/create-plugins-list.js +32 -5
- package/dist/es2019/create-editor/feature-flags-from-props.js +31 -26
- package/dist/es2019/create-editor/preset-utils.js +15 -0
- package/dist/es2019/editor-next/editor-internal.js +2 -2
- package/dist/es2019/editor-next/editor-migration-component.js +19 -2
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/es2019/editor-next/index.js +13 -7
- package/dist/es2019/editor-next/utils/getProvidersFromEditorProps.js +36 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +18 -24
- package/dist/es2019/editor.js +20 -11
- package/dist/es2019/keymaps/consts.js +7 -11
- package/dist/es2019/labs/next/presets/cxhtml.js +56 -53
- package/dist/es2019/labs/next/presets/default.js +18 -38
- package/dist/es2019/labs/next/presets/mobile.js +88 -88
- package/dist/es2019/labs/next/presets/universal.js +338 -265
- package/dist/es2019/labs/next/presets/useUniversalPreset.js +25 -0
- package/dist/es2019/plugins/analytics/plugin.js +7 -0
- package/dist/es2019/plugins/annotation/utils.js +2 -30
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +1 -3
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -9
- package/dist/es2019/plugins/caption/index.js +0 -2
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -4
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +6 -3
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main-state.js +1 -9
- package/dist/es2019/plugins/collab-edit/provider/index.js +1 -1
- package/dist/es2019/plugins/collab-edit/provider/types.js +1 -10
- package/dist/es2019/plugins/context-panel/index.js +0 -3
- package/dist/es2019/plugins/data-consumer/index.js +0 -7
- package/dist/es2019/plugins/date/utils/internal.js +0 -3
- package/dist/es2019/plugins/extension/commands.js +0 -6
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +12 -2
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +3 -0
- package/dist/es2019/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/es2019/plugins/feedback-dialog/index.js +0 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +7 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +1 -11
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +21 -4
- package/dist/es2019/plugins/floating-toolbar/utils.js +0 -10
- package/dist/es2019/plugins/fragment/index.js +0 -7
- package/dist/es2019/plugins/help-dialog/commands.js +1 -2
- package/dist/es2019/plugins/image-upload/pm-plugins/main.js +47 -5
- package/dist/es2019/plugins/layout/styles.js +12 -4
- package/dist/es2019/plugins/list/utils/find.js +0 -27
- package/dist/es2019/plugins/list/utils/indentation.js +0 -23
- package/dist/es2019/plugins/list/utils/node.js +1 -4
- package/dist/es2019/plugins/list/utils/selection.js +2 -15
- package/dist/es2019/plugins/media/utils/media-common.js +1 -19
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +64 -16
- package/dist/es2019/plugins/mentions/type-ahead/index.js +1 -14
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +1 -2
- package/dist/es2019/plugins/mobile-dimensions/index.js +0 -3
- package/dist/es2019/plugins/paste/index.js +1 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +126 -94
- package/dist/es2019/plugins/paste/util/index.js +5 -45
- package/dist/es2019/plugins/quick-insert/assets/index.js +0 -8
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +56 -56
- package/dist/es2019/plugins/status/utils.js +1 -11
- package/dist/es2019/plugins/text-color/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/es2019/plugins/text-formatting/utils.js +0 -19
- package/dist/es2019/plugins/type-ahead/constants.js +0 -5
- package/dist/es2019/plugins/type-ahead/index.js +4 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +4 -37
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/es2019/plugins/type-ahead/utils.js +22 -25
- package/dist/es2019/test-utils.js +4 -7
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +40 -6
- package/dist/es2019/ui/ColorPalette/index.js +2 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +6 -2
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/es2019/ui/ConfigPanel/utils.js +0 -6
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/es2019/ui/ElementBrowser/constants.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -1
- package/dist/es2019/ui/styles.js +0 -6
- package/dist/es2019/utils/get-editor-plugins.js +1 -3
- package/dist/es2019/utils/index.js +13 -199
- package/dist/es2019/utils/input-rules.js +0 -14
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +23 -9
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +0 -5
- package/dist/esm/create-editor/ReactEditorViewInternal.js +73 -102
- package/dist/esm/create-editor/create-plugins-list.js +36 -5
- package/dist/esm/create-editor/feature-flags-from-props.js +31 -26
- package/dist/esm/create-editor/preset-utils.js +21 -0
- package/dist/esm/editor-next/editor-internal.js +2 -2
- package/dist/esm/editor-next/editor-migration-component.js +18 -2
- package/dist/esm/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/esm/editor-next/index.js +13 -9
- package/dist/esm/editor-next/utils/getProvidersFromEditorProps.js +35 -0
- package/dist/esm/editor-next/utils/handleProviders.js +17 -22
- package/dist/esm/editor.js +20 -13
- package/dist/esm/keymaps/consts.js +7 -11
- package/dist/esm/labs/next/presets/cxhtml.js +56 -55
- package/dist/esm/labs/next/presets/default.js +18 -41
- package/dist/esm/labs/next/presets/mobile.js +88 -90
- package/dist/esm/labs/next/presets/universal.js +330 -257
- package/dist/esm/labs/next/presets/useUniversalPreset.js +29 -0
- package/dist/esm/plugins/analytics/plugin.js +6 -0
- package/dist/esm/plugins/annotation/utils.js +2 -32
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +1 -5
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -9
- package/dist/esm/plugins/caption/index.js +0 -2
- package/dist/esm/plugins/card/nodeviews/blockCard.js +9 -4
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +6 -3
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/esm/plugins/code-block/pm-plugins/main-state.js +0 -10
- package/dist/esm/plugins/collab-edit/provider/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/types.js +1 -10
- package/dist/esm/plugins/context-panel/index.js +0 -3
- package/dist/esm/plugins/data-consumer/index.js +0 -7
- package/dist/esm/plugins/date/utils/internal.js +0 -3
- package/dist/esm/plugins/extension/commands.js +0 -6
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +9 -2
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/esm/plugins/feedback-dialog/index.js +0 -2
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +7 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +24 -8
- package/dist/esm/plugins/floating-toolbar/utils.js +0 -10
- package/dist/esm/plugins/fragment/index.js +0 -7
- package/dist/esm/plugins/help-dialog/commands.js +0 -3
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +51 -12
- package/dist/esm/plugins/layout/styles.js +11 -2
- package/dist/esm/plugins/list/utils/find.js +0 -27
- package/dist/esm/plugins/list/utils/indentation.js +0 -23
- package/dist/esm/plugins/list/utils/node.js +1 -4
- package/dist/esm/plugins/list/utils/selection.js +2 -12
- package/dist/esm/plugins/media/utils/media-common.js +1 -17
- package/dist/esm/plugins/mentions/nodeviews/mention.js +97 -16
- package/dist/esm/plugins/mentions/type-ahead/index.js +1 -18
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +1 -2
- package/dist/esm/plugins/mobile-dimensions/index.js +0 -3
- package/dist/esm/plugins/paste/index.js +1 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +122 -86
- package/dist/esm/plugins/paste/util/index.js +5 -45
- package/dist/esm/plugins/quick-insert/assets/index.js +0 -20
- package/dist/esm/plugins/selection/gap-cursor/actions.js +52 -45
- package/dist/esm/plugins/status/utils.js +1 -13
- package/dist/esm/plugins/text-color/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/esm/plugins/text-formatting/utils.js +0 -21
- package/dist/esm/plugins/type-ahead/constants.js +0 -5
- package/dist/esm/plugins/type-ahead/index.js +4 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +4 -33
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/esm/plugins/type-ahead/utils.js +24 -22
- package/dist/esm/test-utils.js +4 -7
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +41 -6
- package/dist/esm/ui/ColorPalette/index.js +2 -1
- package/dist/esm/ui/ColorPickerButton/index.js +6 -2
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/esm/ui/ConfigPanel/utils.js +3 -14
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/esm/ui/ElementBrowser/constants.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -1
- package/dist/esm/ui/styles.js +2 -5
- package/dist/esm/utils/get-editor-plugins.js +1 -3
- package/dist/esm/utils/index.js +13 -196
- package/dist/esm/utils/input-rules.js +0 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +4 -4
- package/dist/types/create-editor/ReactEditorView.d.ts +0 -3
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +9 -7
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +3 -4
- package/dist/types/create-editor/create-plugins-list.d.ts +3 -5
- package/dist/types/create-editor/preset-utils.d.ts +2 -0
- package/dist/types/editor-next/editor-internal.d.ts +9 -9
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +2 -2
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +2 -2
- package/dist/types/editor-next/index.d.ts +6 -6
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -2
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +1 -1
- package/dist/types/editor-next/utils/getProvidersFromEditorProps.d.ts +9 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +2 -2
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +2 -2
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +1 -1
- package/dist/types/editor.d.ts +7 -4
- package/dist/types/keymaps/consts.d.ts +0 -11
- package/dist/types/labs/next/presets/cxhtml.d.ts +33 -1
- package/dist/types/labs/next/presets/default.d.ts +67 -10
- package/dist/types/labs/next/presets/mobile.d.ts +33 -1
- package/dist/types/labs/next/presets/universal.d.ts +5 -13
- package/dist/types/labs/next/presets/useUniversalPreset.d.ts +7 -0
- package/dist/types/nodeviews/context-adapter.d.ts +0 -1
- package/dist/types/nodeviews/index.d.ts +0 -1
- package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -11
- package/dist/types/plugins/annotation/utils.d.ts +0 -17
- package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +2 -3
- package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +2 -6
- package/dist/types/plugins/caption/index.d.ts +0 -2
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +2 -10
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/plugins/code-block/actions.d.ts +0 -4
- package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +0 -3
- package/dist/types/plugins/collab-edit/provider/index.d.ts +1 -2
- package/dist/types/plugins/collab-edit/provider/types.d.ts +1 -36
- package/dist/types/plugins/context-panel/index.d.ts +2 -3
- package/dist/types/plugins/data-consumer/index.d.ts +0 -2
- package/dist/types/plugins/date/utils/internal.d.ts +0 -1
- package/dist/types/plugins/extension/commands.d.ts +0 -1
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +0 -5
- package/dist/types/plugins/feedback-dialog/index.d.ts +0 -2
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
- package/dist/types/plugins/fragment/index.d.ts +0 -2
- package/dist/types/plugins/help-dialog/commands.d.ts +0 -1
- package/dist/types/plugins/history/actions.d.ts +1 -2
- package/dist/types/plugins/layout/styles.d.ts +2 -1
- package/dist/types/plugins/list/utils/find.d.ts +0 -1
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -1
- package/dist/types/plugins/list/utils/node.d.ts +0 -2
- package/dist/types/plugins/list/utils/selection.d.ts +0 -3
- package/dist/types/plugins/media/utils/media-common.d.ts +0 -5
- package/dist/types/plugins/mentions/types.d.ts +1 -2
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +2 -3
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +0 -6
- package/dist/types/plugins/mentions/ui/ToolbarMention/index.d.ts +1 -4
- package/dist/types/plugins/mobile-dimensions/index.d.ts +0 -1
- package/dist/types/plugins/paste/index.d.ts +0 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +6 -3
- package/dist/types/plugins/paste/util/index.d.ts +0 -6
- package/dist/types/plugins/quick-insert/assets/index.d.ts +0 -2
- package/dist/types/plugins/status/utils.d.ts +0 -3
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/text-color/pm-plugins/main.d.ts +2 -12
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -4
- package/dist/types/plugins/type-ahead/constants.d.ts +0 -4
- package/dist/types/plugins/type-ahead/index.d.ts +1 -0
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +2 -11
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +1 -0
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +1 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +3 -3
- package/dist/types/test-utils.d.ts +4 -5
- package/dist/types/types/editor-appearance-component.d.ts +2 -2
- package/dist/types/types/editor-props.d.ts +55 -42
- package/dist/types/ui/Appearance/Chromeless.d.ts +0 -5
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +0 -7
- package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +3 -2
- package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -4
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +3 -3
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -5
- package/dist/types/ui/ColorPalette/Palettes/index.d.ts +1 -1
- package/dist/types/ui/ColorPalette/Palettes/type.d.ts +1 -1
- package/dist/types/ui/ColorPalette/index.d.ts +2 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +4 -2
- package/dist/types/ui/ConfigPanel/types.d.ts +0 -3
- package/dist/types/ui/ConfigPanel/utils.d.ts +2 -3
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +0 -3
- package/dist/types/ui/ElementBrowser/constants.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +0 -5
- package/dist/types/ui/Resizer/utils.d.ts +0 -1
- package/dist/types/ui/styles.d.ts +0 -1
- package/dist/types/utils/index.d.ts +6 -65
- package/dist/types/utils/input-rules.d.ts +1 -2
- package/dist/types/utils/table.d.ts +0 -1
- package/package.json +23 -24
- package/report.api.md +155 -146
- package/dist/cjs/labs/next/presets/preset.js +0 -101
- package/dist/cjs/plugins/analytics/types/type-ahead.js +0 -5
- package/dist/cjs/plugins/collab-edit/provider/channel.js +0 -313
- package/dist/cjs/plugins/collab-edit/provider/logger.js +0 -17
- package/dist/cjs/plugins/collab-edit/provider/mock-users.js +0 -19
- package/dist/cjs/plugins/data-consumer/plugin-key.js +0 -9
- package/dist/cjs/plugins/media/toolbar/toolbar-messages.js +0 -15
- package/dist/cjs/profiler/render-count.js +0 -60
- package/dist/cjs/ui/ColorPalette/Color/index.js +0 -9
- package/dist/cjs/ui/ConfigPanel/FieldDescription.js +0 -19
- package/dist/cjs/ui/WithPluginState/types.js +0 -5
- package/dist/es2019/labs/next/presets/preset.js +0 -68
- package/dist/es2019/plugins/analytics/types/type-ahead.js +0 -1
- package/dist/es2019/plugins/collab-edit/provider/channel.js +0 -179
- package/dist/es2019/plugins/collab-edit/provider/logger.js +0 -8
- package/dist/es2019/plugins/collab-edit/provider/mock-users.js +0 -12
- package/dist/es2019/plugins/data-consumer/plugin-key.js +0 -2
- package/dist/es2019/plugins/media/toolbar/toolbar-messages.js +0 -8
- package/dist/es2019/profiler/render-count.js +0 -53
- package/dist/es2019/ui/ColorPalette/Color/index.js +0 -2
- package/dist/es2019/ui/ConfigPanel/FieldDescription.js +0 -12
- package/dist/es2019/ui/WithPluginState/types.js +0 -1
- package/dist/esm/labs/next/presets/preset.js +0 -93
- package/dist/esm/plugins/analytics/types/type-ahead.js +0 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +0 -305
- package/dist/esm/plugins/collab-edit/provider/logger.js +0 -10
- package/dist/esm/plugins/collab-edit/provider/mock-users.js +0 -12
- package/dist/esm/plugins/data-consumer/plugin-key.js +0 -2
- package/dist/esm/plugins/media/toolbar/toolbar-messages.js +0 -8
- package/dist/esm/profiler/render-count.js +0 -49
- package/dist/esm/ui/ColorPalette/Color/index.js +0 -2
- package/dist/esm/ui/ConfigPanel/FieldDescription.js +0 -11
- package/dist/esm/ui/WithPluginState/types.js +0 -1
- package/dist/types/labs/next/presets/preset.d.ts +0 -46
- package/dist/types/plugins/analytics/types/type-ahead.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/channel.d.ts +0 -48
- package/dist/types/plugins/collab-edit/provider/logger.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/mock-users.d.ts +0 -6
- package/dist/types/plugins/data-consumer/plugin-key.d.ts +0 -2
- package/dist/types/plugins/media/toolbar/toolbar-messages.d.ts +0 -7
- package/dist/types/profiler/render-count.d.ts +0 -14
- package/dist/types/ui/ColorPalette/Color/index.d.ts +0 -2
- package/dist/types/ui/ConfigPanel/FieldDescription.d.ts +0 -6
- package/dist/types/ui/WithPluginState/types.d.ts +0 -10
|
@@ -5,7 +5,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
|
|
6
6
|
import { getPasteSource } from '../util';
|
|
7
7
|
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
8
|
-
import { pipe } from '../../../utils';
|
|
9
8
|
import { findParentNode } from 'prosemirror-utils';
|
|
10
9
|
import { mapSlice } from '../../../utils/slice';
|
|
11
10
|
import { getLinkDomain } from '../../hyperlink/utils';
|
|
@@ -54,10 +53,11 @@ var nodeToActionSubjectId = {
|
|
|
54
53
|
tableRow: ACTION_SUBJECT_ID.PASTE_TABLE_ROW,
|
|
55
54
|
taskList: ACTION_SUBJECT_ID.PASTE_TASK_LIST
|
|
56
55
|
};
|
|
57
|
-
export function getContent(
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
export function getContent(_ref) {
|
|
57
|
+
var schema = _ref.schema,
|
|
58
|
+
slice = _ref.slice;
|
|
59
|
+
var paragraph = schema.nodes.paragraph,
|
|
60
|
+
link = schema.marks.link;
|
|
61
61
|
var nodeOrMarkName = new Set();
|
|
62
62
|
slice.content.forEach(function (node) {
|
|
63
63
|
if (node.type === paragraph && node.content.size === 0) {
|
|
@@ -96,14 +96,14 @@ export function getMediaTraceId(slice) {
|
|
|
96
96
|
});
|
|
97
97
|
return traceId;
|
|
98
98
|
}
|
|
99
|
-
function getActionSubjectId(
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
paragraph =
|
|
104
|
-
listItem =
|
|
105
|
-
taskItem =
|
|
106
|
-
decisionItem =
|
|
99
|
+
function getActionSubjectId(_ref2) {
|
|
100
|
+
var selection = _ref2.selection,
|
|
101
|
+
schema = _ref2.schema;
|
|
102
|
+
var _schema$nodes = schema.nodes,
|
|
103
|
+
paragraph = _schema$nodes.paragraph,
|
|
104
|
+
listItem = _schema$nodes.listItem,
|
|
105
|
+
taskItem = _schema$nodes.taskItem,
|
|
106
|
+
decisionItem = _schema$nodes.decisionItem;
|
|
107
107
|
var parent = findParentNode(function (node) {
|
|
108
108
|
if (node.type !== paragraph && node.type !== listItem && node.type !== taskItem && node.type !== decisionItem) {
|
|
109
109
|
return true;
|
|
@@ -145,53 +145,64 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
|
|
|
145
145
|
}
|
|
146
146
|
} : {});
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext) {
|
|
149
|
+
return function (selection) {
|
|
150
|
+
var text = event.clipboardData ? event.clipboardData.getData('text/plain') || event.clipboardData.getData('text/uri-list') : '';
|
|
151
|
+
var actionSubjectId = getActionSubjectId({
|
|
152
|
+
selection: selection,
|
|
153
|
+
schema: selection.$from.doc.type.schema
|
|
154
|
+
});
|
|
155
|
+
var pasteSize = slice.size;
|
|
156
|
+
var content = getContent({
|
|
157
|
+
schema: selection.$from.doc.type.schema,
|
|
158
|
+
slice: slice
|
|
159
|
+
});
|
|
160
|
+
var linkUrls = [];
|
|
161
|
+
var mediaTraceId = getMediaTraceId(slice);
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
// If we have a link among the pasted content, grab the
|
|
164
|
+
// domain and send it up with the analytics event
|
|
165
|
+
if (content === PasteContents.url || content === PasteContents.mixed) {
|
|
166
|
+
mapSlice(slice, function (node) {
|
|
167
|
+
var linkMark = node.marks.find(function (mark) {
|
|
168
|
+
return mark.type.name === 'link';
|
|
169
|
+
});
|
|
170
|
+
if (linkMark) {
|
|
171
|
+
linkUrls.push(linkMark.attrs.href);
|
|
172
|
+
}
|
|
173
|
+
return node;
|
|
162
174
|
});
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
}
|
|
176
|
+
if (pasteContext.asPlain) {
|
|
177
|
+
return createPasteAsPlainPayload(actionSubjectId, text, linkUrls.length);
|
|
178
|
+
}
|
|
179
|
+
var source = getPasteSource(event);
|
|
180
|
+
if (pasteContext.type === PasteTypes.plain) {
|
|
181
|
+
return createPastePayload(actionSubjectId, {
|
|
182
|
+
pasteSize: text.length,
|
|
183
|
+
type: pasteContext.type,
|
|
184
|
+
content: PasteContents.text,
|
|
185
|
+
source: source,
|
|
186
|
+
hyperlinkPasteOnText: false,
|
|
187
|
+
linksInPasteCount: linkUrls.length,
|
|
188
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
var linkDomains = linkUrls.map(getLinkDomain);
|
|
174
192
|
return createPastePayload(actionSubjectId, {
|
|
175
|
-
pasteSize: text.length,
|
|
176
193
|
type: pasteContext.type,
|
|
177
|
-
|
|
194
|
+
pasteSize: pasteSize,
|
|
195
|
+
content: content,
|
|
178
196
|
source: source,
|
|
179
|
-
hyperlinkPasteOnText:
|
|
197
|
+
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText,
|
|
180
198
|
linksInPasteCount: linkUrls.length,
|
|
199
|
+
mediaTraceId: mediaTraceId,
|
|
181
200
|
pasteSplitList: pasteContext.pasteSplitList
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
pasteSize: pasteSize,
|
|
188
|
-
content: content,
|
|
189
|
-
source: source,
|
|
190
|
-
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText,
|
|
191
|
-
linksInPasteCount: linkUrls.length,
|
|
192
|
-
mediaTraceId: mediaTraceId,
|
|
193
|
-
pasteSplitList: pasteContext.pasteSplitList
|
|
194
|
-
}, linkDomains);
|
|
201
|
+
}, linkDomains);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
205
|
+
return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
|
|
195
206
|
}
|
|
196
207
|
|
|
197
208
|
// TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
@@ -207,79 +218,104 @@ export function pasteCommandWithAnalytics(view, event, slice, pasteContext) {
|
|
|
207
218
|
});
|
|
208
219
|
}
|
|
209
220
|
export var handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainTextWithAnalytics(view, event, slice) {
|
|
210
|
-
return
|
|
221
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
211
222
|
type: PasteTypes.plain,
|
|
212
223
|
asPlain: true
|
|
213
|
-
}))(slice, event);
|
|
224
|
+
}))(handlePasteAsPlainText(slice, event));
|
|
214
225
|
};
|
|
215
226
|
export var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type) {
|
|
216
|
-
return
|
|
227
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
217
228
|
type: type
|
|
218
|
-
}))(slice);
|
|
229
|
+
}))(handlePasteIntoTaskOrDecisionOrPanel(slice));
|
|
219
230
|
};
|
|
220
231
|
export var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(view, event, slice, type) {
|
|
221
|
-
return
|
|
232
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
222
233
|
type: type
|
|
223
|
-
}))(slice);
|
|
234
|
+
}))(handlePasteIntoCaption(slice));
|
|
224
235
|
};
|
|
225
236
|
export var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(view, event, slice, text) {
|
|
226
|
-
return
|
|
237
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
227
238
|
type: PasteTypes.plain
|
|
228
|
-
}))(text);
|
|
239
|
+
}))(handleCodeBlock(text));
|
|
229
240
|
};
|
|
230
241
|
export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type) {
|
|
231
|
-
return
|
|
242
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
232
243
|
type: type
|
|
233
|
-
}))(slice);
|
|
244
|
+
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD)(slice));
|
|
234
245
|
};
|
|
235
246
|
export var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type) {
|
|
236
|
-
return
|
|
247
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
237
248
|
type: type
|
|
238
|
-
}))(slice);
|
|
249
|
+
}))(handlePastePreservingMarks(slice));
|
|
239
250
|
};
|
|
240
251
|
export var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice) {
|
|
241
|
-
return
|
|
252
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
242
253
|
type: PasteTypes.markdown
|
|
243
|
-
}))(slice);
|
|
254
|
+
}))(handleMarkdown(slice));
|
|
244
255
|
};
|
|
245
256
|
export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice) {
|
|
246
|
-
return
|
|
257
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
247
258
|
type: PasteTypes.richText
|
|
248
|
-
}))(slice);
|
|
259
|
+
}))(handleRichText(slice));
|
|
249
260
|
};
|
|
261
|
+
function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
262
|
+
return function (mainCommand) {
|
|
263
|
+
return function (state, dispatch, view) {
|
|
264
|
+
var originalTransaction = state.tr;
|
|
265
|
+
var fakeDispatch = function fakeDispatch(tr) {
|
|
266
|
+
originalTransaction = tr;
|
|
267
|
+
};
|
|
268
|
+
var result = mainCommand(state, fakeDispatch, view);
|
|
269
|
+
if (!result) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
if (dispatch && originalTransaction.docChanged) {
|
|
273
|
+
// it needs to know the selection before the changes
|
|
274
|
+
var payload = createPayloadByTransaction(state.selection);
|
|
275
|
+
addAnalytics(state, originalTransaction, payload);
|
|
276
|
+
dispatch(originalTransaction);
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
}
|
|
250
282
|
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice) {
|
|
251
|
-
return
|
|
283
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
252
284
|
type: PasteTypes.richText
|
|
253
|
-
}))(slice);
|
|
285
|
+
}))(handlePastePanelOrDecisionContentIntoList(slice));
|
|
254
286
|
};
|
|
255
287
|
export var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice) {
|
|
256
|
-
return
|
|
288
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
257
289
|
type: PasteTypes.richText,
|
|
258
290
|
pasteSplitList: true
|
|
259
|
-
}))(slice);
|
|
291
|
+
}))(handlePasteNonNestableBlockNodesIntoList(slice));
|
|
260
292
|
};
|
|
261
293
|
export var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
|
|
262
|
-
return
|
|
263
|
-
type: PasteTypes.richText
|
|
264
|
-
|
|
294
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
295
|
+
type: PasteTypes.richText,
|
|
296
|
+
pasteSplitList: true
|
|
297
|
+
}))(handleExpandPasteInTable(slice));
|
|
265
298
|
};
|
|
266
299
|
export var handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(view, event, slice) {
|
|
267
|
-
return
|
|
300
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
268
301
|
type: PasteTypes.richText
|
|
269
|
-
}))(slice);
|
|
302
|
+
}))(handleSelectedTable(slice));
|
|
270
303
|
};
|
|
271
304
|
export var handlePasteLinkOnSelectedTextWithAnalytics = function handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, type) {
|
|
272
|
-
return
|
|
305
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
273
306
|
type: type,
|
|
274
307
|
hyperlinkPasteOnText: true
|
|
275
|
-
}))(slice);
|
|
308
|
+
}))(handlePasteLinkOnSelectedText(slice));
|
|
276
309
|
};
|
|
277
|
-
export var createPasteMeasurePayload = function createPasteMeasurePayload(
|
|
278
|
-
var view =
|
|
279
|
-
duration =
|
|
280
|
-
content =
|
|
281
|
-
distortedDuration =
|
|
282
|
-
var pasteIntoNode = getActionSubjectId(
|
|
310
|
+
export var createPasteMeasurePayload = function createPasteMeasurePayload(_ref3) {
|
|
311
|
+
var view = _ref3.view,
|
|
312
|
+
duration = _ref3.duration,
|
|
313
|
+
content = _ref3.content,
|
|
314
|
+
distortedDuration = _ref3.distortedDuration;
|
|
315
|
+
var pasteIntoNode = getActionSubjectId({
|
|
316
|
+
selection: view.state.selection,
|
|
317
|
+
schema: view.state.schema
|
|
318
|
+
});
|
|
283
319
|
return {
|
|
284
320
|
action: ACTION.PASTED_TIMED,
|
|
285
321
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
@@ -11,19 +11,19 @@ export function isPastedFromWord(html) {
|
|
|
11
11
|
export function isPastedFromExcel(html) {
|
|
12
12
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:excel') >= 0;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
function isPastedFromDropboxPaper(html) {
|
|
15
15
|
return !!html && !!html.match(/class=\"\s?author-d-.+"/gim);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
function isPastedFromGoogleDocs(html) {
|
|
18
18
|
return !!html && !!html.match(/id=\"docs-internal-guid-.+"/gim);
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
function isPastedFromGoogleSpreadSheets(html) {
|
|
21
21
|
return !!html && !!html.match(/data-sheets-.+=/gim);
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function isPastedFromPages(html) {
|
|
24
24
|
return !!html && html.indexOf('content="Cocoa HTML Writer"') >= 0;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function isPastedFromFabricEditor(html) {
|
|
27
27
|
return !!html && html.indexOf('data-pm-slice="') >= 0;
|
|
28
28
|
}
|
|
29
29
|
export var isSingleLine = function isSingleLine(text) {
|
|
@@ -52,46 +52,6 @@ export function getPasteSource(event) {
|
|
|
52
52
|
return 'uncategorized';
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// TODO: Write JEST tests for this part
|
|
56
|
-
export function isCode(str) {
|
|
57
|
-
var lines = str.split(/\r?\n|\r/);
|
|
58
|
-
if (3 > lines.length) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
var weight = 0;
|
|
62
|
-
lines.forEach(function (line) {
|
|
63
|
-
// Ends with : or ;
|
|
64
|
-
if (/[:;]$/.test(line)) {
|
|
65
|
-
weight++;
|
|
66
|
-
}
|
|
67
|
-
// Contains second and third braces
|
|
68
|
-
if (/[{}\[\]]/.test(line)) {
|
|
69
|
-
weight++;
|
|
70
|
-
}
|
|
71
|
-
// Contains <tag> or </
|
|
72
|
-
if (/<\w+>/.test(line) || /<\//.test(line)) {
|
|
73
|
-
weight++;
|
|
74
|
-
}
|
|
75
|
-
// Contains () <- function calls
|
|
76
|
-
if (/\(\)/.test(line)) {
|
|
77
|
-
weight++;
|
|
78
|
-
}
|
|
79
|
-
// Contains a link
|
|
80
|
-
if (/(^|[^!])\[(.*?)\]\((\S+)\)$/.test(line)) {
|
|
81
|
-
weight--;
|
|
82
|
-
}
|
|
83
|
-
// New line starts with less than two chars. e.g- if, {, <, etc
|
|
84
|
-
var token = /^(\s+)[a-zA-Z<{]{2,}/.exec(line);
|
|
85
|
-
if (token && 2 <= token[1].length) {
|
|
86
|
-
weight++;
|
|
87
|
-
}
|
|
88
|
-
if (/&&/.test(line)) {
|
|
89
|
-
weight++;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
return 4 <= weight && weight >= 0.5 * lines.length;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
55
|
// @see https://product-fabric.atlassian.net/browse/ED-3159
|
|
96
56
|
// @see https://github.com/markdown-it/markdown-it/issues/38
|
|
97
57
|
export function escapeLinks(text) {
|
|
@@ -172,16 +172,6 @@ export var IconPanel = Loadable({
|
|
|
172
172
|
return null;
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
export var IconCustomPanel = Loadable({
|
|
176
|
-
loader: function loader() {
|
|
177
|
-
return import( /* webpackChunkName: "@atlaskit-internal_editor-icon-custon-panel" */'./custom-panel').then(function (module) {
|
|
178
|
-
return module.default;
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
loading: function loading() {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
175
|
export var IconQuote = Loadable({
|
|
186
176
|
loader: function loader() {
|
|
187
177
|
return import( /* webpackChunkName: "@atlaskit-internal_editor-icon-quote" */'./quote').then(function (module) {
|
|
@@ -202,16 +192,6 @@ export var IconStatus = Loadable({
|
|
|
202
192
|
return null;
|
|
203
193
|
}
|
|
204
194
|
});
|
|
205
|
-
export var IconFallback = Loadable({
|
|
206
|
-
loader: function loader() {
|
|
207
|
-
return import( /* webpackChunkName: "@atlaskit-internal_editor-icon-fallback" */'./fallback').then(function (module) {
|
|
208
|
-
return module.default;
|
|
209
|
-
});
|
|
210
|
-
},
|
|
211
|
-
loading: function loading() {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
195
|
function importHeading(level) {
|
|
216
196
|
switch (level) {
|
|
217
197
|
case 1:
|
|
@@ -1,52 +1,16 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
var _mapDirection;
|
|
3
1
|
import { NodeSelection, Selection, TextSelection } from 'prosemirror-state';
|
|
4
|
-
import { findDomRefAtPos, removeNodeBefore } from 'prosemirror-utils';
|
|
2
|
+
import { findDomRefAtPos, findPositionOfNodeBefore, removeNodeBefore } from 'prosemirror-utils';
|
|
5
3
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
6
4
|
import { Direction, isBackward, isForward } from './direction';
|
|
7
5
|
import { GapCursorSelection, Side } from './selection';
|
|
8
|
-
import {
|
|
6
|
+
import { isTextBlockNearPos } from './utils';
|
|
9
7
|
import { isValidTargetNode } from './utils/is-valid-target-node';
|
|
10
8
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from '../../../utils/prosemirror/position';
|
|
11
9
|
import { gapCursorPluginKey } from '../pm-plugins/gap-cursor-plugin-key';
|
|
12
10
|
import { isPositionNearTableRow } from '../../../utils/table';
|
|
13
|
-
|
|
14
|
-
function shouldHandleMediaGapCursor(dir, state) {
|
|
15
|
-
var doc = state.doc,
|
|
16
|
-
schema = state.schema,
|
|
17
|
-
selection = state.selection;
|
|
18
|
-
var $pos = isBackward(dir) ? selection.$from : selection.$to;
|
|
19
|
-
if (selection instanceof TextSelection) {
|
|
20
|
-
// Should not use gap cursor if I am moving from a text selection into a media node
|
|
21
|
-
if (dir === Direction.UP && !atTheBeginningOfDoc(state) || dir === Direction.DOWN && !atTheEndOfDoc(state)) {
|
|
22
|
-
var media = getMediaNearPos(doc, $pos, schema, mapDirection[dir]);
|
|
23
|
-
if (media) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Should not use gap cursor if I am moving from a text selection into a media node with layout wrap-right or wrap-left
|
|
29
|
-
if (dir === Direction.LEFT || dir === Direction.RIGHT) {
|
|
30
|
-
var _media = getMediaNearPos(doc, $pos, schema, mapDirection[dir]);
|
|
31
|
-
var mediaSingle = schema.nodes.mediaSingle;
|
|
32
|
-
if (_media && _media.type === mediaSingle && (_media.attrs.layout === 'wrap-right' || _media.attrs.layout === 'wrap-left')) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (selection instanceof NodeSelection) {
|
|
38
|
-
// Should not use gap cursor if I am moving left/right from media node with layout wrap right or wrap-left
|
|
39
|
-
if (dir === Direction.LEFT || dir === Direction.RIGHT) {
|
|
40
|
-
var maybeMedia = doc.nodeAt(selection.$from.pos);
|
|
41
|
-
var _mediaSingle = schema.nodes.mediaSingle;
|
|
42
|
-
if (maybeMedia && maybeMedia.type === _mediaSingle && (maybeMedia.attrs.layout === 'wrap-right' || maybeMedia.attrs.layout === 'wrap-left')) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
11
|
+
import { isMediaNode, isNodeBeforeMediaNode } from '@atlaskit/editor-common/utils';
|
|
49
12
|
export var shouldSkipGapCursor = function shouldSkipGapCursor(direction, state, $pos) {
|
|
13
|
+
var _$pos$nodeBefore;
|
|
50
14
|
var doc = state.doc,
|
|
51
15
|
schema = state.schema;
|
|
52
16
|
switch (direction) {
|
|
@@ -54,13 +18,48 @@ export var shouldSkipGapCursor = function shouldSkipGapCursor(direction, state,
|
|
|
54
18
|
if (atTheBeginningOfDoc(state)) {
|
|
55
19
|
return false;
|
|
56
20
|
}
|
|
57
|
-
return isPositionNearTableRow($pos, schema, 'before') || isTextBlockNearPos(doc, schema, $pos, -1);
|
|
21
|
+
return isPositionNearTableRow($pos, schema, 'before') || isTextBlockNearPos(doc, schema, $pos, -1) || isNodeBeforeMediaNode($pos, state);
|
|
58
22
|
case Direction.DOWN:
|
|
59
|
-
return atTheEndOfDoc(state) || isTextBlockNearPos(doc, schema, $pos, 1) || isPositionNearTableRow($pos, schema, 'after')
|
|
23
|
+
return atTheEndOfDoc(state) || isTextBlockNearPos(doc, schema, $pos, 1) || isPositionNearTableRow($pos, schema, 'after') || ((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.type.name) === 'text' && !$pos.nodeAfter // end of a paragraph
|
|
24
|
+
;
|
|
25
|
+
|
|
60
26
|
default:
|
|
61
27
|
return false;
|
|
62
28
|
}
|
|
63
29
|
};
|
|
30
|
+
|
|
31
|
+
// These cases should be handled using the handleMediaGapCursor function
|
|
32
|
+
function shouldHandleMediaGapCursor(dir, state) {
|
|
33
|
+
var _selection$$from$node;
|
|
34
|
+
var selection = state.selection;
|
|
35
|
+
var upArrowFromGapCursorIntoMedia = selection instanceof GapCursorSelection && dir === Direction.UP && selection.$from.nodeBefore && isMediaNode(selection.$from.nodeBefore);
|
|
36
|
+
var downArrowFromGapCursorIntoMediaGroup = selection instanceof GapCursorSelection && dir === Direction.DOWN && ((_selection$$from$node = selection.$from.nodeAfter) === null || _selection$$from$node === void 0 ? void 0 : _selection$$from$node.type.name) === 'mediaGroup';
|
|
37
|
+
return upArrowFromGapCursorIntoMedia || downArrowFromGapCursorIntoMediaGroup;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Handle media gap cursor for up/down arrow into media nodes
|
|
41
|
+
// Should check this case by using shouldHandleMediaGapCursor first
|
|
42
|
+
function handleMediaGapCursor(dir, state) {
|
|
43
|
+
var selection = state.selection,
|
|
44
|
+
tr = state.tr;
|
|
45
|
+
var $pos = isBackward(dir) ? selection.$from : selection.$to;
|
|
46
|
+
if (dir === Direction.UP && selection.$from.nodeBefore && isMediaNode(selection.$from.nodeBefore)) {
|
|
47
|
+
var _tr$doc$nodeAt;
|
|
48
|
+
var nodeBeforePos = findPositionOfNodeBefore(tr.selection);
|
|
49
|
+
if (nodeBeforePos && selection.side === 'right' && ((_tr$doc$nodeAt = tr.doc.nodeAt(nodeBeforePos)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) === 'mediaSingle') {
|
|
50
|
+
tr.setSelection(new NodeSelection(tr.doc.resolve(nodeBeforePos))).scrollIntoView();
|
|
51
|
+
} else if (nodeBeforePos || nodeBeforePos === 0) {
|
|
52
|
+
tr.setSelection(new GapCursorSelection(tr.doc.resolve(nodeBeforePos), Side.LEFT)).scrollIntoView();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (dir === Direction.DOWN && selection.$from.nodeAfter) {
|
|
56
|
+
var nodeAfterPos = selection.side === 'right' ? $pos.pos : $pos.pos + selection.$from.nodeAfter.nodeSize;
|
|
57
|
+
if (nodeAfterPos) {
|
|
58
|
+
tr.setSelection(new GapCursorSelection(tr.doc.resolve(nodeAfterPos), Side.LEFT)).scrollIntoView();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return tr;
|
|
62
|
+
}
|
|
64
63
|
export var arrow = function arrow(dir, endOfTextblock) {
|
|
65
64
|
return function (state, dispatch, view) {
|
|
66
65
|
var doc = state.doc,
|
|
@@ -89,13 +88,21 @@ export var arrow = function arrow(dir, endOfTextblock) {
|
|
|
89
88
|
if (selection.node.isInline) {
|
|
90
89
|
return false;
|
|
91
90
|
}
|
|
92
|
-
if (dir === Direction.UP || dir === Direction.DOWN) {
|
|
91
|
+
if (dir === Direction.UP && !atTheBeginningOfDoc(state) && !isNodeBeforeMediaNode($pos, state) || dir === Direction.DOWN) {
|
|
93
92
|
// We dont add gap cursor on node selections going up and down
|
|
93
|
+
// Except we do if we're going up for a block node which is the
|
|
94
|
+
// first node in the document OR the node before is a media node
|
|
94
95
|
return false;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
// Handle media gap cursor for up/down arrow into media nodes
|
|
100
|
+
if (shouldHandleMediaGapCursor(dir, state)) {
|
|
101
|
+
var updatedTr = handleMediaGapCursor(dir, state);
|
|
102
|
+
if (dispatch) {
|
|
103
|
+
dispatch(updatedTr);
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
// when jumping between block nodes at the same depth, we need to reverse cursor without changing ProseMirror position
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeSelection
|
|
1
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
2
2
|
export var mayGetStatusAtSelection = function mayGetStatusAtSelection(selection) {
|
|
3
3
|
if (selection && selection instanceof NodeSelection) {
|
|
4
4
|
var nodeSelection = selection;
|
|
@@ -8,21 +8,9 @@ export var mayGetStatusAtSelection = function mayGetStatusAtSelection(selection)
|
|
|
8
8
|
}
|
|
9
9
|
return null;
|
|
10
10
|
};
|
|
11
|
-
export var mayGetStatusAtPos = function mayGetStatusAtPos(pos, doc) {
|
|
12
|
-
if (pos) {
|
|
13
|
-
var node = doc.nodeAt(pos);
|
|
14
|
-
if (node && node.type.name === 'status') {
|
|
15
|
-
return node.attrs;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
};
|
|
20
11
|
export var isEmptyStatus = function isEmptyStatus(node) {
|
|
21
12
|
return node && (node.text && node.text.trim().length === 0 || node.text === '');
|
|
22
13
|
};
|
|
23
|
-
export var setSelectionNearPos = function setSelectionNearPos(tr, pos) {
|
|
24
|
-
return tr.setSelection(Selection.near(tr.doc.resolve(tr.mapping.map(pos))));
|
|
25
|
-
};
|
|
26
14
|
export var setNodeSelectionNearPos = function setNodeSelectionNearPos(tr, pos) {
|
|
27
15
|
return tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(pos)));
|
|
28
16
|
};
|
|
@@ -9,7 +9,7 @@ import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
|
|
|
9
9
|
import { DEFAULT_COLOR, getActiveColor } from '../utils/color';
|
|
10
10
|
import { getDisabledState } from '../utils/disabled';
|
|
11
11
|
export { DEFAULT_COLOR } from '../utils/color';
|
|
12
|
-
|
|
12
|
+
function createInitialPluginState(editorState, pluginConfig) {
|
|
13
13
|
var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
|
|
14
14
|
var palette = [{
|
|
15
15
|
value: defaultColor.color,
|
|
@@ -18,7 +18,7 @@ import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
|
18
18
|
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
19
19
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
20
20
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
21
|
-
import ColorPalette from '../../../../ui/ColorPalette';
|
|
21
|
+
import ColorPalette, { textPaletteTooltipMessages } from '../../../../ui/ColorPalette';
|
|
22
22
|
import Dropdown from '../../../../ui/Dropdown';
|
|
23
23
|
import { expandIconWrapperStyle, wrapperStyle, separatorStyles, triggerWrapperStyles } from '../../../../ui/styles';
|
|
24
24
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
@@ -222,14 +222,16 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
222
222
|
}, jsx("div", {
|
|
223
223
|
"data-testid": "text-color-palette"
|
|
224
224
|
}, jsx(ColorPalette, {
|
|
225
|
-
palette: palette,
|
|
226
225
|
onClick: function onClick(color) {
|
|
227
226
|
return _this2.changeTextColor(color, pluginState.disabled);
|
|
228
227
|
},
|
|
229
228
|
selectedColor: pluginState.color,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
paletteOptions: {
|
|
230
|
+
palette: palette,
|
|
231
|
+
hexToPaletteColor: hexToEditorTextPaletteColor,
|
|
232
|
+
paletteColorTooltipMessages: textPaletteTooltipMessages,
|
|
233
|
+
showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames
|
|
234
|
+
}
|
|
233
235
|
}))), jsx("span", {
|
|
234
236
|
css: separatorStyles
|
|
235
237
|
}));
|
|
@@ -17,10 +17,15 @@ function replaceTextUsingCaptureGroup(text) {
|
|
|
17
17
|
var _match = _slicedToArray(match, 4),
|
|
18
18
|
prefix = _match[1],
|
|
19
19
|
suffix = _match[3];
|
|
20
|
-
var replacement =
|
|
20
|
+
var replacement = text + (suffix || '');
|
|
21
21
|
var tr = state.tr,
|
|
22
22
|
$to = state.selection.$to;
|
|
23
|
-
|
|
23
|
+
var startPos = start + (prefix || '').length;
|
|
24
|
+
var safePos = Math.min(
|
|
25
|
+
// I know it is almost impossible to have a negative value at this point.
|
|
26
|
+
// But, this is JS #trustnoone
|
|
27
|
+
Math.max(startPos, 0), end);
|
|
28
|
+
tr.replaceWith(safePos, end, state.schema.text(replacement, $to.marks()));
|
|
24
29
|
tr.setSelection(Selection.near(tr.doc.resolve(tr.selection.to)));
|
|
25
30
|
return tr;
|
|
26
31
|
};
|
|
@@ -70,6 +75,7 @@ function createSingleQuotesRules() {
|
|
|
70
75
|
// apostrophe
|
|
71
76
|
createReplacementRule('’', /(\w+)(')(\w+)$/)];
|
|
72
77
|
}
|
|
78
|
+
|
|
73
79
|
/**
|
|
74
80
|
* Get replacement rules related to product
|
|
75
81
|
*/
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
2
2
|
import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
|
|
3
|
-
export var nodeLen = function nodeLen(node) {
|
|
4
|
-
return node.nodeType === 3 && node.nodeValue ? node.nodeValue.length : node.childNodes.length;
|
|
5
|
-
};
|
|
6
|
-
export var isIgnorable = function isIgnorable(dom) {
|
|
7
|
-
return dom.pmViewDesc && dom.pmViewDesc.size === 0;
|
|
8
|
-
};
|
|
9
|
-
export var isBlockNode = function isBlockNode(dom) {
|
|
10
|
-
var desc = dom.pmViewDesc;
|
|
11
|
-
return desc && desc.node && desc.node.isBlock;
|
|
12
|
-
};
|
|
13
|
-
export var domIndex = function domIndex(node) {
|
|
14
|
-
if (node) {
|
|
15
|
-
for (var index = 0;; index++) {
|
|
16
|
-
node = node.previousSibling;
|
|
17
|
-
if (!node) {
|
|
18
|
-
return index;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return;
|
|
23
|
-
};
|
|
24
3
|
export var hasCode = function hasCode(state, pos) {
|
|
25
4
|
var code = state.schema.marks.code;
|
|
26
5
|
var node = pos >= 0 && state.doc.nodeAt(pos);
|