@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
|
@@ -6,9 +6,11 @@ import keymap from './pm-plugins/keymaps';
|
|
|
6
6
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '../analytics';
|
|
7
7
|
import { IconPanel, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanelError } from '../quick-insert/assets';
|
|
8
8
|
import { messages } from '../block-type/messages';
|
|
9
|
+
import IconCustomPanel from '../quick-insert/assets/custom-panel';
|
|
10
|
+
import { T75 } from '@atlaskit/theme/colors';
|
|
9
11
|
|
|
10
|
-
const insertPanelTypeWithAnalytics = (
|
|
11
|
-
const tr = insert(insertPanelType(
|
|
12
|
+
const insertPanelTypeWithAnalytics = (panelAttributes, state, insert) => {
|
|
13
|
+
const tr = insert(insertPanelType(panelAttributes, state));
|
|
12
14
|
|
|
13
15
|
if (tr) {
|
|
14
16
|
addAnalytics(state, tr, {
|
|
@@ -17,7 +19,7 @@ const insertPanelTypeWithAnalytics = (panelType, state, insert) => {
|
|
|
17
19
|
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
18
20
|
attributes: {
|
|
19
21
|
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
20
|
-
panelType
|
|
22
|
+
panelType: panelAttributes.panelType
|
|
21
23
|
},
|
|
22
24
|
eventType: EVENT_TYPE.TRACK
|
|
23
25
|
});
|
|
@@ -26,9 +28,7 @@ const insertPanelTypeWithAnalytics = (panelType, state, insert) => {
|
|
|
26
28
|
return tr;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
const insertPanelType = (
|
|
30
|
-
panelType
|
|
31
|
-
}, state.schema.nodes.paragraph.createChecked());
|
|
31
|
+
const insertPanelType = (panelAttributes, state) => state.schema.nodes.panel.createChecked(panelAttributes, state.schema.nodes.paragraph.createChecked());
|
|
32
32
|
|
|
33
33
|
const panelPlugin = (options = {}) => ({
|
|
34
34
|
name: 'panel',
|
|
@@ -58,64 +58,97 @@ const panelPlugin = (options = {}) => ({
|
|
|
58
58
|
pluginsOptions: {
|
|
59
59
|
quickInsert: ({
|
|
60
60
|
formatMessage
|
|
61
|
-
}) =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
}) => {
|
|
62
|
+
let quickInsertOptions = [{
|
|
63
|
+
id: 'infopanel',
|
|
64
|
+
title: formatMessage(messages.infoPanel),
|
|
65
|
+
keywords: ['panel'],
|
|
66
|
+
description: formatMessage(messages.infoPanelDescription),
|
|
67
|
+
priority: 800,
|
|
68
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanel, null),
|
|
69
|
+
|
|
70
|
+
action(insert, state) {
|
|
71
|
+
return insertPanelTypeWithAnalytics({
|
|
72
|
+
panelType: PanelType.INFO
|
|
73
|
+
}, state, insert);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}, {
|
|
77
|
+
id: 'notepanel',
|
|
78
|
+
title: formatMessage(messages.notePanel),
|
|
79
|
+
description: formatMessage(messages.notePanelDescription),
|
|
80
|
+
priority: 1000,
|
|
81
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelNote, null),
|
|
82
|
+
|
|
83
|
+
action(insert, state) {
|
|
84
|
+
return insertPanelTypeWithAnalytics({
|
|
85
|
+
panelType: PanelType.NOTE
|
|
86
|
+
}, state, insert);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}, {
|
|
90
|
+
id: 'successpanel',
|
|
91
|
+
title: formatMessage(messages.successPanel),
|
|
92
|
+
description: formatMessage(messages.successPanelDescription),
|
|
93
|
+
keywords: ['tip'],
|
|
94
|
+
priority: 1000,
|
|
95
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelSuccess, null),
|
|
96
|
+
|
|
97
|
+
action(insert, state) {
|
|
98
|
+
return insertPanelTypeWithAnalytics({
|
|
99
|
+
panelType: PanelType.SUCCESS
|
|
100
|
+
}, state, insert);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}, {
|
|
104
|
+
id: 'warningpanel',
|
|
105
|
+
title: formatMessage(messages.warningPanel),
|
|
106
|
+
description: formatMessage(messages.warningPanelDescription),
|
|
107
|
+
priority: 1000,
|
|
108
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelWarning, null),
|
|
109
|
+
|
|
110
|
+
action(insert, state) {
|
|
111
|
+
return insertPanelTypeWithAnalytics({
|
|
112
|
+
panelType: PanelType.WARNING
|
|
113
|
+
}, state, insert);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}, {
|
|
117
|
+
id: 'errorpanel',
|
|
118
|
+
title: formatMessage(messages.errorPanel),
|
|
119
|
+
description: formatMessage(messages.errorPanelDescription),
|
|
120
|
+
priority: 1000,
|
|
121
|
+
icon: () => /*#__PURE__*/React.createElement(IconPanelError, null),
|
|
122
|
+
|
|
123
|
+
action(insert, state) {
|
|
124
|
+
return insertPanelTypeWithAnalytics({
|
|
125
|
+
panelType: PanelType.ERROR
|
|
126
|
+
}, state, insert);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}];
|
|
130
|
+
|
|
131
|
+
if (options.UNSAFE_allowCustomPanel) {
|
|
132
|
+
quickInsertOptions.push({
|
|
133
|
+
id: 'custompanel',
|
|
134
|
+
title: formatMessage(messages.customPanel),
|
|
135
|
+
description: formatMessage(messages.customPanelDescription),
|
|
136
|
+
priority: 1000,
|
|
137
|
+
icon: () => /*#__PURE__*/React.createElement(IconCustomPanel, null),
|
|
138
|
+
|
|
139
|
+
action(insert, state) {
|
|
140
|
+
return insertPanelTypeWithAnalytics({
|
|
141
|
+
panelType: PanelType.CUSTOM,
|
|
142
|
+
panelIcon: ':rainbow:',
|
|
143
|
+
panelColor: T75
|
|
144
|
+
}, state, insert);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
});
|
|
71
148
|
}
|
|
72
149
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
title: formatMessage(messages.notePanel),
|
|
76
|
-
description: formatMessage(messages.notePanelDescription),
|
|
77
|
-
priority: 1000,
|
|
78
|
-
icon: () => /*#__PURE__*/React.createElement(IconPanelNote, null),
|
|
79
|
-
|
|
80
|
-
action(insert, state) {
|
|
81
|
-
return insertPanelTypeWithAnalytics(PanelType.NOTE, state, insert);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}, {
|
|
85
|
-
id: 'successpanel',
|
|
86
|
-
title: formatMessage(messages.successPanel),
|
|
87
|
-
description: formatMessage(messages.successPanelDescription),
|
|
88
|
-
keywords: ['tip'],
|
|
89
|
-
priority: 1000,
|
|
90
|
-
icon: () => /*#__PURE__*/React.createElement(IconPanelSuccess, null),
|
|
91
|
-
|
|
92
|
-
action(insert, state) {
|
|
93
|
-
return insertPanelTypeWithAnalytics(PanelType.SUCCESS, state, insert);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}, {
|
|
97
|
-
id: 'warningpanel',
|
|
98
|
-
title: formatMessage(messages.warningPanel),
|
|
99
|
-
description: formatMessage(messages.warningPanelDescription),
|
|
100
|
-
priority: 1000,
|
|
101
|
-
icon: () => /*#__PURE__*/React.createElement(IconPanelWarning, null),
|
|
102
|
-
|
|
103
|
-
action(insert, state) {
|
|
104
|
-
return insertPanelTypeWithAnalytics(PanelType.WARNING, state, insert);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}, {
|
|
108
|
-
id: 'errorpanel',
|
|
109
|
-
title: formatMessage(messages.errorPanel),
|
|
110
|
-
description: formatMessage(messages.errorPanelDescription),
|
|
111
|
-
priority: 1000,
|
|
112
|
-
icon: () => /*#__PURE__*/React.createElement(IconPanelError, null),
|
|
113
|
-
|
|
114
|
-
action(insert, state) {
|
|
115
|
-
return insertPanelTypeWithAnalytics(PanelType.ERROR, state, insert);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}],
|
|
150
|
+
return quickInsertOptions;
|
|
151
|
+
},
|
|
119
152
|
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory)
|
|
120
153
|
}
|
|
121
154
|
});
|
|
@@ -11,6 +11,7 @@ import { PanelType } from '@atlaskit/adf-schema';
|
|
|
11
11
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common';
|
|
12
12
|
import { Emoji } from '@atlaskit/editor-common';
|
|
13
13
|
import { panelAttrsToDom } from '../utils';
|
|
14
|
+
const fitToHeight = 20;
|
|
14
15
|
export const panelIcons = {
|
|
15
16
|
info: InfoIcon,
|
|
16
17
|
success: SuccessIcon,
|
|
@@ -36,7 +37,7 @@ export const PanelIcon = props => {
|
|
|
36
37
|
shortName: panelIcon,
|
|
37
38
|
showTooltip: false,
|
|
38
39
|
allowTextFallback: false,
|
|
39
|
-
fitToHeight:
|
|
40
|
+
fitToHeight: fitToHeight
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -72,6 +73,11 @@ class PanelNodeView {
|
|
|
72
73
|
}), this.icon);
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
ignoreMutation(mutation) {
|
|
77
|
+
// ignore mutation if it caused by the icon.
|
|
78
|
+
return mutation.target === this.icon;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
export const getPanelNodeView = (pluginOptions, providerFactory) => (node, view, getPos) => {
|
|
@@ -5,6 +5,7 @@ import NoteIcon from '@atlaskit/icon/glyph/editor/note';
|
|
|
5
5
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
6
6
|
import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
7
7
|
import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
|
|
8
|
+
import HideEmojiIcon from '../floating-toolbar/ui/EditorHideEmojiIcon';
|
|
8
9
|
import commonMessages from '../../messages';
|
|
9
10
|
import { removePanel, changePanelType } from './actions';
|
|
10
11
|
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
@@ -14,6 +15,7 @@ import { findPanel } from './utils';
|
|
|
14
15
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
15
16
|
import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
|
|
16
17
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
18
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
|
|
17
19
|
export const messages = defineMessages({
|
|
18
20
|
info: {
|
|
19
21
|
id: 'fabric.editor.info',
|
|
@@ -42,7 +44,7 @@ export const messages = defineMessages({
|
|
|
42
44
|
},
|
|
43
45
|
emoji: {
|
|
44
46
|
id: 'fabric.editor.panel.emoji',
|
|
45
|
-
defaultMessage: 'Add
|
|
47
|
+
defaultMessage: 'Add emoji',
|
|
46
48
|
description: 'Select the panel icon'
|
|
47
49
|
},
|
|
48
50
|
backgroundColor: {
|
|
@@ -91,16 +93,92 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
91
93
|
|
|
92
94
|
if (isCustomPanelEnabled) {
|
|
93
95
|
const changeColor = color => (state, dispatch) => {
|
|
94
|
-
|
|
96
|
+
const panelNode = findPanel(state);
|
|
97
|
+
|
|
98
|
+
if (panelNode === undefined) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let previousColor = panelNode.node.attrs.panelColor || getPanelTypeBackground(panelNode.node.attrs.panelType);
|
|
103
|
+
|
|
104
|
+
if (previousColor === color) {
|
|
105
|
+
changePanelType(PanelType.CUSTOM, {
|
|
106
|
+
color
|
|
107
|
+
}, isCustomPanelEnabled)(state, dispatch);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const payload = {
|
|
112
|
+
action: ACTION.CHANGED_BACKGROUND_COLOR,
|
|
113
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
114
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
115
|
+
attributes: {
|
|
116
|
+
newColor: color,
|
|
117
|
+
previousColor: previousColor
|
|
118
|
+
},
|
|
119
|
+
eventType: EVENT_TYPE.TRACK
|
|
120
|
+
};
|
|
121
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
95
122
|
color
|
|
96
|
-
},
|
|
123
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
97
124
|
return false;
|
|
98
125
|
};
|
|
99
126
|
|
|
100
127
|
const changeEmoji = emoji => (state, dispatch) => {
|
|
101
|
-
|
|
128
|
+
const panelNode = findPanel(state);
|
|
129
|
+
|
|
130
|
+
if (panelNode === undefined) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let previousIcon = panelNode.node.attrs.panelIcon || '';
|
|
135
|
+
|
|
136
|
+
if (previousIcon === emoji) {
|
|
137
|
+
changePanelType(PanelType.CUSTOM, {
|
|
138
|
+
emoji
|
|
139
|
+
}, true)(state, dispatch);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const payload = {
|
|
144
|
+
action: ACTION.CHANGED_ICON,
|
|
145
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
146
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
147
|
+
attributes: {
|
|
148
|
+
newIcon: emoji,
|
|
149
|
+
previousIcon: previousIcon
|
|
150
|
+
},
|
|
151
|
+
eventType: EVENT_TYPE.TRACK
|
|
152
|
+
};
|
|
153
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
102
154
|
emoji
|
|
103
|
-
}, true)(state, dispatch);
|
|
155
|
+
}, true))(state, dispatch);
|
|
156
|
+
return false;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const removeEmoji = () => (state, dispatch) => {
|
|
160
|
+
const panelNode = findPanel(state);
|
|
161
|
+
|
|
162
|
+
if (activePanelType === PanelType.CUSTOM && !activePanelIcon) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (panelNode === undefined) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const payload = {
|
|
171
|
+
action: ACTION.REMOVE_ICON,
|
|
172
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
173
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
174
|
+
attributes: {
|
|
175
|
+
icon: panelNode.node.attrs.panelIcon
|
|
176
|
+
},
|
|
177
|
+
eventType: EVENT_TYPE.TRACK
|
|
178
|
+
};
|
|
179
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
180
|
+
emoji: undefined
|
|
181
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
104
182
|
return false;
|
|
105
183
|
};
|
|
106
184
|
|
|
@@ -125,10 +203,16 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
125
203
|
type: 'select',
|
|
126
204
|
selectType: 'emoji',
|
|
127
205
|
options: [],
|
|
128
|
-
selected: activePanelType === PanelType.CUSTOM,
|
|
206
|
+
selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
|
|
129
207
|
onChange: emojiShortName => changeEmoji(emojiShortName)
|
|
130
208
|
};
|
|
131
209
|
items.push(emojiPicker, {
|
|
210
|
+
id: 'editor.panel.hideEmoji',
|
|
211
|
+
type: 'button',
|
|
212
|
+
icon: HideEmojiIcon,
|
|
213
|
+
onClick: removeEmoji(),
|
|
214
|
+
title: formatMessage(commonMessages.hideEmoji)
|
|
215
|
+
}, {
|
|
132
216
|
type: 'separator'
|
|
133
217
|
}, colorPicker);
|
|
134
218
|
}
|
|
@@ -8,13 +8,20 @@ import { createProsemirrorEditorFactory, Preset } from '@atlaskit/editor-test-he
|
|
|
8
8
|
import panelPlugin from '.';
|
|
9
9
|
import { doc, p, panel } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
10
10
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
11
|
+
import analyticsPlugin from '../analytics';
|
|
12
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../analytics';
|
|
13
|
+
import { emojiPluginKey } from '../emoji';
|
|
11
14
|
|
|
12
15
|
const dummyFormatMessage = messageDescriptor => messageDescriptor.defaultMessage || '';
|
|
13
16
|
|
|
14
|
-
const
|
|
17
|
+
const changePanelTypespy = jest.spyOn(actions, 'changePanelType');
|
|
15
18
|
describe('getToolbarItems', () => {
|
|
16
19
|
const providerFactory = new ProviderFactory();
|
|
17
20
|
providerFactory.setProvider('emojiProvider', Promise.resolve(getTestEmojiResource()));
|
|
21
|
+
const panelPreset = new Preset().add([panelPlugin, {
|
|
22
|
+
UNSAFE_allowCustomPanel: true
|
|
23
|
+
}]);
|
|
24
|
+
const itemsWithCustomPanelEnabled = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.INFO);
|
|
18
25
|
afterEach(() => {
|
|
19
26
|
jest.clearAllMocks();
|
|
20
27
|
});
|
|
@@ -23,22 +30,18 @@ describe('getToolbarItems', () => {
|
|
|
23
30
|
expect(items).toHaveLength(7);
|
|
24
31
|
});
|
|
25
32
|
describe('if isCustomPanelEnabled is true', () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
expect(items).toHaveLength(10);
|
|
33
|
+
it('should return 11 items', () => {
|
|
34
|
+
expect(itemsWithCustomPanelEnabled).toHaveLength(11);
|
|
29
35
|
});
|
|
30
36
|
it('should contain emoji and color picker button', () => {
|
|
31
|
-
const emojiButton =
|
|
32
|
-
const colorButton =
|
|
37
|
+
const emojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
38
|
+
const colorButton = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'color');
|
|
33
39
|
expect(emojiButton).not.toBeUndefined();
|
|
34
40
|
expect(colorButton).not.toBeUndefined();
|
|
35
41
|
});
|
|
36
42
|
});
|
|
37
43
|
describe('custom panel toolbar items', () => {
|
|
38
44
|
const createEditor = createProsemirrorEditorFactory();
|
|
39
|
-
const panelPreset = new Preset().add([panelPlugin, {
|
|
40
|
-
UNSAFE_allowCustomPanel: true
|
|
41
|
-
}]);
|
|
42
45
|
const {
|
|
43
46
|
editorView
|
|
44
47
|
} = createEditor({
|
|
@@ -48,26 +51,140 @@ describe('getToolbarItems', () => {
|
|
|
48
51
|
preset: panelPreset,
|
|
49
52
|
providerFactory
|
|
50
53
|
});
|
|
51
|
-
const items = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.INFO);
|
|
52
54
|
it(`should call changePanelType when clicked on emoji picker
|
|
53
55
|
with changed emoji`, () => {
|
|
54
|
-
const emojiPickerConfig =
|
|
56
|
+
const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
55
57
|
emojiPickerConfig.onChange(':smiley:')(editorView.state);
|
|
56
|
-
expect(
|
|
58
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
57
59
|
emoji: ':smiley:'
|
|
58
60
|
}, true);
|
|
59
61
|
});
|
|
60
62
|
it(`should call changePanelType when clicked on color picker
|
|
61
63
|
with changed color`, () => {
|
|
62
|
-
const colorPickerConfig =
|
|
64
|
+
const colorPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'color');
|
|
63
65
|
colorPickerConfig.onChange({
|
|
64
66
|
label: 'Mintie',
|
|
65
67
|
value: '#ABF5D1',
|
|
66
68
|
border: DEFAULT_BORDER_COLOR
|
|
67
69
|
})(editorView.state);
|
|
68
|
-
expect(
|
|
70
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
69
71
|
color: '#ABF5D1'
|
|
70
72
|
}, true);
|
|
71
73
|
});
|
|
74
|
+
it(`should call changePanelType when clicked on hide emoji`, () => {
|
|
75
|
+
const hideEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
|
|
76
|
+
hideEmojiButton.onClick(editorView.state);
|
|
77
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
78
|
+
emoji: undefined
|
|
79
|
+
}, true);
|
|
80
|
+
});
|
|
81
|
+
it(`should not call changePanelType when clicked on hide emoji when no emoji in panel`, () => {
|
|
82
|
+
const {
|
|
83
|
+
editorView
|
|
84
|
+
} = createEditor({
|
|
85
|
+
doc: doc(panel({
|
|
86
|
+
panelType: 'custom'
|
|
87
|
+
})(p('{<>}'))),
|
|
88
|
+
preset: panelPreset,
|
|
89
|
+
providerFactory
|
|
90
|
+
});
|
|
91
|
+
const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
|
|
92
|
+
const hideEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
|
|
93
|
+
changePanelTypespy.mockClear();
|
|
94
|
+
hideEmojiButton.onClick(editorView.state);
|
|
95
|
+
expect(changePanelTypespy).not.toBeCalled();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('analytics for custom panels', () => {
|
|
99
|
+
const createEditor = createProsemirrorEditorFactory();
|
|
100
|
+
let createAnalyticsEvent = jest.fn(() => ({
|
|
101
|
+
fire() {}
|
|
102
|
+
|
|
103
|
+
}));
|
|
104
|
+
let editorView;
|
|
105
|
+
beforeEach(() => {
|
|
106
|
+
({
|
|
107
|
+
editorView
|
|
108
|
+
} = createEditor({
|
|
109
|
+
doc: doc(panel({
|
|
110
|
+
panelType: 'info'
|
|
111
|
+
})(p('{<>}'))),
|
|
112
|
+
preset: panelPreset.add([analyticsPlugin, {
|
|
113
|
+
createAnalyticsEvent
|
|
114
|
+
}]),
|
|
115
|
+
providerFactory,
|
|
116
|
+
pluginKey: emojiPluginKey
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
it('Should trigger analytics when background color is changed', () => {
|
|
120
|
+
const colorPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'color');
|
|
121
|
+
colorPickerConfig.onChange({
|
|
122
|
+
label: 'Mintie',
|
|
123
|
+
value: '#ABF5D1',
|
|
124
|
+
border: DEFAULT_BORDER_COLOR
|
|
125
|
+
})(editorView.state, editorView.dispatch);
|
|
126
|
+
const payload = {
|
|
127
|
+
action: ACTION.CHANGED_BACKGROUND_COLOR,
|
|
128
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
129
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
130
|
+
attributes: expect.objectContaining({
|
|
131
|
+
newColor: '#ABF5D1',
|
|
132
|
+
previousColor: '#DEEBFF'
|
|
133
|
+
}),
|
|
134
|
+
eventType: EVENT_TYPE.TRACK
|
|
135
|
+
};
|
|
136
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
137
|
+
});
|
|
138
|
+
it('Should trigger analytics when Icon is changed', () => {
|
|
139
|
+
const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
140
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
141
|
+
const payload = {
|
|
142
|
+
action: ACTION.CHANGED_ICON,
|
|
143
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
144
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
145
|
+
attributes: expect.objectContaining({
|
|
146
|
+
newIcon: ':smiley:',
|
|
147
|
+
previousIcon: ''
|
|
148
|
+
}),
|
|
149
|
+
eventType: EVENT_TYPE.TRACK
|
|
150
|
+
};
|
|
151
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
152
|
+
});
|
|
153
|
+
it('Should trigger analytics when Icon is removed', () => {
|
|
154
|
+
const hideEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
|
|
155
|
+
const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
156
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
157
|
+
hideEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
158
|
+
const payload = {
|
|
159
|
+
action: ACTION.REMOVE_ICON,
|
|
160
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
161
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
162
|
+
attributes: expect.objectContaining({
|
|
163
|
+
icon: ':smiley:'
|
|
164
|
+
}),
|
|
165
|
+
eventType: EVENT_TYPE.TRACK
|
|
166
|
+
};
|
|
167
|
+
expect(createAnalyticsEvent).nthCalledWith(4, payload);
|
|
168
|
+
});
|
|
169
|
+
it('Should not fire analytics when the same background color is selected', () => {
|
|
170
|
+
const colorPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'color');
|
|
171
|
+
colorPickerConfig.onChange({
|
|
172
|
+
label: 'Mintie',
|
|
173
|
+
value: '#ABF5D1',
|
|
174
|
+
border: DEFAULT_BORDER_COLOR
|
|
175
|
+
})(editorView.state, editorView.dispatch);
|
|
176
|
+
colorPickerConfig.onChange({
|
|
177
|
+
label: 'Mintie',
|
|
178
|
+
value: '#ABF5D1',
|
|
179
|
+
border: DEFAULT_BORDER_COLOR
|
|
180
|
+
})(editorView.state, editorView.dispatch);
|
|
181
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
182
|
+
});
|
|
183
|
+
it('Should not fire analtyics when same emoji is selected', () => {
|
|
184
|
+
const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
|
|
185
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
186
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
187
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
188
|
+
});
|
|
72
189
|
});
|
|
73
190
|
});
|
|
@@ -65,8 +65,8 @@ export function handlePasteIntoTaskAndDecision(slice) {
|
|
|
65
65
|
|
|
66
66
|
if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState.codeActive) // for codeMarks let's make sure mark is active
|
|
67
67
|
) {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
|
|
69
|
+
}
|
|
70
70
|
|
|
71
71
|
const transformedSlice = compose.apply(null, filters)(slice);
|
|
72
72
|
const tr = closeHistory(state.tr).replaceSelection(transformedSlice).scrollIntoView();
|
|
@@ -172,7 +172,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
172
172
|
pasteSize: text.length,
|
|
173
173
|
type: pasteContext.type,
|
|
174
174
|
content: PasteContents.text,
|
|
175
|
-
source
|
|
175
|
+
source,
|
|
176
|
+
hyperlinkPasteOnText: false
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
|
|
@@ -198,7 +199,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
198
199
|
type: pasteContext.type,
|
|
199
200
|
pasteSize,
|
|
200
201
|
content,
|
|
201
|
-
source
|
|
202
|
+
source,
|
|
203
|
+
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText
|
|
202
204
|
}, linkDomains);
|
|
203
205
|
} // TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
204
206
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
@@ -242,7 +244,8 @@ export const handleSelectedTableWithAnalytics = (view, event, slice) => pipe(han
|
|
|
242
244
|
type: PasteTypes.richText
|
|
243
245
|
}))(slice);
|
|
244
246
|
export const handlePasteLinkOnSelectedTextWithAnalytics = (view, event, slice, type) => pipe(handlePasteLinkOnSelectedText, pasteCommandWithAnalytics(view, event, slice, {
|
|
245
|
-
type
|
|
247
|
+
type,
|
|
248
|
+
hyperlinkPasteOnText: true
|
|
246
249
|
}))(slice);
|
|
247
250
|
export const createPasteMeasurePayload = (view, duration, content) => {
|
|
248
251
|
const pasteIntoNode = getActionSubjectId(view);
|
|
@@ -5,6 +5,7 @@ import { pluginKey as alignmentPluginKey } from '../alignment/pm-plugins/main';
|
|
|
5
5
|
import { placeHolderClassName } from './styles';
|
|
6
6
|
export const pluginKey = new PluginKey('placeholderPlugin');
|
|
7
7
|
import { focusStateKey } from '../base/pm-plugins/focus-handler';
|
|
8
|
+
import { isTypeAheadOpen } from '../type-ahead/utils';
|
|
8
9
|
|
|
9
10
|
function getPlaceholderState(editorState) {
|
|
10
11
|
return pluginKey.getState(editorState);
|
|
@@ -46,6 +47,10 @@ const emptyPlaceholder = {
|
|
|
46
47
|
function createPlaceHolderStateFrom(editorState, getPlaceholderHintMessage, defaultPlaceholderText, bracketPlaceholderText) {
|
|
47
48
|
const isEditorFocused = focusStateKey.getState(editorState);
|
|
48
49
|
|
|
50
|
+
if (isTypeAheadOpen(editorState)) {
|
|
51
|
+
return emptyPlaceholder;
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
if (defaultPlaceholderText && isEmptyDocument(editorState.doc)) {
|
|
50
55
|
return setPlaceHolderState(defaultPlaceholderText);
|
|
51
56
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { pluginKey as quickInsertPluginKey } from './plugin-key';
|
|
2
|
+
import { searchQuickInsertItems } from './search';
|
|
3
|
+
|
|
4
|
+
const getItems = editorView => (query, options) => {
|
|
5
|
+
const pluginState = quickInsertPluginKey.getState(editorView.state);
|
|
6
|
+
|
|
7
|
+
if (!pluginState) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return searchQuickInsertItems(pluginState, options)(query);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const createQuickInsertTools = editorView => {
|
|
15
|
+
return {
|
|
16
|
+
getItems: getItems(editorView)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function IconCustomPanel() {
|
|
3
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
+
width: "40",
|
|
5
|
+
height: "40",
|
|
6
|
+
viewBox: "0 0 40 40",
|
|
7
|
+
fill: "none",
|
|
8
|
+
focusable: "false",
|
|
9
|
+
"aria-hidden": true
|
|
10
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
11
|
+
width: "40",
|
|
12
|
+
height: "40",
|
|
13
|
+
fill: "white"
|
|
14
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
15
|
+
d: "M8 13C8 12.4477 8.44772 12 9 12H40V28H9C8.44772 28 8 27.5523 8 27V13Z",
|
|
16
|
+
fill: "#E6FCFF"
|
|
17
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
18
|
+
clipPath: "url(#clip0)"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
d: "M19.9999 16.2222C15.5817 16.2222 12.2222 19.5818 12.2222 24H16.0093C16.0093 21.7962 17.7964 20.0093 19.9999 20.0093V16.2222Z",
|
|
21
|
+
fill: "#8767AC"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M12 23.9998H12.676C12.676 19.9578 15.9502 16.6809 19.9909 16.676V16C15.5767 16.0051 12 19.5847 12 23.9998Z",
|
|
24
|
+
fill: "#EB2027"
|
|
25
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
26
|
+
d: "M12.6851 24H13.3517C13.3517 20.3262 16.3273 17.3478 19.9999 17.3429V16.6762C15.9593 16.6811 12.6851 19.958 12.6851 24Z",
|
|
27
|
+
fill: "#F19020"
|
|
28
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
d: "M13.3518 24H14.0185C14.0185 20.6945 16.6956 18.0145 20 18.0096V17.3429C16.3274 17.3478 13.3518 20.3262 13.3518 24Z",
|
|
30
|
+
fill: "#FFCB4C"
|
|
31
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
d: "M14.0184 24H14.6851C14.6851 21.0629 17.064 18.6811 20 18.6762V18.0096C16.6955 18.0144 14.0184 20.6944 14.0184 24Z",
|
|
33
|
+
fill: "#5C903F"
|
|
34
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
35
|
+
d: "M14.6851 24H15.3517C15.3517 21.4311 17.4322 19.348 19.9999 19.3431V18.6762C17.0639 18.6811 14.6851 21.0629 14.6851 24Z",
|
|
36
|
+
fill: "#226798"
|
|
37
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
38
|
+
id: "clip0"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
40
|
+
width: "8",
|
|
41
|
+
height: "8",
|
|
42
|
+
fill: "white",
|
|
43
|
+
transform: "translate(12 16)"
|
|
44
|
+
}))));
|
|
45
|
+
}
|