@atlaskit/editor-core 180.1.0 → 181.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -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 +30 -3
- 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/pm-plugins/decorations.js +2 -35
- package/dist/cjs/plugins/type-ahead/utils.js +3 -22
- 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 +25 -3
- 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/pm-plugins/decorations.js +0 -35
- package/dist/es2019/plugins/type-ahead/utils.js +0 -23
- 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 +29 -3
- 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/pm-plugins/decorations.js +0 -31
- package/dist/esm/plugins/type-ahead/utils.js +2 -20
- 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/pm-plugins/decorations.d.ts +0 -10
- package/dist/types/plugins/type-ahead/utils.d.ts +1 -2
- 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
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { fragment } from '@atlaskit/adf-schema';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { pluginKey } from './plugin-key';
|
|
4
2
|
import { createPlugin as createFragmentMarkConsistencyPlugin } from './pm-plugins/fragment-consistency';
|
|
5
|
-
export function createPlugin() {
|
|
6
|
-
return new SafePlugin({
|
|
7
|
-
key: pluginKey
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
3
|
var fragmentMarkPlugin = function fragmentMarkPlugin() {
|
|
11
4
|
return {
|
|
12
5
|
name: 'fragmentPlugin',
|
|
@@ -10,7 +10,4 @@ export var openHelpCommand = function openHelpCommand(tr, dispatch) {
|
|
|
10
10
|
export var closeHelpCommand = function closeHelpCommand(tr, dispatch) {
|
|
11
11
|
tr = tr.setMeta(pluginKey, false);
|
|
12
12
|
dispatch(tr);
|
|
13
|
-
};
|
|
14
|
-
export var stopPropagationCommand = function stopPropagationCommand(e) {
|
|
15
|
-
return e.stopPropagation();
|
|
16
13
|
};
|
|
@@ -9,15 +9,51 @@ import { isDroppedFile } from '../../../utils/drag-drop';
|
|
|
9
9
|
import { canInsertMedia, isMediaSelected } from '../utils';
|
|
10
10
|
import { insertExternalImage, startImageUpload } from './commands';
|
|
11
11
|
import { stateKey } from './plugin-key';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Microsoft Office includes a screenshot image when copying text content.
|
|
15
|
+
*
|
|
16
|
+
* This function determines whether or not we can ignore the image if it
|
|
17
|
+
* came from MS Office. We do this by checking for
|
|
18
|
+
*
|
|
19
|
+
* - plain text
|
|
20
|
+
* - HTML text which includes the MS Office namespace
|
|
21
|
+
* - the number of files and the file name/type
|
|
22
|
+
*
|
|
23
|
+
* It is easy to manually verify this using by using Office on Mac
|
|
24
|
+
* (or Excel if on Windows) and pasting into
|
|
25
|
+
* https://evercoder.github.io/clipboard-inspector/
|
|
26
|
+
*
|
|
27
|
+
* Note: image content in Word is stored in the `text/html` portion
|
|
28
|
+
* of the clipboard, not under `files` attachment like the screenshot.
|
|
29
|
+
*
|
|
30
|
+
* @returns boolean True if the paste event contains a screenshot from MS Office
|
|
31
|
+
*/
|
|
32
|
+
var hasScreenshotImageFromMSOffice = function hasScreenshotImageFromMSOffice(ev) {
|
|
33
|
+
var _ref = ev,
|
|
34
|
+
clipboardData = _ref.clipboardData;
|
|
35
|
+
if (!clipboardData || clipboardData.files.length !== 1) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
var textPlain = !!clipboardData.getData('text/plain');
|
|
39
|
+
var textHtml = clipboardData.getData('text/html');
|
|
40
|
+
var isOfficeXMLNamespace = textHtml.includes('urn:schemas-microsoft-com:office:office');
|
|
41
|
+
var file = clipboardData.files[0];
|
|
42
|
+
var isImagePNG = file.type === 'image/png' && file.name === 'image.png';
|
|
43
|
+
return isImagePNG && textPlain && isOfficeXMLNamespace;
|
|
44
|
+
};
|
|
12
45
|
var createDOMHandler = function createDOMHandler(pred, eventName) {
|
|
13
46
|
return function (view, event) {
|
|
14
47
|
if (!pred(event)) {
|
|
15
48
|
return false;
|
|
16
49
|
}
|
|
17
|
-
event
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
var shouldUpload = !hasScreenshotImageFromMSOffice(event);
|
|
51
|
+
if (shouldUpload) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
startImageUpload(event)(view.state, view.dispatch);
|
|
55
|
+
}
|
|
56
|
+
return shouldUpload;
|
|
21
57
|
};
|
|
22
58
|
};
|
|
23
59
|
var getNewActiveUpload = function getNewActiveUpload(tr, pluginState) {
|
|
@@ -29,9 +65,9 @@ var getNewActiveUpload = function getNewActiveUpload(tr, pluginState) {
|
|
|
29
65
|
}
|
|
30
66
|
return pluginState.activeUpload;
|
|
31
67
|
};
|
|
32
|
-
export var createPlugin = function createPlugin(
|
|
33
|
-
var dispatch =
|
|
34
|
-
providerFactory =
|
|
68
|
+
export var createPlugin = function createPlugin(_ref2) {
|
|
69
|
+
var dispatch = _ref2.dispatch,
|
|
70
|
+
providerFactory = _ref2.providerFactory;
|
|
35
71
|
var uploadHandler;
|
|
36
72
|
return new SafePlugin({
|
|
37
73
|
state: {
|
|
@@ -61,7 +97,7 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
61
97
|
key: stateKey,
|
|
62
98
|
view: function view() {
|
|
63
99
|
var handleProvider = /*#__PURE__*/function () {
|
|
64
|
-
var
|
|
100
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(name, provider) {
|
|
65
101
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
102
|
while (1) {
|
|
67
103
|
switch (_context.prev = _context.next) {
|
|
@@ -91,7 +127,7 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
91
127
|
}, _callee, null, [[2, 8]]);
|
|
92
128
|
}));
|
|
93
129
|
return function handleProvider(_x, _x2) {
|
|
94
|
-
return
|
|
130
|
+
return _ref3.apply(this, arguments);
|
|
95
131
|
};
|
|
96
132
|
}();
|
|
97
133
|
providerFactory.subscribe('imageUploadProvider', handleProvider);
|
|
@@ -103,9 +139,12 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
103
139
|
// if we've add a new upload to the state, execute the uploadHandler
|
|
104
140
|
var oldState = stateKey.getState(prevState);
|
|
105
141
|
if (currentState.activeUpload !== oldState.activeUpload && currentState.activeUpload && uploadHandler) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
142
|
+
var event = currentState.activeUpload.event;
|
|
143
|
+
if (!event || !hasScreenshotImageFromMSOffice(event)) {
|
|
144
|
+
uploadHandler(event, function (options) {
|
|
145
|
+
return insertExternalImage(options)(view.state, view.dispatch);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
109
148
|
}
|
|
110
149
|
},
|
|
111
150
|
destroy: function destroy() {
|
|
@@ -2,10 +2,19 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
|
-
import { N40A, N50A } from '@atlaskit/theme/colors';
|
|
5
|
+
import { N40A, N50A, DN70, DN80 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { themed } from '@atlaskit/theme/components';
|
|
6
7
|
import { columnLayoutSharedStyle, LAYOUT_SECTION_MARGIN, LAYOUT_COLUMN_PADDING } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { gridMediumMaxWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akLayoutGutterOffset, akEditorSwoopCubicBezier, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
9
|
import { TableCssClassName } from '@atlaskit/editor-plugin-table/types';
|
|
9
10
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugin-table/ui/consts';
|
|
10
11
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
11
|
-
export var layoutStyles =
|
|
12
|
+
export var layoutStyles = function layoutStyles(props) {
|
|
13
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", " [data-layout-section] {\n margin: ", "px -", "px 0;\n transition: border-color 0.3s ", ";\n cursor: pointer;\n\n /* Inner cursor located 26px from left */\n [data-layout-column] {\n flex: 1;\n min-width: 0;\n border: ", "px solid\n ", ";\n border-radius: 4px;\n padding: ", "px;\n box-sizing: border-box;\n\n > div {\n > :not(style):first-child,\n > style:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + *,\n > style:first-child + .ProseMirror-gapcursor + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + *,\n > style:first-child + .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n > .embedCardView-content-wrap:first-of-type .rich-media-item {\n margin-top: 0;\n }\n\n > .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child\n + .mediaSingleView-content-wrap\n .rich-media-item,\n > style:first-child\n + .ProseMirror-gapcursor.-right\n + .mediaSingleView-content-wrap\n .rich-media-item,\n > .ProseMirror-gapcursor.-right:first-of-type\n + .embedCardView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item,\n > style:first-child\n + .ProseMirror-gapcursor\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n > [data-node-type='decisionList'] {\n li:first-of-type [data-decision-wrapper] {\n margin-top: 0;\n }\n }\n }\n\n /* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n [data-layout-content] {\n height: 100%;\n cursor: text;\n }\n }\n\n [data-layout-column] + [data-layout-column] {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n [data-layout-column] + [data-layout-column] {\n margin-left: 0;\n }\n }\n\n // TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n // This is because the default state already uses the same token and, as such, the hover style won't change anything.\n // https://product-fabric.atlassian.net/browse/DSP-4441\n /* Shows the border when cursor is inside a layout */\n &.selected [data-layout-column],\n &:hover [data-layout-column] {\n border: ", "px solid\n ", ";\n }\n\n &.selected.danger > [data-layout-column] {\n background-color: ", ";\n border-color: ", ";\n }\n\n &.", ":not(.danger) {\n [data-layout-column] {\n ", "\n }\n }\n }\n }\n\n .fabric-editor--full-width-mode .ProseMirror {\n [data-layout-section] {\n .", " {\n margin: 0 ", "px;\n }\n }\n }\n"])), columnLayoutSharedStyle, gridSize() - 1, akLayoutGutterOffset, akEditorSwoopCubicBezier, akEditorSelectedBorderSize, themed({
|
|
14
|
+
light: "var(--ds-border, ".concat(N40A, ")"),
|
|
15
|
+
dark: "var(--ds-border, ".concat(DN70, ")")
|
|
16
|
+
})(props), LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, akEditorSelectedBorderSize, themed({
|
|
17
|
+
light: "var(--ds-border, ".concat(N50A, ")"),
|
|
18
|
+
dark: "var(--ds-border, ".concat(DN80, ")")
|
|
19
|
+
})(props), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode);
|
|
20
|
+
};
|
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import { findParentNodeClosestToPos } from 'prosemirror-utils';
|
|
2
2
|
import { isListNode, isListItemNode } from './node';
|
|
3
|
-
export function findFirstNestedList($pos) {
|
|
4
|
-
var currentNode = $pos.doc.nodeAt($pos.pos);
|
|
5
|
-
var currentListItemPos = null;
|
|
6
|
-
if (isListItemNode(currentNode)) {
|
|
7
|
-
currentListItemPos = $pos.pos;
|
|
8
|
-
} else {
|
|
9
|
-
var result = findParentNodeClosestToPos($pos, isListItemNode);
|
|
10
|
-
currentListItemPos = (result === null || result === void 0 ? void 0 : result.pos) || null;
|
|
11
|
-
}
|
|
12
|
-
if (!currentListItemPos) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
var currentListItemNode = $pos.doc.nodeAt(currentListItemPos);
|
|
16
|
-
if (!currentListItemNode) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
var lastListItemChild = currentListItemNode.child(currentListItemNode.childCount - 1);
|
|
20
|
-
if (!isListNode(lastListItemChild)) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
var firstNestedListPosition = currentListItemNode.nodeSize - lastListItemChild.nodeSize;
|
|
24
|
-
var firstNestedListNode = $pos.doc.nodeAt(firstNestedListPosition);
|
|
25
|
-
if (!isListNode(firstNestedListNode)) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return $pos.doc.resolve(firstNestedListPosition);
|
|
29
|
-
}
|
|
30
3
|
export function findFirstParentListNode($pos) {
|
|
31
4
|
var currentNode = $pos.doc.nodeAt($pos.pos);
|
|
32
5
|
var listNodePosition = null;
|
|
@@ -15,29 +15,6 @@ export var getListLiftTarget = function getListLiftTarget(resPos) {
|
|
|
15
15
|
}
|
|
16
16
|
return target - 1;
|
|
17
17
|
};
|
|
18
|
-
export var getNextSiblingListItemPosition = function getNextSiblingListItemPosition($pos) {
|
|
19
|
-
var _$pos$doc$nodeAt;
|
|
20
|
-
var target = $pos.depth;
|
|
21
|
-
var found = false;
|
|
22
|
-
for (var i = $pos.depth; i > 0; i--) {
|
|
23
|
-
var node = $pos.node(i);
|
|
24
|
-
if (isListItemNode(node)) {
|
|
25
|
-
target = i;
|
|
26
|
-
found = true;
|
|
27
|
-
}
|
|
28
|
-
if (found) {
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
var listItemPosition = target - 1;
|
|
33
|
-
var listItemNodePosition = ((_$pos$doc$nodeAt = $pos.doc.nodeAt(listItemPosition)) === null || _$pos$doc$nodeAt === void 0 ? void 0 : _$pos$doc$nodeAt.nodeSize) || 0;
|
|
34
|
-
var nextListItemPosition = listItemPosition + listItemNodePosition;
|
|
35
|
-
var nextListItemNode = $pos.doc.nodeAt(nextListItemPosition);
|
|
36
|
-
if (nextListItemNode) {
|
|
37
|
-
return $pos.doc.resolve(nextListItemPosition);
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
};
|
|
41
18
|
export var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
|
|
42
19
|
var tr = _ref.tr,
|
|
43
20
|
maxIndentation = _ref.maxIndentation;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Fragment } from 'prosemirror-model';
|
|
2
|
-
export function isDocumentNode(node) {
|
|
3
|
-
return Boolean(node && node.type && node.type.name === 'doc');
|
|
4
|
-
}
|
|
5
2
|
export function isListNode(node) {
|
|
6
3
|
return Boolean(node && node.type && ['orderedList', 'bulletList'].includes(node.type.name));
|
|
7
4
|
}
|
|
@@ -14,7 +11,7 @@ export function isListItemNode(node) {
|
|
|
14
11
|
export function isBulletList(node) {
|
|
15
12
|
return Boolean(node && node.type && 'bulletList' === node.type.name);
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
function isListNodeValidContent(node) {
|
|
18
15
|
var bulletList = node.type.schema.nodes.bulletList;
|
|
19
16
|
if (!bulletList) {
|
|
20
17
|
return false;
|
|
@@ -107,12 +107,12 @@ export var normalizeListItemsSelection = function normalizeListItemsSelection(_r
|
|
|
107
107
|
var anchor = resolvePositionToEndOfListItem($to);
|
|
108
108
|
return new TextSelection(anchor, head);
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
|
|
111
111
|
var fromRange = $pos.blockRange($pos, isListItemNode);
|
|
112
112
|
var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
|
|
113
113
|
return fromPosition;
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
|
|
116
116
|
var toRange = $pos.blockRange($pos, isListItemNode);
|
|
117
117
|
var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
|
|
118
118
|
return toPosition;
|
|
@@ -126,14 +126,4 @@ export var createListNodeRange = function createListNodeRange(_ref2) {
|
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
return range;
|
|
129
|
-
};
|
|
130
|
-
export var createListItemNodeRange = function createListItemNodeRange(_ref3) {
|
|
131
|
-
var selection = _ref3.selection;
|
|
132
|
-
var $from = selection.$from,
|
|
133
|
-
$to = selection.$to;
|
|
134
|
-
var range = $from.blockRange($to, isListItemNode);
|
|
135
|
-
if (!range) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
return range;
|
|
139
129
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { deleteSelection, splitBlock } from 'prosemirror-commands';
|
|
2
|
-
import { Fragment } from 'prosemirror-model';
|
|
3
2
|
import { NodeSelection } from 'prosemirror-state';
|
|
4
3
|
import { findPositionOfNodeBefore } from 'prosemirror-utils';
|
|
5
4
|
import { createParagraphNear, createNewParagraphBelow } from '../../../commands';
|
|
@@ -80,7 +79,7 @@ export var isInsidePotentialEmptyParagraph = function isInsidePotentialEmptyPara
|
|
|
80
79
|
var $from = state.selection.$from;
|
|
81
80
|
return $from.parent.type === state.schema.nodes.paragraph && atTheBeginningOfBlock(state) && atTheEndOfBlock(state);
|
|
82
81
|
};
|
|
83
|
-
|
|
82
|
+
var posOfMediaGroupBelow = function posOfMediaGroupBelow(state, $pos) {
|
|
84
83
|
var prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
85
84
|
var adjacentPos;
|
|
86
85
|
var adjacentNode;
|
|
@@ -105,21 +104,6 @@ export var posOfParentMediaGroup = function posOfParentMediaGroup(state, $pos) {
|
|
|
105
104
|
}
|
|
106
105
|
return;
|
|
107
106
|
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The function will return the position after current selection where mediaGroup can be inserted.
|
|
111
|
-
*/
|
|
112
|
-
export function endPositionForMedia(state, resolvedPos) {
|
|
113
|
-
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
114
|
-
var i = resolvedPos.depth;
|
|
115
|
-
for (; i > 1; i--) {
|
|
116
|
-
var nodeType = resolvedPos.node(i).type;
|
|
117
|
-
if (nodeType.validContent(Fragment.from(mediaGroup.create()))) {
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return resolvedPos.end(i) + 1;
|
|
122
|
-
}
|
|
123
107
|
export var removeMediaNode = function removeMediaNode(view, node, getPos) {
|
|
124
108
|
var id = node.attrs.id;
|
|
125
109
|
var state = view.state;
|
|
@@ -1,28 +1,109 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React, { useEffect, useState } from 'react';
|
|
5
|
+
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
6
|
import Mention from '../ui/Mention';
|
|
3
7
|
import { useIntl } from 'react-intl-next';
|
|
4
8
|
import { messages } from '../messages';
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
import { isResolvingMentionProvider, MentionNameStatus } from '@atlaskit/mention';
|
|
10
|
+
import { isPromise } from '@atlaskit/mention/types';
|
|
11
|
+
var UNKNOWN_USER_ID = '_|unknown|_';
|
|
12
|
+
var MentionAssistiveTextComponent = function MentionAssistiveTextComponent(_ref) {
|
|
13
|
+
var id = _ref.id,
|
|
14
|
+
text = _ref.text,
|
|
15
|
+
providers = _ref.providers,
|
|
16
|
+
accessLevel = _ref.accessLevel,
|
|
17
|
+
mentionProvider = _ref.mentionProvider;
|
|
18
|
+
var _useState = useState(text),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
resolvedName = _useState2[0],
|
|
21
|
+
setResolvedName = _useState2[1];
|
|
7
22
|
var intl = useIntl();
|
|
8
|
-
|
|
23
|
+
var processName = function processName(name) {
|
|
24
|
+
if (name.status === MentionNameStatus.OK) {
|
|
25
|
+
return "@".concat(name.name || '');
|
|
26
|
+
} else {
|
|
27
|
+
return "@".concat(UNKNOWN_USER_ID);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
if (mentionProvider) {
|
|
32
|
+
mentionProvider.then( /*#__PURE__*/function () {
|
|
33
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(provider) {
|
|
34
|
+
var nameDetail;
|
|
35
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) {
|
|
37
|
+
switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
if (!(!text && isResolvingMentionProvider(provider))) {
|
|
40
|
+
_context.next = 13;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
nameDetail = provider.resolveMentionName(id);
|
|
44
|
+
if (!isPromise(nameDetail)) {
|
|
45
|
+
_context.next = 10;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
_context.t0 = processName;
|
|
49
|
+
_context.next = 6;
|
|
50
|
+
return nameDetail;
|
|
51
|
+
case 6:
|
|
52
|
+
_context.t1 = _context.sent;
|
|
53
|
+
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
54
|
+
case 10:
|
|
55
|
+
return _context.abrupt("return", processName(nameDetail));
|
|
56
|
+
case 11:
|
|
57
|
+
_context.next = 14;
|
|
58
|
+
break;
|
|
59
|
+
case 13:
|
|
60
|
+
return _context.abrupt("return", text);
|
|
61
|
+
case 14:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, _callee);
|
|
67
|
+
}));
|
|
68
|
+
return function (_x) {
|
|
69
|
+
return _ref2.apply(this, arguments);
|
|
70
|
+
};
|
|
71
|
+
}()).then(function (resolvedName) {
|
|
72
|
+
setResolvedName(resolvedName);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, [id, text, mentionProvider]);
|
|
76
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
9
77
|
className: 'assistive'
|
|
10
|
-
}, "".concat(intl.formatMessage(messages.mentionsNodeLabel), " ").concat(
|
|
11
|
-
|
|
78
|
+
}, "".concat(intl.formatMessage(messages.mentionsNodeLabel), " ").concat(resolvedName)), /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Mention, {
|
|
81
|
+
id: id,
|
|
82
|
+
text: resolvedName,
|
|
83
|
+
accessLevel: accessLevel,
|
|
84
|
+
providers: providers
|
|
85
|
+
})));
|
|
86
|
+
};
|
|
12
87
|
export var MentionNodeView = function MentionNodeView(props) {
|
|
13
88
|
var providerFactory = props.providerFactory;
|
|
14
89
|
var _props$node$attrs = props.node.attrs,
|
|
15
90
|
id = _props$node$attrs.id,
|
|
16
91
|
text = _props$node$attrs.text,
|
|
17
92
|
accessLevel = _props$node$attrs.accessLevel;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
93
|
+
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
94
|
+
var _ref3 = providers,
|
|
95
|
+
mentionProvider = _ref3.mentionProvider;
|
|
96
|
+
return /*#__PURE__*/React.createElement(MentionAssistiveTextComponent, {
|
|
97
|
+
mentionProvider: mentionProvider,
|
|
98
|
+
id: id,
|
|
99
|
+
text: text,
|
|
100
|
+
providers: providerFactory,
|
|
101
|
+
accessLevel: accessLevel
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
105
|
+
providers: ['mentionProvider', 'profilecardProvider'],
|
|
106
|
+
providerFactory: providerFactory,
|
|
107
|
+
renderNode: renderAssistiveTextWithProviders
|
|
108
|
+
});
|
|
28
109
|
};
|
|
@@ -11,7 +11,6 @@ import { Fragment } from 'prosemirror-model';
|
|
|
11
11
|
import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
12
12
|
import { MENTION_ITEM_HEIGHT, MentionItem } from '@atlaskit/mention/item';
|
|
13
13
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
14
|
-
import { TeamMentionHighlight, TeamMentionHighlightController } from '@atlaskit/mention/spotlight';
|
|
15
14
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteExposurePayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from '../analytics';
|
|
16
15
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../ui/InviteItem';
|
|
17
16
|
import { isInviteItem, isTeamType, isTeamStats, shouldKeepInviteItem } from '../utils';
|
|
@@ -130,9 +129,7 @@ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAh
|
|
|
130
129
|
fireEvent(payload);
|
|
131
130
|
};
|
|
132
131
|
};
|
|
133
|
-
|
|
134
|
-
return !!(p.mentionTypeaheadHighlightEnabled && p.mentionTypeaheadCreateTeamPath);
|
|
135
|
-
};
|
|
132
|
+
|
|
136
133
|
/**
|
|
137
134
|
* When a team mention is selected, we render a team link and list of member/user mentions
|
|
138
135
|
* in editor content
|
|
@@ -198,19 +195,6 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
198
195
|
if (CustomHighlightComponent) {
|
|
199
196
|
return /*#__PURE__*/React.createElement(CustomHighlightComponent, null);
|
|
200
197
|
}
|
|
201
|
-
var pluginState = getMentionPluginState(state);
|
|
202
|
-
var provider = pluginState.mentionProvider;
|
|
203
|
-
if (provider) {
|
|
204
|
-
var teamMentionProvider = provider;
|
|
205
|
-
if (isTeamMentionProvider(teamMentionProvider) && teamMentionProvider.mentionTypeaheadHighlightEnabled()) {
|
|
206
|
-
return /*#__PURE__*/React.createElement(TeamMentionHighlight, {
|
|
207
|
-
createTeamLink: teamMentionProvider.mentionTypeaheadCreateTeamPath(),
|
|
208
|
-
onClose: function onClose() {
|
|
209
|
-
return TeamMentionHighlightController.registerClosed();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
198
|
return null;
|
|
215
199
|
},
|
|
216
200
|
getItems: function getItems(_ref7) {
|
|
@@ -312,7 +296,6 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
312
296
|
}), query, pluginState.contextIdentifierProvider));
|
|
313
297
|
sessionId = uuid();
|
|
314
298
|
if (mentionProvider && isTeamType(userType)) {
|
|
315
|
-
TeamMentionHighlightController.registerTeamMention();
|
|
316
299
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
317
300
|
}
|
|
318
301
|
|
|
@@ -5,9 +5,8 @@ import AddIcon from '@atlaskit/icon/glyph/add';
|
|
|
5
5
|
import { N300 } from '@atlaskit/theme/colors';
|
|
6
6
|
import React, { useCallback, useEffect } from 'react';
|
|
7
7
|
import { FormattedMessage, injectIntl } from 'react-intl-next';
|
|
8
|
-
import { avatarStyle, capitalizedStyle, mentionItemStyle, nameSectionStyle, rowStyle,
|
|
8
|
+
import { avatarStyle, capitalizedStyle, mentionItemStyle, nameSectionStyle, rowStyle, mentionItemSelectedStyle } from './styles';
|
|
9
9
|
import { messages } from '../../messages';
|
|
10
|
-
export var INVITE_ITEM_MIN_HEIGHT = AVATAR_HEIGHT + ROW_SIDE_PADDING * 2;
|
|
11
10
|
export var INVITE_ITEM_DESCRIPTION = {
|
|
12
11
|
id: 'invite-teammate'
|
|
13
12
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { setWindowHeight } from './commands';
|
|
3
3
|
import { createPluginState, mobileDimensionsPluginKey } from './plugin-factory';
|
|
4
|
-
|
|
5
|
-
// 44 pixels squared is the minimum size for a tap target as per Apple's UX design guidelines
|
|
6
|
-
export var MIN_TAP_SIZE_PX = 44;
|
|
7
4
|
var getInitialState = function getInitialState() {
|
|
8
5
|
return {
|
|
9
6
|
keyboardHeight: -1,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
2
|
var pastePlugin = function pastePlugin(_ref) {
|
|
3
3
|
var cardOptions = _ref.cardOptions,
|
|
4
|
-
sanitizePrivateContent = _ref.sanitizePrivateContent
|
|
5
|
-
plainTextPasteLinkification = _ref.plainTextPasteLinkification;
|
|
4
|
+
sanitizePrivateContent = _ref.sanitizePrivateContent;
|
|
6
5
|
return {
|
|
7
6
|
name: 'paste',
|
|
8
7
|
pmPlugins: function pmPlugins() {
|