@atlaskit/editor-core 148.0.0 → 149.0.3
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 +110 -0
- package/dist/cjs/create-editor/create-plugins-list.js +6 -1
- package/dist/cjs/editor.js +1 -4
- package/dist/cjs/index.js +24 -40
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/cjs/plugins/analytics/plugin.js +9 -7
- package/dist/cjs/plugins/analytics/types/enums.js +5 -0
- package/dist/cjs/plugins/analytics/types/type-ahead.js +5 -0
- package/dist/cjs/plugins/block-type/messages.js +10 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/collab-edit/participants.js +15 -0
- package/dist/cjs/plugins/collab-edit/plugin-state.js +14 -0
- package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/cjs/plugins/collab-edit/ui/avatars.js +19 -2
- package/dist/cjs/plugins/collab-edit/utils.js +42 -2
- package/dist/cjs/plugins/date/actions.js +4 -2
- package/dist/cjs/plugins/date/index.js +1 -1
- package/dist/cjs/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/cjs/plugins/emoji/index.js +143 -120
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -14
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +3 -7
- package/dist/cjs/plugins/extension/actions.js +16 -16
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/cjs/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -14
- package/dist/cjs/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +35 -0
- package/dist/cjs/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +38 -0
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -7
- package/dist/cjs/plugins/help-dialog/ui/index.js +12 -18
- package/dist/cjs/plugins/help-dialog/ui/styles.js +2 -6
- package/dist/cjs/plugins/hyperlink/index.js +4 -10
- package/dist/cjs/plugins/insert-block/index.js +9 -8
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +7 -3
- package/dist/cjs/plugins/list/index.js +5 -0
- package/dist/cjs/plugins/macro/actions.js +14 -14
- package/dist/cjs/plugins/media/index.js +1 -0
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +26 -14
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +86 -0
- package/dist/cjs/plugins/media/toolbar/index.js +161 -44
- package/dist/cjs/plugins/media/toolbar/utils.js +77 -0
- package/dist/cjs/plugins/mentions/index.js +57 -602
- package/dist/cjs/plugins/mentions/pm-plugins/key.js +11 -0
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +162 -0
- package/dist/cjs/plugins/mentions/pm-plugins/utils.js +12 -0
- package/dist/cjs/plugins/mentions/type-ahead/index.js +449 -0
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +3 -1
- package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +8 -3
- package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +3 -3
- package/dist/cjs/plugins/mentions/utils.js +24 -2
- package/dist/cjs/plugins/panel/index.js +46 -13
- package/dist/cjs/plugins/panel/nodeviews/panel.js +39 -25
- package/dist/cjs/plugins/panel/toolbar.js +94 -6
- package/dist/cjs/plugins/panel/toolbar.test.js +149 -16
- package/dist/cjs/plugins/paste/handlers.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/cjs/plugins/placeholder/index.js +6 -0
- package/dist/cjs/plugins/quick-insert/api.js +30 -0
- package/dist/cjs/plugins/quick-insert/assets/custom-panel.js +55 -0
- package/dist/cjs/plugins/quick-insert/assets/index.js +14 -1
- package/dist/cjs/plugins/quick-insert/index.js +10 -24
- package/dist/cjs/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/rule/index.js +1 -25
- package/dist/cjs/plugins/scroll-into-view/index.js +1 -4
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/cjs/plugins/status/actions.js +5 -2
- package/dist/cjs/plugins/status/plugin.js +1 -1
- package/dist/cjs/plugins/table/commands/selection.js +24 -24
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +3 -1
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +3 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/cjs/plugins/type-ahead/api.js +243 -0
- package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +238 -0
- package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +30 -0
- package/dist/cjs/plugins/type-ahead/commands/update-query.js +16 -18
- package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +36 -0
- package/dist/cjs/plugins/type-ahead/constants.js +25 -0
- package/dist/cjs/plugins/type-ahead/index.js +183 -52
- package/dist/cjs/plugins/type-ahead/insert-utils.js +132 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +12 -9
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +238 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +20 -40
- package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +28 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +79 -424
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +188 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +26 -0
- package/dist/cjs/plugins/type-ahead/stats-modifier.js +49 -0
- package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +18 -0
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +51 -0
- package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +24 -0
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +77 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +325 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +195 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +141 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +141 -0
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +151 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +118 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +132 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +61 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +50 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +70 -0
- package/dist/cjs/plugins/type-ahead/utils.js +127 -0
- package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
- package/dist/cjs/plugins/view-update-subscription/index.js +19 -14
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
- package/dist/cjs/plugins/view-update-subscription/subscribe/type-ahead-updates.js +46 -0
- package/dist/cjs/test-utils.js +17 -0
- package/dist/cjs/types/empty-state-handler.js +5 -0
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +4 -21
- package/dist/cjs/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +16 -23
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +11 -4
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/cjs/ui/PanelTextInput/index.js +1 -3
- package/dist/cjs/utils/compare.js +7 -7
- package/dist/cjs/utils/index.js +7 -8
- package/dist/cjs/utils/rich-media-utils.js +2 -2
- package/dist/cjs/utils/selection.js +6 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +6 -1
- package/dist/es2019/editor.js +1 -4
- package/dist/es2019/index.js +4 -6
- package/dist/es2019/labs/next/presets/default.js +2 -2
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/es2019/plugins/analytics/plugin.js +5 -1
- package/dist/es2019/plugins/analytics/types/enums.js +5 -0
- package/dist/es2019/plugins/analytics/types/type-ahead.js +1 -0
- package/dist/es2019/plugins/block-type/messages.js +10 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/es2019/plugins/collab-edit/participants.js +14 -0
- package/dist/es2019/plugins/collab-edit/plugin-state.js +17 -1
- package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/es2019/plugins/collab-edit/ui/avatars.js +17 -2
- package/dist/es2019/plugins/collab-edit/utils.js +34 -0
- package/dist/es2019/plugins/date/actions.js +4 -2
- package/dist/es2019/plugins/date/index.js +1 -1
- package/dist/es2019/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/es2019/plugins/emoji/index.js +169 -146
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -11
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +3 -6
- package/dist/es2019/plugins/extension/actions.js +16 -16
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/es2019/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
- package/dist/es2019/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/es2019/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
- package/dist/es2019/plugins/help-dialog/ui/index.js +20 -26
- package/dist/es2019/plugins/help-dialog/ui/styles.js +2 -2
- package/dist/es2019/plugins/hyperlink/index.js +4 -12
- package/dist/es2019/plugins/insert-block/index.js +4 -4
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
- package/dist/es2019/plugins/list/index.js +20 -14
- package/dist/es2019/plugins/macro/actions.js +14 -14
- package/dist/es2019/plugins/media/index.js +1 -0
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +27 -12
- package/dist/es2019/plugins/media/styles.js +7 -2
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +59 -0
- package/dist/es2019/plugins/media/toolbar/index.js +158 -42
- package/dist/es2019/plugins/media/toolbar/utils.js +32 -0
- package/dist/es2019/plugins/mentions/index.js +34 -536
- package/dist/es2019/plugins/mentions/pm-plugins/key.js +2 -0
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +138 -0
- package/dist/es2019/plugins/mentions/pm-plugins/utils.js +4 -0
- package/dist/es2019/plugins/mentions/type-ahead/index.js +394 -0
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +4 -2
- package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +2 -2
- package/dist/es2019/plugins/mentions/utils.js +20 -1
- package/dist/es2019/plugins/panel/index.js +95 -62
- package/dist/es2019/plugins/panel/nodeviews/panel.js +7 -1
- package/dist/es2019/plugins/panel/toolbar.js +90 -6
- package/dist/es2019/plugins/panel/toolbar.test.js +131 -14
- package/dist/es2019/plugins/paste/handlers.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/es2019/plugins/placeholder/index.js +5 -0
- package/dist/es2019/plugins/quick-insert/api.js +18 -0
- package/dist/es2019/plugins/quick-insert/assets/custom-panel.js +45 -0
- package/dist/es2019/plugins/quick-insert/assets/index.js +6 -0
- package/dist/es2019/plugins/quick-insert/index.js +12 -23
- package/dist/es2019/plugins/quick-insert/search.js +1 -3
- package/dist/es2019/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/rule/index.js +1 -22
- package/dist/es2019/plugins/scroll-into-view/index.js +1 -3
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/es2019/plugins/status/actions.js +5 -2
- package/dist/es2019/plugins/status/plugin.js +1 -1
- package/dist/es2019/plugins/table/commands/selection.js +25 -25
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/es2019/plugins/type-ahead/api.js +224 -0
- package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +222 -0
- package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +19 -0
- package/dist/es2019/plugins/type-ahead/commands/update-query.js +17 -15
- package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +25 -0
- package/dist/es2019/plugins/type-ahead/constants.js +15 -0
- package/dist/es2019/plugins/type-ahead/index.js +203 -78
- package/dist/es2019/plugins/type-ahead/insert-utils.js +119 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +11 -8
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +211 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +18 -32
- package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +19 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +81 -401
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +165 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +16 -0
- package/dist/es2019/plugins/type-ahead/stats-modifier.js +41 -0
- package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +40 -0
- package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +11 -0
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +307 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +163 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +136 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +120 -0
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +110 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +97 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +126 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +43 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +41 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +53 -0
- package/dist/es2019/plugins/type-ahead/utils.js +93 -0
- package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +29 -2
- package/dist/es2019/plugins/view-update-subscription/index.js +19 -14
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +9 -3
- package/dist/es2019/plugins/view-update-subscription/subscribe/type-ahead-updates.js +34 -0
- package/dist/es2019/test-utils.js +7 -0
- package/dist/es2019/types/empty-state-handler.js +1 -0
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +4 -8
- package/dist/es2019/ui/ConfigPanel/transformers.js +9 -9
- package/dist/es2019/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +20 -21
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +9 -2
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/es2019/ui/PanelTextInput/index.js +1 -3
- package/dist/es2019/utils/compare.js +7 -7
- package/dist/es2019/utils/index.js +7 -8
- package/dist/es2019/utils/rich-media-utils.js +2 -2
- package/dist/es2019/utils/selection.js +6 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +6 -1
- package/dist/esm/editor.js +1 -4
- package/dist/esm/index.js +4 -6
- package/dist/esm/labs/next/presets/default.js +2 -2
- package/dist/esm/messages.js +5 -0
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/esm/plugins/analytics/plugin.js +8 -6
- package/dist/esm/plugins/analytics/types/enums.js +5 -0
- package/dist/esm/plugins/analytics/types/type-ahead.js +1 -0
- package/dist/esm/plugins/block-type/messages.js +10 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/esm/plugins/collab-edit/participants.js +15 -0
- package/dist/esm/plugins/collab-edit/plugin-state.js +15 -1
- package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/esm/plugins/collab-edit/ui/avatars.js +17 -2
- package/dist/esm/plugins/collab-edit/utils.js +32 -0
- package/dist/esm/plugins/date/actions.js +4 -2
- package/dist/esm/plugins/date/index.js +1 -1
- package/dist/esm/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/esm/plugins/emoji/index.js +136 -112
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -13
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +3 -6
- package/dist/esm/plugins/extension/actions.js +16 -16
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/esm/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
- package/dist/esm/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/esm/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
- package/dist/esm/plugins/help-dialog/ui/index.js +13 -19
- package/dist/esm/plugins/help-dialog/ui/styles.js +2 -6
- package/dist/esm/plugins/hyperlink/index.js +4 -10
- package/dist/esm/plugins/insert-block/index.js +5 -5
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
- package/dist/esm/plugins/list/index.js +5 -0
- package/dist/esm/plugins/macro/actions.js +14 -14
- package/dist/esm/plugins/media/index.js +1 -0
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +27 -14
- package/dist/esm/plugins/media/styles.js +2 -2
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +62 -0
- package/dist/esm/plugins/media/toolbar/index.js +154 -43
- package/dist/esm/plugins/media/toolbar/utils.js +60 -0
- package/dist/esm/plugins/mentions/index.js +45 -557
- package/dist/esm/plugins/mentions/pm-plugins/key.js +2 -0
- package/dist/esm/plugins/mentions/pm-plugins/main.js +145 -0
- package/dist/esm/plugins/mentions/pm-plugins/utils.js +4 -0
- package/dist/esm/plugins/mentions/type-ahead/index.js +415 -0
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +4 -2
- package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +2 -2
- package/dist/esm/plugins/mentions/utils.js +19 -0
- package/dist/esm/plugins/panel/index.js +44 -13
- package/dist/esm/plugins/panel/nodeviews/panel.js +36 -22
- package/dist/esm/plugins/panel/toolbar.js +92 -6
- package/dist/esm/plugins/panel/toolbar.test.js +148 -16
- package/dist/esm/plugins/paste/handlers.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/esm/plugins/placeholder/index.js +5 -0
- package/dist/esm/plugins/quick-insert/api.js +20 -0
- package/dist/esm/plugins/quick-insert/assets/custom-panel.js +45 -0
- package/dist/esm/plugins/quick-insert/assets/index.js +12 -0
- package/dist/esm/plugins/quick-insert/index.js +10 -24
- package/dist/esm/plugins/quick-insert/search.js +1 -3
- package/dist/esm/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/rule/index.js +1 -22
- package/dist/esm/plugins/scroll-into-view/index.js +1 -3
- package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/esm/plugins/status/actions.js +5 -2
- package/dist/esm/plugins/status/plugin.js +1 -1
- package/dist/esm/plugins/table/commands/selection.js +24 -24
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/esm/plugins/type-ahead/api.js +228 -0
- package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +217 -0
- package/dist/esm/plugins/type-ahead/commands/update-list-items.js +19 -0
- package/dist/esm/plugins/type-ahead/commands/update-query.js +13 -13
- package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +25 -0
- package/dist/esm/plugins/type-ahead/constants.js +15 -0
- package/dist/esm/plugins/type-ahead/index.js +173 -53
- package/dist/esm/plugins/type-ahead/insert-utils.js +116 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +11 -8
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +204 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +18 -33
- package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +18 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +80 -393
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +168 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +16 -0
- package/dist/esm/plugins/type-ahead/stats-modifier.js +43 -0
- package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +39 -0
- package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +13 -0
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +302 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +168 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +105 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +114 -0
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +125 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +101 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +118 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +46 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +38 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +48 -0
- package/dist/esm/plugins/type-ahead/utils.js +88 -0
- package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
- package/dist/esm/plugins/view-update-subscription/index.js +19 -14
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
- package/dist/esm/plugins/view-update-subscription/subscribe/type-ahead-updates.js +33 -0
- package/dist/esm/test-utils.js +7 -0
- package/dist/esm/types/empty-state-handler.js +1 -0
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +4 -14
- package/dist/esm/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +16 -23
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +10 -3
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/esm/ui/PanelTextInput/index.js +1 -3
- package/dist/esm/utils/compare.js +7 -7
- package/dist/esm/utils/index.js +7 -8
- package/dist/esm/utils/rich-media-utils.js +2 -2
- package/dist/esm/utils/selection.js +6 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/labs/next/full-page.d.ts +1 -1
- package/dist/types/labs/next/mobile.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/alignment/commands/index.d.ts +2 -2
- package/dist/types/plugins/analytics/types/enums.d.ts +6 -1
- package/dist/types/plugins/analytics/types/events.d.ts +12 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +2 -23
- package/dist/types/plugins/analytics/types/type-ahead.d.ts +27 -0
- package/dist/types/plugins/block-type/messages.d.ts +10 -0
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/collab-edit/participants.d.ts +1 -0
- package/dist/types/plugins/collab-edit/ui/avatars.d.ts +3 -1
- package/dist/types/plugins/collab-edit/ui/invite-to-edit.d.ts +1 -1
- package/dist/types/plugins/collab-edit/utils.d.ts +4 -2
- package/dist/types/plugins/date/actions.d.ts +1 -1
- package/dist/types/plugins/date/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -4
- package/dist/types/plugins/emoji/types.d.ts +2 -2
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/Extension/styles.d.ts +1 -1
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -3
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/find-replace/ui/styles.d.ts +3 -3
- package/dist/types/plugins/floating-toolbar/ui/EditorEmojiAddIcon.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +1 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -0
- package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +7 -0
- package/dist/types/plugins/media/toolbar/utils.d.ts +4 -0
- package/dist/types/plugins/media/types.d.ts +3 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
- package/dist/types/plugins/mentions/analytics.d.ts +1 -1
- package/dist/types/plugins/mentions/index.d.ts +4 -30
- package/dist/types/plugins/mentions/pm-plugins/key.d.ts +3 -0
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +8 -0
- package/dist/types/plugins/mentions/pm-plugins/utils.d.ts +3 -0
- package/dist/types/plugins/mentions/type-ahead/index.d.ts +17 -0
- package/dist/types/plugins/mentions/types.d.ts +2 -0
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +1 -0
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +2 -0
- package/dist/types/plugins/mentions/utils.d.ts +4 -0
- package/dist/types/plugins/panel/nodeviews/panel.d.ts +19 -3
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -0
- package/dist/types/plugins/quick-insert/api.d.ts +6 -0
- package/dist/types/plugins/quick-insert/assets/custom-panel.d.ts +1 -0
- package/dist/types/plugins/quick-insert/assets/index.d.ts +1 -0
- package/dist/types/plugins/quick-insert/search.d.ts +1 -1
- package/dist/types/plugins/quick-insert/types.d.ts +3 -0
- package/dist/types/plugins/status/actions.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +1 -1
- package/dist/types/plugins/type-ahead/api.d.ts +53 -0
- package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +12 -0
- package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +3 -0
- package/dist/types/plugins/type-ahead/commands/update-query.d.ts +2 -2
- package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +2 -0
- package/dist/types/plugins/type-ahead/constants.d.ts +10 -0
- package/dist/types/plugins/type-ahead/index.d.ts +5 -4
- package/dist/types/plugins/type-ahead/insert-utils.d.ts +18 -0
- package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +9 -8
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +24 -0
- package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -1
- package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +2 -0
- package/dist/types/plugins/type-ahead/pm-plugins/{plugin-key.d.ts → key.d.ts} +0 -0
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +12 -39
- package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +10 -0
- package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +4 -0
- package/dist/types/plugins/type-ahead/stats-modifier.d.ts +20 -0
- package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +2 -0
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +9 -0
- package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +2 -0
- package/dist/types/plugins/type-ahead/types.d.ts +95 -30
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +21 -0
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +22 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +11 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +15 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +22 -0
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +20 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +25 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +11 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +9 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +18 -0
- package/dist/types/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +9 -0
- package/dist/types/test-utils.d.ts +2 -0
- package/dist/types/types/editor-props.d.ts +2 -0
- package/dist/types/types/empty-state-handler.d.ts +7 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/ElementBrowser.d.ts +2 -0
- package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +2 -0
- package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +5 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +3 -1
- package/dist/types/ui/LinkSearch/index.d.ts +20 -20
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/ui/ToolbarButton/index.d.ts +4 -4
- package/dist/types/ui/ToolbarButton/styles.d.ts +2 -2
- package/dist/types/utils/selection.d.ts +2 -2
- package/package.json +32 -29
- package/dist/cjs/plugins/emoji/commands/insert-emoji-query.js +0 -22
- package/dist/cjs/plugins/mentions/commands/insert-mention-query.js +0 -22
- package/dist/cjs/plugins/type-ahead/commands/dismiss.js +0 -44
- package/dist/cjs/plugins/type-ahead/commands/insert-query.js +0 -38
- package/dist/cjs/plugins/type-ahead/commands/items-list-updated.js +0 -25
- package/dist/cjs/plugins/type-ahead/commands/select-item.js +0 -163
- package/dist/cjs/plugins/type-ahead/commands/set-current-index.js +0 -25
- package/dist/cjs/plugins/type-ahead/pm-plugins/keymap.js +0 -115
- package/dist/cjs/plugins/type-ahead/ui/TypeAhead.js +0 -221
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -239
- package/dist/cjs/plugins/type-ahead/utils/find-query-mark.js +0 -33
- package/dist/cjs/plugins/type-ahead/utils/is-query-active.js +0 -16
- package/dist/es2019/plugins/emoji/commands/insert-emoji-query.js +0 -13
- package/dist/es2019/plugins/mentions/commands/insert-mention-query.js +0 -13
- package/dist/es2019/plugins/type-ahead/commands/dismiss.js +0 -36
- package/dist/es2019/plugins/type-ahead/commands/insert-query.js +0 -26
- package/dist/es2019/plugins/type-ahead/commands/items-list-updated.js +0 -12
- package/dist/es2019/plugins/type-ahead/commands/select-item.js +0 -119
- package/dist/es2019/plugins/type-ahead/commands/set-current-index.js +0 -13
- package/dist/es2019/plugins/type-ahead/pm-plugins/keymap.js +0 -94
- package/dist/es2019/plugins/type-ahead/ui/TypeAhead.js +0 -175
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -196
- package/dist/es2019/plugins/type-ahead/utils/find-query-mark.js +0 -29
- package/dist/es2019/plugins/type-ahead/utils/is-query-active.js +0 -9
- package/dist/esm/plugins/emoji/commands/insert-emoji-query.js +0 -13
- package/dist/esm/plugins/mentions/commands/insert-mention-query.js +0 -13
- package/dist/esm/plugins/type-ahead/commands/dismiss.js +0 -33
- package/dist/esm/plugins/type-ahead/commands/insert-query.js +0 -26
- package/dist/esm/plugins/type-ahead/commands/items-list-updated.js +0 -14
- package/dist/esm/plugins/type-ahead/commands/select-item.js +0 -132
- package/dist/esm/plugins/type-ahead/commands/set-current-index.js +0 -15
- package/dist/esm/plugins/type-ahead/pm-plugins/keymap.js +0 -94
- package/dist/esm/plugins/type-ahead/ui/TypeAhead.js +0 -202
- package/dist/esm/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -204
- package/dist/esm/plugins/type-ahead/utils/find-query-mark.js +0 -24
- package/dist/esm/plugins/type-ahead/utils/is-query-active.js +0 -9
- package/dist/types/plugins/emoji/commands/insert-emoji-query.d.ts +0 -2
- package/dist/types/plugins/mentions/commands/insert-mention-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/dismiss.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/insert-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/items-list-updated.d.ts +0 -3
- package/dist/types/plugins/type-ahead/commands/select-item.d.ts +0 -9
- package/dist/types/plugins/type-ahead/commands/set-current-index.d.ts +0 -2
- package/dist/types/plugins/type-ahead/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/TypeAhead.d.ts +0 -37
- package/dist/types/plugins/type-ahead/ui/TypeAheadItemsList.d.ts +0 -32
- package/dist/types/plugins/type-ahead/utils/find-query-mark.d.ts +0 -10
- package/dist/types/plugins/type-ahead/utils/is-query-active.d.ts +0 -2
|
@@ -29,10 +29,10 @@ var _mention = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/menti
|
|
|
29
29
|
|
|
30
30
|
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
31
31
|
|
|
32
|
-
var _insertMentionQuery = require("../../commands/insert-mention-query");
|
|
33
|
-
|
|
34
32
|
var _analytics = require("../../../analytics");
|
|
35
33
|
|
|
34
|
+
var _api = require("../../../type-ahead/api");
|
|
35
|
+
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -61,7 +61,7 @@ var ToolbarMention = /*#__PURE__*/function (_PureComponent) {
|
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
(0,
|
|
64
|
+
(0, _api.createTypeAheadTools)(_this.props.editorView).openMention(_analytics.INPUT_METHOD.INSERT_MENU);
|
|
65
65
|
return true;
|
|
66
66
|
});
|
|
67
67
|
return _this;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isInviteItem = exports.isTeamStats = exports.isTeamType = void 0;
|
|
6
|
+
exports.shouldKeepInviteItem = exports.isInviteItem = exports.isTeamStats = exports.isTeamType = void 0;
|
|
7
7
|
|
|
8
8
|
var _InviteItem = require("./ui/InviteItem");
|
|
9
9
|
|
|
@@ -22,5 +22,27 @@ exports.isTeamStats = isTeamStats;
|
|
|
22
22
|
var isInviteItem = function isInviteItem(mention) {
|
|
23
23
|
return mention && mention.id === _InviteItem.INVITE_ITEM_DESCRIPTION.id;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Actions
|
|
27
|
+
*/
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
exports.isInviteItem = isInviteItem;
|
|
31
|
+
|
|
32
|
+
var shouldKeepInviteItem = function shouldKeepInviteItem(query, firstQueryWithoutResults) {
|
|
33
|
+
if (!firstQueryWithoutResults) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var lastIndexWithResults = firstQueryWithoutResults.length - 1;
|
|
38
|
+
var suffix = query.slice(lastIndexWithResults);
|
|
39
|
+
|
|
40
|
+
if (query[lastIndexWithResults - 1] === ' ') {
|
|
41
|
+
suffix = ' ' + suffix;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var depletedExtraWords = /\s[^\s]+\s/.test(suffix);
|
|
45
|
+
return !depletedExtraWords;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.shouldKeepInviteItem = shouldKeepInviteItem;
|
|
@@ -23,8 +23,12 @@ var _assets = require("../quick-insert/assets");
|
|
|
23
23
|
|
|
24
24
|
var _messages = require("../block-type/messages");
|
|
25
25
|
|
|
26
|
-
var
|
|
27
|
-
|
|
26
|
+
var _customPanel = _interopRequireDefault(require("../quick-insert/assets/custom-panel"));
|
|
27
|
+
|
|
28
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
29
|
+
|
|
30
|
+
var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelAttributes, state, insert) {
|
|
31
|
+
var tr = insert(insertPanelType(panelAttributes, state));
|
|
28
32
|
|
|
29
33
|
if (tr) {
|
|
30
34
|
(0, _analytics.addAnalytics)(state, tr, {
|
|
@@ -33,7 +37,7 @@ var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelTy
|
|
|
33
37
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
34
38
|
attributes: {
|
|
35
39
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
|
|
36
|
-
panelType: panelType
|
|
40
|
+
panelType: panelAttributes.panelType
|
|
37
41
|
},
|
|
38
42
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
39
43
|
});
|
|
@@ -42,10 +46,8 @@ var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelTy
|
|
|
42
46
|
return tr;
|
|
43
47
|
};
|
|
44
48
|
|
|
45
|
-
var insertPanelType = function insertPanelType(
|
|
46
|
-
return state.schema.nodes.panel.createChecked(
|
|
47
|
-
panelType: panelType
|
|
48
|
-
}, state.schema.nodes.paragraph.createChecked());
|
|
49
|
+
var insertPanelType = function insertPanelType(panelAttributes, state) {
|
|
50
|
+
return state.schema.nodes.panel.createChecked(panelAttributes, state.schema.nodes.paragraph.createChecked());
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
var panelPlugin = function panelPlugin() {
|
|
@@ -78,7 +80,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
78
80
|
pluginsOptions: {
|
|
79
81
|
quickInsert: function quickInsert(_ref2) {
|
|
80
82
|
var formatMessage = _ref2.formatMessage;
|
|
81
|
-
|
|
83
|
+
var quickInsertOptions = [{
|
|
82
84
|
id: 'infopanel',
|
|
83
85
|
title: formatMessage(_messages.messages.infoPanel),
|
|
84
86
|
keywords: ['panel'],
|
|
@@ -88,7 +90,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
88
90
|
return /*#__PURE__*/_react.default.createElement(_assets.IconPanel, null);
|
|
89
91
|
},
|
|
90
92
|
action: function action(insert, state) {
|
|
91
|
-
return insertPanelTypeWithAnalytics(
|
|
93
|
+
return insertPanelTypeWithAnalytics({
|
|
94
|
+
panelType: _adfSchema.PanelType.INFO
|
|
95
|
+
}, state, insert);
|
|
92
96
|
}
|
|
93
97
|
}, {
|
|
94
98
|
id: 'notepanel',
|
|
@@ -99,7 +103,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
99
103
|
return /*#__PURE__*/_react.default.createElement(_assets.IconPanelNote, null);
|
|
100
104
|
},
|
|
101
105
|
action: function action(insert, state) {
|
|
102
|
-
return insertPanelTypeWithAnalytics(
|
|
106
|
+
return insertPanelTypeWithAnalytics({
|
|
107
|
+
panelType: _adfSchema.PanelType.NOTE
|
|
108
|
+
}, state, insert);
|
|
103
109
|
}
|
|
104
110
|
}, {
|
|
105
111
|
id: 'successpanel',
|
|
@@ -111,7 +117,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
111
117
|
return /*#__PURE__*/_react.default.createElement(_assets.IconPanelSuccess, null);
|
|
112
118
|
},
|
|
113
119
|
action: function action(insert, state) {
|
|
114
|
-
return insertPanelTypeWithAnalytics(
|
|
120
|
+
return insertPanelTypeWithAnalytics({
|
|
121
|
+
panelType: _adfSchema.PanelType.SUCCESS
|
|
122
|
+
}, state, insert);
|
|
115
123
|
}
|
|
116
124
|
}, {
|
|
117
125
|
id: 'warningpanel',
|
|
@@ -122,7 +130,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
122
130
|
return /*#__PURE__*/_react.default.createElement(_assets.IconPanelWarning, null);
|
|
123
131
|
},
|
|
124
132
|
action: function action(insert, state) {
|
|
125
|
-
return insertPanelTypeWithAnalytics(
|
|
133
|
+
return insertPanelTypeWithAnalytics({
|
|
134
|
+
panelType: _adfSchema.PanelType.WARNING
|
|
135
|
+
}, state, insert);
|
|
126
136
|
}
|
|
127
137
|
}, {
|
|
128
138
|
id: 'errorpanel',
|
|
@@ -133,9 +143,32 @@ var panelPlugin = function panelPlugin() {
|
|
|
133
143
|
return /*#__PURE__*/_react.default.createElement(_assets.IconPanelError, null);
|
|
134
144
|
},
|
|
135
145
|
action: function action(insert, state) {
|
|
136
|
-
return insertPanelTypeWithAnalytics(
|
|
146
|
+
return insertPanelTypeWithAnalytics({
|
|
147
|
+
panelType: _adfSchema.PanelType.ERROR
|
|
148
|
+
}, state, insert);
|
|
137
149
|
}
|
|
138
150
|
}];
|
|
151
|
+
|
|
152
|
+
if (options.UNSAFE_allowCustomPanel) {
|
|
153
|
+
quickInsertOptions.push({
|
|
154
|
+
id: 'custompanel',
|
|
155
|
+
title: formatMessage(_messages.messages.customPanel),
|
|
156
|
+
description: formatMessage(_messages.messages.customPanelDescription),
|
|
157
|
+
priority: 1000,
|
|
158
|
+
icon: function icon() {
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement(_customPanel.default, null);
|
|
160
|
+
},
|
|
161
|
+
action: function action(insert, state) {
|
|
162
|
+
return insertPanelTypeWithAnalytics({
|
|
163
|
+
panelType: _adfSchema.PanelType.CUSTOM,
|
|
164
|
+
panelIcon: ':rainbow:',
|
|
165
|
+
panelColor: _colors.T75
|
|
166
|
+
}, state, insert);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return quickInsertOptions;
|
|
139
172
|
},
|
|
140
173
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
141
174
|
return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory);
|
|
@@ -9,6 +9,8 @@ exports.getPanelNodeView = exports.PanelIcon = exports.panelIcons = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
14
16
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -33,6 +35,7 @@ var _editorCommon = require("@atlaskit/editor-common");
|
|
|
33
35
|
|
|
34
36
|
var _utils = require("../utils");
|
|
35
37
|
|
|
38
|
+
var fitToHeight = 20;
|
|
36
39
|
var panelIcons = {
|
|
37
40
|
info: _info.default,
|
|
38
41
|
success: _success.default,
|
|
@@ -57,7 +60,7 @@ var PanelIcon = function PanelIcon(props) {
|
|
|
57
60
|
shortName: panelIcon,
|
|
58
61
|
showTooltip: false,
|
|
59
62
|
allowTextFallback: false,
|
|
60
|
-
fitToHeight:
|
|
63
|
+
fitToHeight: fitToHeight
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -69,32 +72,43 @@ var PanelIcon = function PanelIcon(props) {
|
|
|
69
72
|
|
|
70
73
|
exports.PanelIcon = PanelIcon;
|
|
71
74
|
|
|
72
|
-
var PanelNodeView = function
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
var PanelNodeView = /*#__PURE__*/function () {
|
|
76
|
+
function PanelNodeView(node, view, getPos, pluginOptions, providerFactory) {
|
|
77
|
+
(0, _classCallCheck2.default)(this, PanelNodeView);
|
|
78
|
+
this.providerFactory = providerFactory;
|
|
79
|
+
this.pluginOptions = pluginOptions;
|
|
80
|
+
this.view = view;
|
|
81
|
+
this.node = node;
|
|
82
|
+
|
|
83
|
+
var _DOMSerializer$render = _prosemirrorModel.DOMSerializer.renderSpec(document, (0, _utils.panelAttrsToDom)(node.attrs, pluginOptions.UNSAFE_allowCustomPanel || false)),
|
|
84
|
+
dom = _DOMSerializer$render.dom,
|
|
85
|
+
contentDOM = _DOMSerializer$render.contentDOM;
|
|
86
|
+
|
|
87
|
+
this.getPos = getPos;
|
|
88
|
+
this.dom = dom;
|
|
89
|
+
this.contentDOM = contentDOM;
|
|
90
|
+
this.icon = this.dom.querySelector(".".concat(_editorCommon.PanelSharedCssClassName.icon));
|
|
91
|
+
|
|
92
|
+
if (!this.icon) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(PanelIcon, {
|
|
97
|
+
allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
|
|
98
|
+
panelAttributes: node.attrs,
|
|
99
|
+
providerFactory: this.providerFactory
|
|
100
|
+
}), this.icon);
|
|
90
101
|
}
|
|
91
102
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
103
|
+
(0, _createClass2.default)(PanelNodeView, [{
|
|
104
|
+
key: "ignoreMutation",
|
|
105
|
+
value: function ignoreMutation(mutation) {
|
|
106
|
+
// ignore mutation if it caused by the icon.
|
|
107
|
+
return mutation.target === this.icon;
|
|
108
|
+
}
|
|
109
|
+
}]);
|
|
110
|
+
return PanelNodeView;
|
|
111
|
+
}();
|
|
98
112
|
|
|
99
113
|
var getPanelNodeView = function getPanelNodeView(pluginOptions, providerFactory) {
|
|
100
114
|
return function (node, view, getPos) {
|
|
@@ -21,6 +21,8 @@ var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/warni
|
|
|
21
21
|
|
|
22
22
|
var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/error"));
|
|
23
23
|
|
|
24
|
+
var _EditorHideEmojiIcon = _interopRequireDefault(require("../floating-toolbar/ui/EditorHideEmojiIcon"));
|
|
25
|
+
|
|
24
26
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
25
27
|
|
|
26
28
|
var _actions = require("./actions");
|
|
@@ -39,6 +41,8 @@ var _Palettes = require("../../ui/ColorPalette/Palettes");
|
|
|
39
41
|
|
|
40
42
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
41
43
|
|
|
44
|
+
var _analytics = require("../analytics");
|
|
45
|
+
|
|
42
46
|
var messages = (0, _reactIntl.defineMessages)({
|
|
43
47
|
info: {
|
|
44
48
|
id: 'fabric.editor.info',
|
|
@@ -67,7 +71,7 @@ var messages = (0, _reactIntl.defineMessages)({
|
|
|
67
71
|
},
|
|
68
72
|
emoji: {
|
|
69
73
|
id: 'fabric.editor.panel.emoji',
|
|
70
|
-
defaultMessage: 'Add
|
|
74
|
+
defaultMessage: 'Add emoji',
|
|
71
75
|
description: 'Select the panel icon'
|
|
72
76
|
},
|
|
73
77
|
backgroundColor: {
|
|
@@ -119,18 +123,96 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
119
123
|
if (isCustomPanelEnabled) {
|
|
120
124
|
var changeColor = function changeColor(color) {
|
|
121
125
|
return function (state, dispatch) {
|
|
122
|
-
(0,
|
|
126
|
+
var panelNode = (0, _utils.findPanel)(state);
|
|
127
|
+
|
|
128
|
+
if (panelNode === undefined) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var previousColor = panelNode.node.attrs.panelColor || (0, _editorCommon.getPanelTypeBackground)(panelNode.node.attrs.panelType);
|
|
133
|
+
|
|
134
|
+
if (previousColor === color) {
|
|
135
|
+
(0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
136
|
+
color: color
|
|
137
|
+
}, isCustomPanelEnabled)(state, dispatch);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var payload = {
|
|
142
|
+
action: _analytics.ACTION.CHANGED_BACKGROUND_COLOR,
|
|
143
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
144
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
145
|
+
attributes: {
|
|
146
|
+
newColor: color,
|
|
147
|
+
previousColor: previousColor
|
|
148
|
+
},
|
|
149
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
150
|
+
};
|
|
151
|
+
(0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
123
152
|
color: color
|
|
124
|
-
},
|
|
153
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
125
154
|
return false;
|
|
126
155
|
};
|
|
127
156
|
};
|
|
128
157
|
|
|
129
158
|
var changeEmoji = function changeEmoji(emoji) {
|
|
130
159
|
return function (state, dispatch) {
|
|
131
|
-
(0,
|
|
160
|
+
var panelNode = (0, _utils.findPanel)(state);
|
|
161
|
+
|
|
162
|
+
if (panelNode === undefined) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var previousIcon = panelNode.node.attrs.panelIcon || '';
|
|
167
|
+
|
|
168
|
+
if (previousIcon === emoji) {
|
|
169
|
+
(0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
170
|
+
emoji: emoji
|
|
171
|
+
}, true)(state, dispatch);
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var payload = {
|
|
176
|
+
action: _analytics.ACTION.CHANGED_ICON,
|
|
177
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
178
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
179
|
+
attributes: {
|
|
180
|
+
newIcon: emoji,
|
|
181
|
+
previousIcon: previousIcon
|
|
182
|
+
},
|
|
183
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
184
|
+
};
|
|
185
|
+
(0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
132
186
|
emoji: emoji
|
|
133
|
-
}, true)(state, dispatch);
|
|
187
|
+
}, true))(state, dispatch);
|
|
188
|
+
return false;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var removeEmoji = function removeEmoji() {
|
|
193
|
+
return function (state, dispatch) {
|
|
194
|
+
var panelNode = (0, _utils.findPanel)(state);
|
|
195
|
+
|
|
196
|
+
if (activePanelType === _adfSchema.PanelType.CUSTOM && !activePanelIcon) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (panelNode === undefined) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
var payload = {
|
|
205
|
+
action: _analytics.ACTION.REMOVE_ICON,
|
|
206
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
207
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
208
|
+
attributes: {
|
|
209
|
+
icon: panelNode.node.attrs.panelIcon
|
|
210
|
+
},
|
|
211
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
212
|
+
};
|
|
213
|
+
(0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
|
|
214
|
+
emoji: undefined
|
|
215
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
134
216
|
return false;
|
|
135
217
|
};
|
|
136
218
|
};
|
|
@@ -160,12 +242,18 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
160
242
|
type: 'select',
|
|
161
243
|
selectType: 'emoji',
|
|
162
244
|
options: [],
|
|
163
|
-
selected: activePanelType === _adfSchema.PanelType.CUSTOM,
|
|
245
|
+
selected: activePanelType === _adfSchema.PanelType.CUSTOM && !!activePanelIcon,
|
|
164
246
|
onChange: function onChange(emojiShortName) {
|
|
165
247
|
return changeEmoji(emojiShortName);
|
|
166
248
|
}
|
|
167
249
|
};
|
|
168
250
|
items.push(emojiPicker, {
|
|
251
|
+
id: 'editor.panel.hideEmoji',
|
|
252
|
+
type: 'button',
|
|
253
|
+
icon: _EditorHideEmojiIcon.default,
|
|
254
|
+
onClick: removeEmoji(),
|
|
255
|
+
title: formatMessage(_messages.default.hideEmoji)
|
|
256
|
+
}, {
|
|
169
257
|
type: 'separator'
|
|
170
258
|
}, colorPicker);
|
|
171
259
|
}
|
|
@@ -24,6 +24,10 @@ var _docBuilder = require("@atlaskit/editor-test-helpers/doc-builder");
|
|
|
24
24
|
|
|
25
25
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
26
26
|
|
|
27
|
+
var _analytics = _interopRequireWildcard(require("../analytics"));
|
|
28
|
+
|
|
29
|
+
var _emoji = require("../emoji");
|
|
30
|
+
|
|
27
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
32
|
|
|
29
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -32,12 +36,14 @@ var dummyFormatMessage = function dummyFormatMessage(messageDescriptor) {
|
|
|
32
36
|
return messageDescriptor.defaultMessage || '';
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
var
|
|
36
|
-
return jest.fn();
|
|
37
|
-
});
|
|
39
|
+
var changePanelTypespy = jest.spyOn(actions, 'changePanelType');
|
|
38
40
|
describe('getToolbarItems', function () {
|
|
39
41
|
var providerFactory = new _editorCommon.ProviderFactory();
|
|
40
42
|
providerFactory.setProvider('emojiProvider', Promise.resolve((0, _getTestEmojiResource.getTestEmojiResource)()));
|
|
43
|
+
var panelPreset = new _createProsemirrorEditor.Preset().add([_.default, {
|
|
44
|
+
UNSAFE_allowCustomPanel: true
|
|
45
|
+
}]);
|
|
46
|
+
var itemsWithCustomPanelEnabled = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.INFO);
|
|
41
47
|
afterEach(function () {
|
|
42
48
|
jest.clearAllMocks();
|
|
43
49
|
});
|
|
@@ -46,15 +52,14 @@ describe('getToolbarItems', function () {
|
|
|
46
52
|
expect(items).toHaveLength(7);
|
|
47
53
|
});
|
|
48
54
|
describe('if isCustomPanelEnabled is true', function () {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
expect(items).toHaveLength(10);
|
|
55
|
+
it('should return 11 items', function () {
|
|
56
|
+
expect(itemsWithCustomPanelEnabled).toHaveLength(11);
|
|
52
57
|
});
|
|
53
58
|
it('should contain emoji and color picker button', function () {
|
|
54
|
-
var emojiButton =
|
|
59
|
+
var emojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
55
60
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
56
61
|
});
|
|
57
|
-
var colorButton =
|
|
62
|
+
var colorButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
58
63
|
return item.type === 'select' && item.selectType === 'color';
|
|
59
64
|
});
|
|
60
65
|
expect(emojiButton).not.toBeUndefined();
|
|
@@ -63,9 +68,6 @@ describe('getToolbarItems', function () {
|
|
|
63
68
|
});
|
|
64
69
|
describe('custom panel toolbar items', function () {
|
|
65
70
|
var createEditor = (0, _createProsemirrorEditor.createProsemirrorEditorFactory)();
|
|
66
|
-
var panelPreset = new _createProsemirrorEditor.Preset().add([_.default, {
|
|
67
|
-
UNSAFE_allowCustomPanel: true
|
|
68
|
-
}]);
|
|
69
71
|
|
|
70
72
|
var _createEditor = createEditor({
|
|
71
73
|
doc: (0, _docBuilder.doc)((0, _docBuilder.panel)({
|
|
@@ -76,18 +78,17 @@ describe('getToolbarItems', function () {
|
|
|
76
78
|
}),
|
|
77
79
|
editorView = _createEditor.editorView;
|
|
78
80
|
|
|
79
|
-
var items = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.INFO);
|
|
80
81
|
it("should call changePanelType when clicked on emoji picker\n with changed emoji", function () {
|
|
81
|
-
var emojiPickerConfig =
|
|
82
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
82
83
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
83
84
|
});
|
|
84
85
|
emojiPickerConfig.onChange(':smiley:')(editorView.state);
|
|
85
|
-
expect(
|
|
86
|
+
expect(changePanelTypespy).toBeCalledWith(_adfSchema.PanelType.CUSTOM, {
|
|
86
87
|
emoji: ':smiley:'
|
|
87
88
|
}, true);
|
|
88
89
|
});
|
|
89
90
|
it("should call changePanelType when clicked on color picker\n with changed color", function () {
|
|
90
|
-
var colorPickerConfig =
|
|
91
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
91
92
|
return item.type === 'select' && item.selectType === 'color';
|
|
92
93
|
});
|
|
93
94
|
colorPickerConfig.onChange({
|
|
@@ -95,9 +96,141 @@ describe('getToolbarItems', function () {
|
|
|
95
96
|
value: '#ABF5D1',
|
|
96
97
|
border: _Palettes.DEFAULT_BORDER_COLOR
|
|
97
98
|
})(editorView.state);
|
|
98
|
-
expect(
|
|
99
|
+
expect(changePanelTypespy).toBeCalledWith(_adfSchema.PanelType.CUSTOM, {
|
|
99
100
|
color: '#ABF5D1'
|
|
100
101
|
}, true);
|
|
101
102
|
});
|
|
103
|
+
it("should call changePanelType when clicked on hide emoji", function () {
|
|
104
|
+
var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
105
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
106
|
+
});
|
|
107
|
+
hideEmojiButton.onClick(editorView.state);
|
|
108
|
+
expect(changePanelTypespy).toBeCalledWith(_adfSchema.PanelType.CUSTOM, {
|
|
109
|
+
emoji: undefined
|
|
110
|
+
}, true);
|
|
111
|
+
});
|
|
112
|
+
it("should not call changePanelType when clicked on hide emoji when no emoji in panel", function () {
|
|
113
|
+
var _createEditor2 = createEditor({
|
|
114
|
+
doc: (0, _docBuilder.doc)((0, _docBuilder.panel)({
|
|
115
|
+
panelType: 'custom'
|
|
116
|
+
})((0, _docBuilder.p)('{<>}'))),
|
|
117
|
+
preset: panelPreset,
|
|
118
|
+
providerFactory: providerFactory
|
|
119
|
+
}),
|
|
120
|
+
editorView = _createEditor2.editorView;
|
|
121
|
+
|
|
122
|
+
var toolbarItems = (0, _toolbar.getToolbarItems)(dummyFormatMessage, _schema.default.nodes.panel, true, providerFactory, _adfSchema.PanelType.CUSTOM);
|
|
123
|
+
var hideEmojiButton = toolbarItems.find(function (item) {
|
|
124
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
125
|
+
});
|
|
126
|
+
changePanelTypespy.mockClear();
|
|
127
|
+
hideEmojiButton.onClick(editorView.state);
|
|
128
|
+
expect(changePanelTypespy).not.toBeCalled();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
describe('analytics for custom panels', function () {
|
|
132
|
+
var createEditor = (0, _createProsemirrorEditor.createProsemirrorEditorFactory)();
|
|
133
|
+
var createAnalyticsEvent = jest.fn(function () {
|
|
134
|
+
return {
|
|
135
|
+
fire: function fire() {}
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
var editorView;
|
|
139
|
+
beforeEach(function () {
|
|
140
|
+
var _createEditor3 = createEditor({
|
|
141
|
+
doc: (0, _docBuilder.doc)((0, _docBuilder.panel)({
|
|
142
|
+
panelType: 'info'
|
|
143
|
+
})((0, _docBuilder.p)('{<>}'))),
|
|
144
|
+
preset: panelPreset.add([_analytics.default, {
|
|
145
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
146
|
+
}]),
|
|
147
|
+
providerFactory: providerFactory,
|
|
148
|
+
pluginKey: _emoji.emojiPluginKey
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
editorView = _createEditor3.editorView;
|
|
152
|
+
});
|
|
153
|
+
it('Should trigger analytics when background color is changed', function () {
|
|
154
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
155
|
+
return item.type === 'select' && item.selectType === 'color';
|
|
156
|
+
});
|
|
157
|
+
colorPickerConfig.onChange({
|
|
158
|
+
label: 'Mintie',
|
|
159
|
+
value: '#ABF5D1',
|
|
160
|
+
border: _Palettes.DEFAULT_BORDER_COLOR
|
|
161
|
+
})(editorView.state, editorView.dispatch);
|
|
162
|
+
var payload = {
|
|
163
|
+
action: _analytics.ACTION.CHANGED_BACKGROUND_COLOR,
|
|
164
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
165
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
166
|
+
attributes: expect.objectContaining({
|
|
167
|
+
newColor: '#ABF5D1',
|
|
168
|
+
previousColor: '#DEEBFF'
|
|
169
|
+
}),
|
|
170
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
171
|
+
};
|
|
172
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
173
|
+
});
|
|
174
|
+
it('Should trigger analytics when Icon is changed', function () {
|
|
175
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
176
|
+
return item.type === 'select' && item.selectType === 'emoji';
|
|
177
|
+
});
|
|
178
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
179
|
+
var payload = {
|
|
180
|
+
action: _analytics.ACTION.CHANGED_ICON,
|
|
181
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
182
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
183
|
+
attributes: expect.objectContaining({
|
|
184
|
+
newIcon: ':smiley:',
|
|
185
|
+
previousIcon: ''
|
|
186
|
+
}),
|
|
187
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
188
|
+
};
|
|
189
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
190
|
+
});
|
|
191
|
+
it('Should trigger analytics when Icon is removed', function () {
|
|
192
|
+
var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
193
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
194
|
+
});
|
|
195
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
196
|
+
return item.type === 'select' && item.selectType === 'emoji';
|
|
197
|
+
});
|
|
198
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
199
|
+
hideEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
200
|
+
var payload = {
|
|
201
|
+
action: _analytics.ACTION.REMOVE_ICON,
|
|
202
|
+
actionSubject: _analytics.ACTION_SUBJECT.PANEL,
|
|
203
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PANEL,
|
|
204
|
+
attributes: expect.objectContaining({
|
|
205
|
+
icon: ':smiley:'
|
|
206
|
+
}),
|
|
207
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
208
|
+
};
|
|
209
|
+
expect(createAnalyticsEvent).nthCalledWith(4, payload);
|
|
210
|
+
});
|
|
211
|
+
it('Should not fire analytics when the same background color is selected', function () {
|
|
212
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
213
|
+
return item.type === 'select' && item.selectType === 'color';
|
|
214
|
+
});
|
|
215
|
+
colorPickerConfig.onChange({
|
|
216
|
+
label: 'Mintie',
|
|
217
|
+
value: '#ABF5D1',
|
|
218
|
+
border: _Palettes.DEFAULT_BORDER_COLOR
|
|
219
|
+
})(editorView.state, editorView.dispatch);
|
|
220
|
+
colorPickerConfig.onChange({
|
|
221
|
+
label: 'Mintie',
|
|
222
|
+
value: '#ABF5D1',
|
|
223
|
+
border: _Palettes.DEFAULT_BORDER_COLOR
|
|
224
|
+
})(editorView.state, editorView.dispatch);
|
|
225
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
226
|
+
});
|
|
227
|
+
it('Should not fire analtyics when same emoji is selected', function () {
|
|
228
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
229
|
+
return item.type === 'select' && item.selectType === 'emoji';
|
|
230
|
+
});
|
|
231
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
232
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
233
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
234
|
+
});
|
|
102
235
|
});
|
|
103
236
|
});
|
|
@@ -117,8 +117,8 @@ function handlePasteIntoTaskAndDecision(slice) {
|
|
|
117
117
|
|
|
118
118
|
if (selection instanceof _prosemirrorState.TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && (0, _util.hasOnlyNodesOfType)(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
119
119
|
) {
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
filters.push((0, _util.applyTextMarksToSlice)(schema, selection.$head.marks()));
|
|
121
|
+
}
|
|
122
122
|
|
|
123
123
|
var transformedSlice = _utils.compose.apply(null, filters)(slice);
|
|
124
124
|
|