@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
|
-
var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(
|
|
11
|
-
var tr = insert(insertPanelType(
|
|
12
|
+
var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelAttributes, state, insert) {
|
|
13
|
+
var tr = insert(insertPanelType(panelAttributes, state));
|
|
12
14
|
|
|
13
15
|
if (tr) {
|
|
14
16
|
addAnalytics(state, tr, {
|
|
@@ -17,7 +19,7 @@ var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelTy
|
|
|
17
19
|
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
18
20
|
attributes: {
|
|
19
21
|
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
20
|
-
panelType: panelType
|
|
22
|
+
panelType: panelAttributes.panelType
|
|
21
23
|
},
|
|
22
24
|
eventType: EVENT_TYPE.TRACK
|
|
23
25
|
});
|
|
@@ -26,10 +28,8 @@ var insertPanelTypeWithAnalytics = function insertPanelTypeWithAnalytics(panelTy
|
|
|
26
28
|
return tr;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
var insertPanelType = function insertPanelType(
|
|
30
|
-
return state.schema.nodes.panel.createChecked(
|
|
31
|
-
panelType: panelType
|
|
32
|
-
}, state.schema.nodes.paragraph.createChecked());
|
|
31
|
+
var insertPanelType = function insertPanelType(panelAttributes, state) {
|
|
32
|
+
return state.schema.nodes.panel.createChecked(panelAttributes, state.schema.nodes.paragraph.createChecked());
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
var panelPlugin = function panelPlugin() {
|
|
@@ -62,7 +62,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
62
62
|
pluginsOptions: {
|
|
63
63
|
quickInsert: function quickInsert(_ref2) {
|
|
64
64
|
var formatMessage = _ref2.formatMessage;
|
|
65
|
-
|
|
65
|
+
var quickInsertOptions = [{
|
|
66
66
|
id: 'infopanel',
|
|
67
67
|
title: formatMessage(messages.infoPanel),
|
|
68
68
|
keywords: ['panel'],
|
|
@@ -72,7 +72,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
72
72
|
return /*#__PURE__*/React.createElement(IconPanel, null);
|
|
73
73
|
},
|
|
74
74
|
action: function action(insert, state) {
|
|
75
|
-
return insertPanelTypeWithAnalytics(
|
|
75
|
+
return insertPanelTypeWithAnalytics({
|
|
76
|
+
panelType: PanelType.INFO
|
|
77
|
+
}, state, insert);
|
|
76
78
|
}
|
|
77
79
|
}, {
|
|
78
80
|
id: 'notepanel',
|
|
@@ -83,7 +85,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
83
85
|
return /*#__PURE__*/React.createElement(IconPanelNote, null);
|
|
84
86
|
},
|
|
85
87
|
action: function action(insert, state) {
|
|
86
|
-
return insertPanelTypeWithAnalytics(
|
|
88
|
+
return insertPanelTypeWithAnalytics({
|
|
89
|
+
panelType: PanelType.NOTE
|
|
90
|
+
}, state, insert);
|
|
87
91
|
}
|
|
88
92
|
}, {
|
|
89
93
|
id: 'successpanel',
|
|
@@ -95,7 +99,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
95
99
|
return /*#__PURE__*/React.createElement(IconPanelSuccess, null);
|
|
96
100
|
},
|
|
97
101
|
action: function action(insert, state) {
|
|
98
|
-
return insertPanelTypeWithAnalytics(
|
|
102
|
+
return insertPanelTypeWithAnalytics({
|
|
103
|
+
panelType: PanelType.SUCCESS
|
|
104
|
+
}, state, insert);
|
|
99
105
|
}
|
|
100
106
|
}, {
|
|
101
107
|
id: 'warningpanel',
|
|
@@ -106,7 +112,9 @@ var panelPlugin = function panelPlugin() {
|
|
|
106
112
|
return /*#__PURE__*/React.createElement(IconPanelWarning, null);
|
|
107
113
|
},
|
|
108
114
|
action: function action(insert, state) {
|
|
109
|
-
return insertPanelTypeWithAnalytics(
|
|
115
|
+
return insertPanelTypeWithAnalytics({
|
|
116
|
+
panelType: PanelType.WARNING
|
|
117
|
+
}, state, insert);
|
|
110
118
|
}
|
|
111
119
|
}, {
|
|
112
120
|
id: 'errorpanel',
|
|
@@ -117,9 +125,32 @@ var panelPlugin = function panelPlugin() {
|
|
|
117
125
|
return /*#__PURE__*/React.createElement(IconPanelError, null);
|
|
118
126
|
},
|
|
119
127
|
action: function action(insert, state) {
|
|
120
|
-
return insertPanelTypeWithAnalytics(
|
|
128
|
+
return insertPanelTypeWithAnalytics({
|
|
129
|
+
panelType: PanelType.ERROR
|
|
130
|
+
}, state, insert);
|
|
121
131
|
}
|
|
122
132
|
}];
|
|
133
|
+
|
|
134
|
+
if (options.UNSAFE_allowCustomPanel) {
|
|
135
|
+
quickInsertOptions.push({
|
|
136
|
+
id: 'custompanel',
|
|
137
|
+
title: formatMessage(messages.customPanel),
|
|
138
|
+
description: formatMessage(messages.customPanelDescription),
|
|
139
|
+
priority: 1000,
|
|
140
|
+
icon: function icon() {
|
|
141
|
+
return /*#__PURE__*/React.createElement(IconCustomPanel, null);
|
|
142
|
+
},
|
|
143
|
+
action: function action(insert, state) {
|
|
144
|
+
return insertPanelTypeWithAnalytics({
|
|
145
|
+
panelType: PanelType.CUSTOM,
|
|
146
|
+
panelIcon: ':rainbow:',
|
|
147
|
+
panelColor: T75
|
|
148
|
+
}, state, insert);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return quickInsertOptions;
|
|
123
154
|
},
|
|
124
155
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
125
156
|
return getToolbarConfig(state, intl, options, providerFactory);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import ReactDOM from 'react-dom';
|
|
4
5
|
import { DOMSerializer } from 'prosemirror-model';
|
|
@@ -12,6 +13,7 @@ import { PanelType } from '@atlaskit/adf-schema';
|
|
|
12
13
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common';
|
|
13
14
|
import { Emoji } from '@atlaskit/editor-common';
|
|
14
15
|
import { panelAttrsToDom } from '../utils';
|
|
16
|
+
var fitToHeight = 20;
|
|
15
17
|
export var panelIcons = {
|
|
16
18
|
info: InfoIcon,
|
|
17
19
|
success: SuccessIcon,
|
|
@@ -34,7 +36,7 @@ export var PanelIcon = function PanelIcon(props) {
|
|
|
34
36
|
shortName: panelIcon,
|
|
35
37
|
showTooltip: false,
|
|
36
38
|
allowTextFallback: false,
|
|
37
|
-
fitToHeight:
|
|
39
|
+
fitToHeight: fitToHeight
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -44,33 +46,45 @@ export var PanelIcon = function PanelIcon(props) {
|
|
|
44
46
|
});
|
|
45
47
|
};
|
|
46
48
|
|
|
47
|
-
var PanelNodeView = function
|
|
48
|
-
|
|
49
|
+
var PanelNodeView = /*#__PURE__*/function () {
|
|
50
|
+
function PanelNodeView(node, view, getPos, pluginOptions, providerFactory) {
|
|
51
|
+
_classCallCheck(this, PanelNodeView);
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
this.providerFactory = providerFactory;
|
|
54
|
+
this.pluginOptions = pluginOptions;
|
|
55
|
+
this.view = view;
|
|
56
|
+
this.node = node;
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
var _DOMSerializer$render = DOMSerializer.renderSpec(document, panelAttrsToDom(node.attrs, pluginOptions.UNSAFE_allowCustomPanel || false)),
|
|
59
|
+
dom = _DOMSerializer$render.dom,
|
|
60
|
+
contentDOM = _DOMSerializer$render.contentDOM;
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
this.getPos = getPos;
|
|
63
|
+
this.dom = dom;
|
|
64
|
+
this.contentDOM = contentDOM;
|
|
65
|
+
this.icon = this.dom.querySelector(".".concat(PanelSharedCssClassName.icon));
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
if (!this.icon) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
|
|
72
|
+
allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
|
|
73
|
+
panelAttributes: node.attrs,
|
|
74
|
+
providerFactory: this.providerFactory
|
|
75
|
+
}), this.icon);
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
78
|
+
_createClass(PanelNodeView, [{
|
|
79
|
+
key: "ignoreMutation",
|
|
80
|
+
value: function ignoreMutation(mutation) {
|
|
81
|
+
// ignore mutation if it caused by the icon.
|
|
82
|
+
return mutation.target === this.icon;
|
|
83
|
+
}
|
|
84
|
+
}]);
|
|
85
|
+
|
|
86
|
+
return PanelNodeView;
|
|
87
|
+
}();
|
|
74
88
|
|
|
75
89
|
export var getPanelNodeView = function getPanelNodeView(pluginOptions, providerFactory) {
|
|
76
90
|
return function (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 var messages = defineMessages({
|
|
18
20
|
info: {
|
|
19
21
|
id: 'fabric.editor.info',
|
|
@@ -42,7 +44,7 @@ export var 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: {
|
|
@@ -92,18 +94,96 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
92
94
|
if (isCustomPanelEnabled) {
|
|
93
95
|
var changeColor = function changeColor(color) {
|
|
94
96
|
return function (state, dispatch) {
|
|
95
|
-
|
|
97
|
+
var panelNode = findPanel(state);
|
|
98
|
+
|
|
99
|
+
if (panelNode === undefined) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var previousColor = panelNode.node.attrs.panelColor || getPanelTypeBackground(panelNode.node.attrs.panelType);
|
|
104
|
+
|
|
105
|
+
if (previousColor === color) {
|
|
106
|
+
changePanelType(PanelType.CUSTOM, {
|
|
107
|
+
color: color
|
|
108
|
+
}, isCustomPanelEnabled)(state, dispatch);
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var payload = {
|
|
113
|
+
action: ACTION.CHANGED_BACKGROUND_COLOR,
|
|
114
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
115
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
116
|
+
attributes: {
|
|
117
|
+
newColor: color,
|
|
118
|
+
previousColor: previousColor
|
|
119
|
+
},
|
|
120
|
+
eventType: EVENT_TYPE.TRACK
|
|
121
|
+
};
|
|
122
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
96
123
|
color: color
|
|
97
|
-
},
|
|
124
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
98
125
|
return false;
|
|
99
126
|
};
|
|
100
127
|
};
|
|
101
128
|
|
|
102
129
|
var changeEmoji = function changeEmoji(emoji) {
|
|
103
130
|
return function (state, dispatch) {
|
|
104
|
-
|
|
131
|
+
var panelNode = findPanel(state);
|
|
132
|
+
|
|
133
|
+
if (panelNode === undefined) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var previousIcon = panelNode.node.attrs.panelIcon || '';
|
|
138
|
+
|
|
139
|
+
if (previousIcon === emoji) {
|
|
140
|
+
changePanelType(PanelType.CUSTOM, {
|
|
141
|
+
emoji: emoji
|
|
142
|
+
}, true)(state, dispatch);
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var payload = {
|
|
147
|
+
action: ACTION.CHANGED_ICON,
|
|
148
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
149
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
150
|
+
attributes: {
|
|
151
|
+
newIcon: emoji,
|
|
152
|
+
previousIcon: previousIcon
|
|
153
|
+
},
|
|
154
|
+
eventType: EVENT_TYPE.TRACK
|
|
155
|
+
};
|
|
156
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
105
157
|
emoji: emoji
|
|
106
|
-
}, true)(state, dispatch);
|
|
158
|
+
}, true))(state, dispatch);
|
|
159
|
+
return false;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var removeEmoji = function removeEmoji() {
|
|
164
|
+
return function (state, dispatch) {
|
|
165
|
+
var panelNode = findPanel(state);
|
|
166
|
+
|
|
167
|
+
if (activePanelType === PanelType.CUSTOM && !activePanelIcon) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (panelNode === undefined) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var payload = {
|
|
176
|
+
action: ACTION.REMOVE_ICON,
|
|
177
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
178
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
179
|
+
attributes: {
|
|
180
|
+
icon: panelNode.node.attrs.panelIcon
|
|
181
|
+
},
|
|
182
|
+
eventType: EVENT_TYPE.TRACK
|
|
183
|
+
};
|
|
184
|
+
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
185
|
+
emoji: undefined
|
|
186
|
+
}, isCustomPanelEnabled))(state, dispatch);
|
|
107
187
|
return false;
|
|
108
188
|
};
|
|
109
189
|
};
|
|
@@ -133,12 +213,18 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
133
213
|
type: 'select',
|
|
134
214
|
selectType: 'emoji',
|
|
135
215
|
options: [],
|
|
136
|
-
selected: activePanelType === PanelType.CUSTOM,
|
|
216
|
+
selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
|
|
137
217
|
onChange: function onChange(emojiShortName) {
|
|
138
218
|
return changeEmoji(emojiShortName);
|
|
139
219
|
}
|
|
140
220
|
};
|
|
141
221
|
items.push(emojiPicker, {
|
|
222
|
+
id: 'editor.panel.hideEmoji',
|
|
223
|
+
type: 'button',
|
|
224
|
+
icon: HideEmojiIcon,
|
|
225
|
+
onClick: removeEmoji(),
|
|
226
|
+
title: formatMessage(commonMessages.hideEmoji)
|
|
227
|
+
}, {
|
|
142
228
|
type: 'separator'
|
|
143
229
|
}, colorPicker);
|
|
144
230
|
}
|
|
@@ -8,17 +8,22 @@ 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
|
var dummyFormatMessage = function dummyFormatMessage(messageDescriptor) {
|
|
13
16
|
return messageDescriptor.defaultMessage || '';
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
var
|
|
17
|
-
return jest.fn();
|
|
18
|
-
});
|
|
19
|
+
var changePanelTypespy = jest.spyOn(actions, 'changePanelType');
|
|
19
20
|
describe('getToolbarItems', function () {
|
|
20
21
|
var providerFactory = new ProviderFactory();
|
|
21
22
|
providerFactory.setProvider('emojiProvider', Promise.resolve(getTestEmojiResource()));
|
|
23
|
+
var panelPreset = new Preset().add([panelPlugin, {
|
|
24
|
+
UNSAFE_allowCustomPanel: true
|
|
25
|
+
}]);
|
|
26
|
+
var itemsWithCustomPanelEnabled = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.INFO);
|
|
22
27
|
afterEach(function () {
|
|
23
28
|
jest.clearAllMocks();
|
|
24
29
|
});
|
|
@@ -27,15 +32,14 @@ describe('getToolbarItems', function () {
|
|
|
27
32
|
expect(items).toHaveLength(7);
|
|
28
33
|
});
|
|
29
34
|
describe('if isCustomPanelEnabled is true', function () {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
expect(items).toHaveLength(10);
|
|
35
|
+
it('should return 11 items', function () {
|
|
36
|
+
expect(itemsWithCustomPanelEnabled).toHaveLength(11);
|
|
33
37
|
});
|
|
34
38
|
it('should contain emoji and color picker button', function () {
|
|
35
|
-
var emojiButton =
|
|
39
|
+
var emojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
36
40
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
37
41
|
});
|
|
38
|
-
var colorButton =
|
|
42
|
+
var colorButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
39
43
|
return item.type === 'select' && item.selectType === 'color';
|
|
40
44
|
});
|
|
41
45
|
expect(emojiButton).not.toBeUndefined();
|
|
@@ -44,9 +48,6 @@ describe('getToolbarItems', function () {
|
|
|
44
48
|
});
|
|
45
49
|
describe('custom panel toolbar items', function () {
|
|
46
50
|
var createEditor = createProsemirrorEditorFactory();
|
|
47
|
-
var panelPreset = new Preset().add([panelPlugin, {
|
|
48
|
-
UNSAFE_allowCustomPanel: true
|
|
49
|
-
}]);
|
|
50
51
|
|
|
51
52
|
var _createEditor = createEditor({
|
|
52
53
|
doc: doc(panel({
|
|
@@ -57,18 +58,17 @@ describe('getToolbarItems', function () {
|
|
|
57
58
|
}),
|
|
58
59
|
editorView = _createEditor.editorView;
|
|
59
60
|
|
|
60
|
-
var items = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.INFO);
|
|
61
61
|
it("should call changePanelType when clicked on emoji picker\n with changed emoji", function () {
|
|
62
|
-
var emojiPickerConfig =
|
|
62
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
63
63
|
return item.type === 'select' && item.selectType === 'emoji';
|
|
64
64
|
});
|
|
65
65
|
emojiPickerConfig.onChange(':smiley:')(editorView.state);
|
|
66
|
-
expect(
|
|
66
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
67
67
|
emoji: ':smiley:'
|
|
68
68
|
}, true);
|
|
69
69
|
});
|
|
70
70
|
it("should call changePanelType when clicked on color picker\n with changed color", function () {
|
|
71
|
-
var colorPickerConfig =
|
|
71
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
72
72
|
return item.type === 'select' && item.selectType === 'color';
|
|
73
73
|
});
|
|
74
74
|
colorPickerConfig.onChange({
|
|
@@ -76,9 +76,141 @@ describe('getToolbarItems', function () {
|
|
|
76
76
|
value: '#ABF5D1',
|
|
77
77
|
border: DEFAULT_BORDER_COLOR
|
|
78
78
|
})(editorView.state);
|
|
79
|
-
expect(
|
|
79
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
80
80
|
color: '#ABF5D1'
|
|
81
81
|
}, true);
|
|
82
82
|
});
|
|
83
|
+
it("should call changePanelType when clicked on hide emoji", function () {
|
|
84
|
+
var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
85
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
86
|
+
});
|
|
87
|
+
hideEmojiButton.onClick(editorView.state);
|
|
88
|
+
expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
|
|
89
|
+
emoji: undefined
|
|
90
|
+
}, true);
|
|
91
|
+
});
|
|
92
|
+
it("should not call changePanelType when clicked on hide emoji when no emoji in panel", function () {
|
|
93
|
+
var _createEditor2 = createEditor({
|
|
94
|
+
doc: doc(panel({
|
|
95
|
+
panelType: 'custom'
|
|
96
|
+
})(p('{<>}'))),
|
|
97
|
+
preset: panelPreset,
|
|
98
|
+
providerFactory: providerFactory
|
|
99
|
+
}),
|
|
100
|
+
editorView = _createEditor2.editorView;
|
|
101
|
+
|
|
102
|
+
var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
|
|
103
|
+
var hideEmojiButton = toolbarItems.find(function (item) {
|
|
104
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
105
|
+
});
|
|
106
|
+
changePanelTypespy.mockClear();
|
|
107
|
+
hideEmojiButton.onClick(editorView.state);
|
|
108
|
+
expect(changePanelTypespy).not.toBeCalled();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('analytics for custom panels', function () {
|
|
112
|
+
var createEditor = createProsemirrorEditorFactory();
|
|
113
|
+
var createAnalyticsEvent = jest.fn(function () {
|
|
114
|
+
return {
|
|
115
|
+
fire: function fire() {}
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
var editorView;
|
|
119
|
+
beforeEach(function () {
|
|
120
|
+
var _createEditor3 = createEditor({
|
|
121
|
+
doc: doc(panel({
|
|
122
|
+
panelType: 'info'
|
|
123
|
+
})(p('{<>}'))),
|
|
124
|
+
preset: panelPreset.add([analyticsPlugin, {
|
|
125
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
126
|
+
}]),
|
|
127
|
+
providerFactory: providerFactory,
|
|
128
|
+
pluginKey: emojiPluginKey
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
editorView = _createEditor3.editorView;
|
|
132
|
+
});
|
|
133
|
+
it('Should trigger analytics when background color is changed', function () {
|
|
134
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
135
|
+
return item.type === 'select' && item.selectType === 'color';
|
|
136
|
+
});
|
|
137
|
+
colorPickerConfig.onChange({
|
|
138
|
+
label: 'Mintie',
|
|
139
|
+
value: '#ABF5D1',
|
|
140
|
+
border: DEFAULT_BORDER_COLOR
|
|
141
|
+
})(editorView.state, editorView.dispatch);
|
|
142
|
+
var payload = {
|
|
143
|
+
action: ACTION.CHANGED_BACKGROUND_COLOR,
|
|
144
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
145
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
146
|
+
attributes: expect.objectContaining({
|
|
147
|
+
newColor: '#ABF5D1',
|
|
148
|
+
previousColor: '#DEEBFF'
|
|
149
|
+
}),
|
|
150
|
+
eventType: EVENT_TYPE.TRACK
|
|
151
|
+
};
|
|
152
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
153
|
+
});
|
|
154
|
+
it('Should trigger analytics when Icon is changed', function () {
|
|
155
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
156
|
+
return item.type === 'select' && item.selectType === 'emoji';
|
|
157
|
+
});
|
|
158
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
159
|
+
var payload = {
|
|
160
|
+
action: ACTION.CHANGED_ICON,
|
|
161
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
162
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
163
|
+
attributes: expect.objectContaining({
|
|
164
|
+
newIcon: ':smiley:',
|
|
165
|
+
previousIcon: ''
|
|
166
|
+
}),
|
|
167
|
+
eventType: EVENT_TYPE.TRACK
|
|
168
|
+
};
|
|
169
|
+
expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
|
|
170
|
+
});
|
|
171
|
+
it('Should trigger analytics when Icon is removed', function () {
|
|
172
|
+
var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
|
|
173
|
+
return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
|
|
174
|
+
});
|
|
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
|
+
hideEmojiButton.onClick(editorView.state, editorView.dispatch);
|
|
180
|
+
var payload = {
|
|
181
|
+
action: ACTION.REMOVE_ICON,
|
|
182
|
+
actionSubject: ACTION_SUBJECT.PANEL,
|
|
183
|
+
actionSubjectId: ACTION_SUBJECT_ID.PANEL,
|
|
184
|
+
attributes: expect.objectContaining({
|
|
185
|
+
icon: ':smiley:'
|
|
186
|
+
}),
|
|
187
|
+
eventType: EVENT_TYPE.TRACK
|
|
188
|
+
};
|
|
189
|
+
expect(createAnalyticsEvent).nthCalledWith(4, payload);
|
|
190
|
+
});
|
|
191
|
+
it('Should not fire analytics when the same background color is selected', function () {
|
|
192
|
+
var colorPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
193
|
+
return item.type === 'select' && item.selectType === 'color';
|
|
194
|
+
});
|
|
195
|
+
colorPickerConfig.onChange({
|
|
196
|
+
label: 'Mintie',
|
|
197
|
+
value: '#ABF5D1',
|
|
198
|
+
border: DEFAULT_BORDER_COLOR
|
|
199
|
+
})(editorView.state, editorView.dispatch);
|
|
200
|
+
colorPickerConfig.onChange({
|
|
201
|
+
label: 'Mintie',
|
|
202
|
+
value: '#ABF5D1',
|
|
203
|
+
border: DEFAULT_BORDER_COLOR
|
|
204
|
+
})(editorView.state, editorView.dispatch);
|
|
205
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
206
|
+
});
|
|
207
|
+
it('Should not fire analtyics when same emoji is selected', function () {
|
|
208
|
+
var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
|
|
209
|
+
return item.type === 'select' && item.selectType === 'emoji';
|
|
210
|
+
});
|
|
211
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
212
|
+
emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
|
|
213
|
+
expect(createAnalyticsEvent).toHaveBeenCalledTimes(3);
|
|
214
|
+
});
|
|
83
215
|
});
|
|
84
216
|
});
|
|
@@ -72,8 +72,8 @@ export function handlePasteIntoTaskAndDecision(slice) {
|
|
|
72
72
|
|
|
73
73
|
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
|
|
74
74
|
) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
var transformedSlice = compose.apply(null, filters)(slice);
|
|
79
79
|
var tr = closeHistory(state.tr).replaceSelection(transformedSlice).scrollIntoView();
|
|
@@ -164,7 +164,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
164
164
|
pasteSize: text.length,
|
|
165
165
|
type: pasteContext.type,
|
|
166
166
|
content: PasteContents.text,
|
|
167
|
-
source: source
|
|
167
|
+
source: source,
|
|
168
|
+
hyperlinkPasteOnText: false
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
171
|
|
|
@@ -192,7 +193,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
192
193
|
type: pasteContext.type,
|
|
193
194
|
pasteSize: pasteSize,
|
|
194
195
|
content: content,
|
|
195
|
-
source: source
|
|
196
|
+
source: source,
|
|
197
|
+
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText
|
|
196
198
|
}, linkDomains);
|
|
197
199
|
} // TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
|
|
198
200
|
// However, handlers like handleMacroAutoConvert dispatch multiple time,
|
|
@@ -255,7 +257,8 @@ export var handleSelectedTableWithAnalytics = function handleSelectedTableWithAn
|
|
|
255
257
|
};
|
|
256
258
|
export var handlePasteLinkOnSelectedTextWithAnalytics = function handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, type) {
|
|
257
259
|
return pipe(handlePasteLinkOnSelectedText, pasteCommandWithAnalytics(view, event, slice, {
|
|
258
|
-
type: type
|
|
260
|
+
type: type,
|
|
261
|
+
hyperlinkPasteOnText: true
|
|
259
262
|
}))(slice);
|
|
260
263
|
};
|
|
261
264
|
export var createPasteMeasurePayload = function createPasteMeasurePayload(view, duration, content) {
|
|
@@ -5,6 +5,7 @@ import { pluginKey as alignmentPluginKey } from '../alignment/pm-plugins/main';
|
|
|
5
5
|
import { placeHolderClassName } from './styles';
|
|
6
6
|
export var 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);
|
|
@@ -47,6 +48,10 @@ var emptyPlaceholder = {
|
|
|
47
48
|
function createPlaceHolderStateFrom(editorState, getPlaceholderHintMessage, defaultPlaceholderText, bracketPlaceholderText) {
|
|
48
49
|
var isEditorFocused = focusStateKey.getState(editorState);
|
|
49
50
|
|
|
51
|
+
if (isTypeAheadOpen(editorState)) {
|
|
52
|
+
return emptyPlaceholder;
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
if (defaultPlaceholderText && isEmptyDocument(editorState.doc)) {
|
|
51
56
|
return setPlaceHolderState(defaultPlaceholderText);
|
|
52
57
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { pluginKey as quickInsertPluginKey } from './plugin-key';
|
|
2
|
+
import { searchQuickInsertItems } from './search';
|
|
3
|
+
|
|
4
|
+
var getItems = function getItems(editorView) {
|
|
5
|
+
return function (query, options) {
|
|
6
|
+
var pluginState = quickInsertPluginKey.getState(editorView.state);
|
|
7
|
+
|
|
8
|
+
if (!pluginState) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return searchQuickInsertItems(pluginState, options)(query);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export var createQuickInsertTools = function createQuickInsertTools(editorView) {
|
|
17
|
+
return {
|
|
18
|
+
getItems: getItems(editorView)
|
|
19
|
+
};
|
|
20
|
+
};
|