@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
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.TypeAhead = exports.TypeAheadContent = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
25
|
-
|
|
26
|
-
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
29
|
-
|
|
30
|
-
var _editorCommon = require("@atlaskit/editor-common");
|
|
31
|
-
|
|
32
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
33
|
-
|
|
34
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
35
|
-
|
|
36
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
37
|
-
|
|
38
|
-
var _math = require("@atlaskit/theme/math");
|
|
39
|
-
|
|
40
|
-
var _selectItem = require("../commands/select-item");
|
|
41
|
-
|
|
42
|
-
var _setCurrentIndex = require("../commands/set-current-index");
|
|
43
|
-
|
|
44
|
-
var _TypeAheadItemsList = require("./TypeAheadItemsList");
|
|
45
|
-
|
|
46
|
-
var _analytics = require("../../analytics");
|
|
47
|
-
|
|
48
|
-
var _consts = require("../../analytics/consts");
|
|
49
|
-
|
|
50
|
-
var _templateObject;
|
|
51
|
-
|
|
52
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
53
|
-
|
|
54
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
|
-
|
|
56
|
-
var TypeAheadContent = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border-radius: ", "px;\n box-shadow: 0 0 1px ", ", 0 4px 8px -2px ", ";\n padding: ", "px 0;\n width: 320px;\n max-height: 380px; /* ~5.5 visibile items */\n overflow-y: auto;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n position: relative;\n"])), _colors.N0, (0, _constants.borderRadius)(), _colors.N60A, _colors.N50A, (0, _math.divide)(_constants.gridSize, 2));
|
|
57
|
-
|
|
58
|
-
exports.TypeAheadContent = TypeAheadContent;
|
|
59
|
-
|
|
60
|
-
var TypeAhead = /*#__PURE__*/function (_React$Component) {
|
|
61
|
-
(0, _inherits2.default)(TypeAhead, _React$Component);
|
|
62
|
-
|
|
63
|
-
var _super = _createSuper(TypeAhead);
|
|
64
|
-
|
|
65
|
-
function TypeAhead() {
|
|
66
|
-
var _this;
|
|
67
|
-
|
|
68
|
-
(0, _classCallCheck2.default)(this, TypeAhead);
|
|
69
|
-
|
|
70
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
-
args[_key] = arguments[_key];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
75
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "composing", false);
|
|
76
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "shouldFireRendered", false);
|
|
77
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyPress", function () {
|
|
78
|
-
// When user starts typing, they are not using their mouse
|
|
79
|
-
// Marks as composing, to prevent false positive mouse events
|
|
80
|
-
_this.composing = true;
|
|
81
|
-
});
|
|
82
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseMove", function () {
|
|
83
|
-
// User is actively moving mouse, hence can enable mouse events again
|
|
84
|
-
_this.composing = false;
|
|
85
|
-
});
|
|
86
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireRendered", function () {
|
|
87
|
-
if (_this.shouldFireRendered) {
|
|
88
|
-
var _this$props$items;
|
|
89
|
-
|
|
90
|
-
var payload = {
|
|
91
|
-
action: _analytics.ACTION.RENDERED,
|
|
92
|
-
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
93
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
94
|
-
attributes: {
|
|
95
|
-
time: _this.renderStart ? performance.now() - _this.renderStart : undefined,
|
|
96
|
-
items: (_this$props$items = _this.props.items) === null || _this$props$items === void 0 ? void 0 : _this$props$items.length,
|
|
97
|
-
initial: _this.props.query === ''
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
(0, _analytics.fireAnalyticsEvent)(_this.props.createAnalyticsEvent)({
|
|
101
|
-
channel: _consts.editorAnalyticsChannel,
|
|
102
|
-
payload: payload
|
|
103
|
-
});
|
|
104
|
-
_this.renderStart = undefined;
|
|
105
|
-
_this.shouldFireRendered = false;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireItemViewed", function () {
|
|
109
|
-
if (_this.props.currentIndex !== _this.sentIndex) {
|
|
110
|
-
var _this$props$items2;
|
|
111
|
-
|
|
112
|
-
var itemPayload = {
|
|
113
|
-
action: _analytics.ACTION.VIEWED,
|
|
114
|
-
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD_ITEM,
|
|
115
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
116
|
-
attributes: {
|
|
117
|
-
index: _this.props.currentIndex,
|
|
118
|
-
items: (_this$props$items2 = _this.props.items) === null || _this$props$items2 === void 0 ? void 0 : _this$props$items2.length
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
(0, _analytics.fireAnalyticsEvent)(_this.props.createAnalyticsEvent)({
|
|
122
|
-
channel: _consts.editorAnalyticsChannel,
|
|
123
|
-
payload: itemPayload
|
|
124
|
-
});
|
|
125
|
-
_this.sentIndex = _this.props.currentIndex;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidMount", function () {
|
|
129
|
-
window.addEventListener('keypress', _this.handleKeyPress);
|
|
130
|
-
window.addEventListener('mousemove', _this.handleMouseMove);
|
|
131
|
-
|
|
132
|
-
_this.fireRendered();
|
|
133
|
-
|
|
134
|
-
_this.fireItemViewed();
|
|
135
|
-
});
|
|
136
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillUnmount", function () {
|
|
137
|
-
window.removeEventListener('keypress', _this.handleKeyPress);
|
|
138
|
-
window.removeEventListener('mousemove', _this.handleMouseMove);
|
|
139
|
-
});
|
|
140
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidUpdate", function () {
|
|
141
|
-
_this.fireRendered();
|
|
142
|
-
|
|
143
|
-
_this.fireItemViewed();
|
|
144
|
-
});
|
|
145
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertByIndex", function (index) {
|
|
146
|
-
(0, _selectItem.selectByIndex)(index)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
147
|
-
});
|
|
148
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setCurrentIndex", function (index) {
|
|
149
|
-
if (_this.composing) {
|
|
150
|
-
// User is typing, mouse events are false positives
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (index !== _this.props.currentIndex) {
|
|
155
|
-
(0, _setCurrentIndex.setCurrentIndex)(index)(_this.props.editorView.state, _this.props.editorView.dispatch);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return _this;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
(0, _createClass2.default)(TypeAhead, [{
|
|
162
|
-
key: "componentWillReceiveProps",
|
|
163
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
164
|
-
var _this$props$items$map, _this$props$items3, _nextProps$items$map$, _nextProps$items;
|
|
165
|
-
|
|
166
|
-
var prev = (_this$props$items$map = (_this$props$items3 = this.props.items) === null || _this$props$items3 === void 0 ? void 0 : _this$props$items3.map(function (_ref) {
|
|
167
|
-
var title = _ref.title;
|
|
168
|
-
return title;
|
|
169
|
-
}).join('-')) !== null && _this$props$items$map !== void 0 ? _this$props$items$map : '';
|
|
170
|
-
var next = (_nextProps$items$map$ = (_nextProps$items = nextProps.items) === null || _nextProps$items === void 0 ? void 0 : _nextProps$items.map(function (_ref2) {
|
|
171
|
-
var title = _ref2.title;
|
|
172
|
-
return title;
|
|
173
|
-
}).join('-')) !== null && _nextProps$items$map$ !== void 0 ? _nextProps$items$map$ : '';
|
|
174
|
-
|
|
175
|
-
if (prev !== next) {
|
|
176
|
-
this.renderStart = performance.now();
|
|
177
|
-
this.shouldFireRendered = true;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
key: "render",
|
|
182
|
-
value: function render() {
|
|
183
|
-
var _this$props = this.props,
|
|
184
|
-
active = _this$props.active,
|
|
185
|
-
items = _this$props.items,
|
|
186
|
-
isLoading = _this$props.isLoading,
|
|
187
|
-
anchorElement = _this$props.anchorElement,
|
|
188
|
-
currentIndex = _this$props.currentIndex,
|
|
189
|
-
popupsMountPoint = _this$props.popupsMountPoint,
|
|
190
|
-
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
191
|
-
popupsScrollableElement = _this$props.popupsScrollableElement,
|
|
192
|
-
highlight = _this$props.highlight;
|
|
193
|
-
|
|
194
|
-
if (!active || !anchorElement || !items || !items.length) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return /*#__PURE__*/_react.default.createElement(_editorCommon.Popup, {
|
|
199
|
-
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
200
|
-
target: anchorElement,
|
|
201
|
-
mountTo: popupsMountPoint,
|
|
202
|
-
boundariesElement: popupsBoundariesElement,
|
|
203
|
-
scrollableElement: popupsScrollableElement,
|
|
204
|
-
fitHeight: 300,
|
|
205
|
-
fitWidth: 340,
|
|
206
|
-
offset: [0, 8]
|
|
207
|
-
}, /*#__PURE__*/_react.default.createElement(TypeAheadContent, {
|
|
208
|
-
className: "fabric-editor-typeahead"
|
|
209
|
-
}, highlight, Array.isArray(items) ? /*#__PURE__*/_react.default.createElement(_TypeAheadItemsList.TypeAheadItemsList, {
|
|
210
|
-
insertByIndex: this.insertByIndex,
|
|
211
|
-
setCurrentIndex: this.setCurrentIndex,
|
|
212
|
-
items: items,
|
|
213
|
-
currentIndex: currentIndex
|
|
214
|
-
}) : !items && isLoading ? 'loading...' : 'no items'));
|
|
215
|
-
}
|
|
216
|
-
}]);
|
|
217
|
-
return TypeAhead;
|
|
218
|
-
}(_react.default.Component);
|
|
219
|
-
|
|
220
|
-
exports.TypeAhead = TypeAhead;
|
|
221
|
-
(0, _defineProperty2.default)(TypeAhead, "displayName", 'TypeAhead');
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
|
|
11
|
-
exports.TypeAheadItemsList = TypeAheadItemsList;
|
|
12
|
-
exports.TypeAheadItemComponent = exports.ItemIcon = void 0;
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
27
|
-
|
|
28
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
-
|
|
30
|
-
var _react = _interopRequireDefault(require("react"));
|
|
31
|
-
|
|
32
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
33
|
-
|
|
34
|
-
var _item = _interopRequireWildcard(require("@atlaskit/item"));
|
|
35
|
-
|
|
36
|
-
var _components = require("@atlaskit/theme/components");
|
|
37
|
-
|
|
38
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
39
|
-
|
|
40
|
-
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
41
|
-
|
|
42
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
43
|
-
|
|
44
|
-
var _styles = require("../../../ui/styles");
|
|
45
|
-
|
|
46
|
-
var _fallback = _interopRequireDefault(require("../../quick-insert/assets/fallback"));
|
|
47
|
-
|
|
48
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
49
|
-
|
|
50
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
|
-
|
|
52
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
|
-
|
|
54
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
55
|
-
|
|
56
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
57
|
-
|
|
58
|
-
var hidden = {
|
|
59
|
-
overflow: 'hidden'
|
|
60
|
-
};
|
|
61
|
-
var itemTheme = (0, _defineProperty2.default)({}, _item.itemThemeNamespace, {
|
|
62
|
-
padding: {
|
|
63
|
-
default: {
|
|
64
|
-
bottom: 12,
|
|
65
|
-
left: 12,
|
|
66
|
-
right: 12,
|
|
67
|
-
top: 12
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
beforeItemSpacing: {
|
|
71
|
-
default: function _default() {
|
|
72
|
-
return 12;
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
borderRadius: function borderRadius() {
|
|
76
|
-
return 0;
|
|
77
|
-
},
|
|
78
|
-
hover: {
|
|
79
|
-
// background: colors.transparent, transparent is not a thing
|
|
80
|
-
text: colors.text,
|
|
81
|
-
secondaryText: colors.N200
|
|
82
|
-
},
|
|
83
|
-
selected: {
|
|
84
|
-
background: (0, _components.themed)({
|
|
85
|
-
light: colors.N20,
|
|
86
|
-
dark: colors.DN70
|
|
87
|
-
}),
|
|
88
|
-
text: (0, _components.themed)({
|
|
89
|
-
light: colors.N800,
|
|
90
|
-
dark: colors.DN600
|
|
91
|
-
}),
|
|
92
|
-
secondaryText: (0, _components.themed)({
|
|
93
|
-
light: colors.N200,
|
|
94
|
-
dark: colors.DN300
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
var ItemIcon = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 40px;\n height: 40px;\n overflow: hidden;\n border: 1px solid rgba(223, 225, 229, 0.5); /* N60 at 50% */\n border-radius: ", "px;\n box-sizing: border-box;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n div {\n width: 40px;\n height: 40px;\n }\n"])), (0, _constants.borderRadius)());
|
|
100
|
-
|
|
101
|
-
exports.ItemIcon = ItemIcon;
|
|
102
|
-
|
|
103
|
-
var ItemBody = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n"])));
|
|
104
|
-
|
|
105
|
-
var ItemText = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n white-space: initial;\n .item-description {\n font-size: ", ";\n color: ", ";\n margin-top: 4px;\n }\n"])), (0, _editorSharedStyles.relativeFontSizeToBase16)(11.67), colors.N200);
|
|
106
|
-
|
|
107
|
-
var ItemAfter = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
108
|
-
|
|
109
|
-
var fallbackIcon = function fallbackIcon() {
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(_fallback.default, null);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
function scrollIntoViewIfNeeded(element) {
|
|
114
|
-
var offsetTop = element.offsetTop,
|
|
115
|
-
offsetHeight = element.offsetHeight,
|
|
116
|
-
offsetParent = element.offsetParent;
|
|
117
|
-
var _ref = offsetParent,
|
|
118
|
-
offsetParentHeight = _ref.offsetHeight,
|
|
119
|
-
scrollTop = _ref.scrollTop;
|
|
120
|
-
var direction = offsetTop + offsetHeight > offsetParentHeight + scrollTop ? 1 : scrollTop > offsetTop ? -1 : 0;
|
|
121
|
-
|
|
122
|
-
if (direction !== 0 && offsetParent) {
|
|
123
|
-
offsetParent.scrollTop = direction === 1 ? offsetTop + offsetHeight - offsetParentHeight : offsetTop;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function TypeAheadItemsList(_ref2) {
|
|
128
|
-
var items = _ref2.items,
|
|
129
|
-
currentIndex = _ref2.currentIndex,
|
|
130
|
-
insertByIndex = _ref2.insertByIndex,
|
|
131
|
-
setCurrentIndex = _ref2.setCurrentIndex;
|
|
132
|
-
|
|
133
|
-
if (!Array.isArray(items)) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
138
|
-
theme: itemTheme
|
|
139
|
-
}, /*#__PURE__*/_react.default.createElement(_item.ItemGroup, null, items.map(function (item, index) {
|
|
140
|
-
return /*#__PURE__*/_react.default.createElement(TypeAheadItemComponent, {
|
|
141
|
-
key: item.key || item.title,
|
|
142
|
-
item: item,
|
|
143
|
-
index: index,
|
|
144
|
-
currentIndex: currentIndex,
|
|
145
|
-
insertByIndex: insertByIndex,
|
|
146
|
-
setCurrentIndex: setCurrentIndex
|
|
147
|
-
});
|
|
148
|
-
})));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
var TypeAheadItemComponent = /*#__PURE__*/function (_React$Component) {
|
|
152
|
-
(0, _inherits2.default)(TypeAheadItemComponent, _React$Component);
|
|
153
|
-
|
|
154
|
-
var _super = _createSuper(TypeAheadItemComponent);
|
|
155
|
-
|
|
156
|
-
function TypeAheadItemComponent() {
|
|
157
|
-
var _this;
|
|
158
|
-
|
|
159
|
-
(0, _classCallCheck2.default)(this, TypeAheadItemComponent);
|
|
160
|
-
|
|
161
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
162
|
-
args[_key] = arguments[_key];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
166
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
167
|
-
ref: null
|
|
168
|
-
});
|
|
169
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertByIndex", function () {
|
|
170
|
-
_this.props.insertByIndex(_this.props.index);
|
|
171
|
-
});
|
|
172
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setCurrentIndex", function () {
|
|
173
|
-
if (!_this.isSelected(_this.props)) {
|
|
174
|
-
_this.props.setCurrentIndex(_this.props.index);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRef", function (rawRef) {
|
|
178
|
-
var hasRef = function hasRef(ref) {
|
|
179
|
-
return ref && ref.ref;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
var ref = hasRef(rawRef) ? rawRef.ref : rawRef;
|
|
183
|
-
|
|
184
|
-
_this.setState({
|
|
185
|
-
ref: ref
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
return _this;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
(0, _createClass2.default)(TypeAheadItemComponent, [{
|
|
192
|
-
key: "shouldComponentUpdate",
|
|
193
|
-
value: function shouldComponentUpdate(nextProps) {
|
|
194
|
-
return this.isSelected(this.props) !== this.isSelected(nextProps);
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: "isSelected",
|
|
198
|
-
value: function isSelected(props) {
|
|
199
|
-
return props.index === props.currentIndex;
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "componentDidUpdate",
|
|
203
|
-
value: function componentDidUpdate() {
|
|
204
|
-
var ref = this.state.ref;
|
|
205
|
-
|
|
206
|
-
if (this.props.index === this.props.currentIndex && ref) {
|
|
207
|
-
scrollIntoViewIfNeeded(ref);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}, {
|
|
211
|
-
key: "render",
|
|
212
|
-
value: function render() {
|
|
213
|
-
var item = this.props.item;
|
|
214
|
-
return item.render ? /*#__PURE__*/_react.default.createElement("div", {
|
|
215
|
-
onMouseMove: this.setCurrentIndex,
|
|
216
|
-
ref: this.handleRef,
|
|
217
|
-
style: hidden
|
|
218
|
-
}, /*#__PURE__*/_react.default.createElement(item.render, {
|
|
219
|
-
onClick: this.insertByIndex,
|
|
220
|
-
onHover: this.setCurrentIndex,
|
|
221
|
-
isSelected: this.isSelected(this.props)
|
|
222
|
-
})) : /*#__PURE__*/_react.default.createElement(_item.default, {
|
|
223
|
-
onClick: this.insertByIndex,
|
|
224
|
-
onMouseMove: this.setCurrentIndex,
|
|
225
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(ItemIcon, null, item.icon ? item.icon() : fallbackIcon()),
|
|
226
|
-
isSelected: this.isSelected(this.props),
|
|
227
|
-
"aria-describedby": item.title,
|
|
228
|
-
ref: this.handleRef
|
|
229
|
-
}, /*#__PURE__*/_react.default.createElement(ItemBody, null, /*#__PURE__*/_react.default.createElement(ItemText, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
230
|
-
className: "item-title"
|
|
231
|
-
}, item.title), item.description && /*#__PURE__*/_react.default.createElement("div", {
|
|
232
|
-
className: "item-description"
|
|
233
|
-
}, item.description)), /*#__PURE__*/_react.default.createElement(ItemAfter, null, item.keyshortcut && /*#__PURE__*/_react.default.createElement(_styles.Shortcut, null, item.keyshortcut))));
|
|
234
|
-
}
|
|
235
|
-
}]);
|
|
236
|
-
return TypeAheadItemComponent;
|
|
237
|
-
}(_react.default.Component);
|
|
238
|
-
|
|
239
|
-
exports.TypeAheadItemComponent = TypeAheadItemComponent;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findQueryMark = findQueryMark;
|
|
7
|
-
exports.findTypeAheadQuery = findTypeAheadQuery;
|
|
8
|
-
|
|
9
|
-
function findQueryMark(mark, doc, from, to) {
|
|
10
|
-
var queryMark = {
|
|
11
|
-
start: -1,
|
|
12
|
-
end: -1
|
|
13
|
-
};
|
|
14
|
-
doc.nodesBetween(from, to, function (node, pos) {
|
|
15
|
-
if (queryMark.start === -1 && mark.isInSet(node.marks)) {
|
|
16
|
-
queryMark = {
|
|
17
|
-
start: pos,
|
|
18
|
-
end: pos + Math.max(node.textContent.length, 1)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return queryMark;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function findTypeAheadQuery(state) {
|
|
26
|
-
var doc = state.doc,
|
|
27
|
-
schema = state.schema;
|
|
28
|
-
var typeAheadQuery = schema.marks.typeAheadQuery;
|
|
29
|
-
var _state$selection = state.selection,
|
|
30
|
-
from = _state$selection.from,
|
|
31
|
-
to = _state$selection.to;
|
|
32
|
-
return findQueryMark(typeAheadQuery, doc, from - 1, to);
|
|
33
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isQueryActive = isQueryActive;
|
|
7
|
-
|
|
8
|
-
function isQueryActive(mark, doc, from, to) {
|
|
9
|
-
var active = false;
|
|
10
|
-
doc.nodesBetween(from, to, function (node) {
|
|
11
|
-
if (!active && mark.isInSet(node.marks)) {
|
|
12
|
-
active = true;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return active;
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { insertTypeAheadQuery } from '../../type-ahead/commands/insert-query';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../../analytics';
|
|
3
|
-
export function insertEmojiQuery(inputMethod) {
|
|
4
|
-
return withAnalytics({
|
|
5
|
-
action: ACTION.INVOKED,
|
|
6
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
7
|
-
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
8
|
-
attributes: {
|
|
9
|
-
inputMethod
|
|
10
|
-
},
|
|
11
|
-
eventType: EVENT_TYPE.UI
|
|
12
|
-
})(insertTypeAheadQuery(':'));
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { insertTypeAheadQuery } from '../../type-ahead/commands/insert-query';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../../analytics';
|
|
3
|
-
export function insertMentionQuery(inputMethod) {
|
|
4
|
-
return withAnalytics({
|
|
5
|
-
action: ACTION.INVOKED,
|
|
6
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
7
|
-
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
|
8
|
-
attributes: {
|
|
9
|
-
inputMethod
|
|
10
|
-
},
|
|
11
|
-
eventType: EVENT_TYPE.UI
|
|
12
|
-
})(insertTypeAheadQuery('@'));
|
|
13
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
2
|
-
import { findTypeAheadQuery } from '../utils/find-query-mark';
|
|
3
|
-
export const dismissCommand = () => (state, dispatch) => {
|
|
4
|
-
const queryMark = findTypeAheadQuery(state);
|
|
5
|
-
|
|
6
|
-
if (queryMark === null) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const {
|
|
11
|
-
start,
|
|
12
|
-
end
|
|
13
|
-
} = queryMark;
|
|
14
|
-
const {
|
|
15
|
-
schema
|
|
16
|
-
} = state;
|
|
17
|
-
const markType = schema.marks.typeAheadQuery;
|
|
18
|
-
|
|
19
|
-
if (start === -1) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
typeAheadHandler
|
|
25
|
-
} = pluginKey.getState(state);
|
|
26
|
-
|
|
27
|
-
if (typeAheadHandler && typeAheadHandler.dismiss) {
|
|
28
|
-
typeAheadHandler.dismiss(state);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (dispatch) {
|
|
32
|
-
dispatch(state.tr.removeMark(start, end, markType).removeStoredMark(markType));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from 'prosemirror-state';
|
|
2
|
-
import { safeInsert } from 'prosemirror-utils';
|
|
3
|
-
export function insertTypeAheadQuery(trigger, replaceLastChar = false) {
|
|
4
|
-
return (state, dispatch) => {
|
|
5
|
-
if (!dispatch) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
if (replaceLastChar) {
|
|
10
|
-
const {
|
|
11
|
-
tr,
|
|
12
|
-
selection
|
|
13
|
-
} = state;
|
|
14
|
-
const marks = selection.$from.marks();
|
|
15
|
-
dispatch(tr.setSelection(TextSelection.create(tr.doc, selection.$from.pos - 1, selection.$from.pos)).replaceSelectionWith(state.doc.type.schema.text(trigger, [state.schema.marks.typeAheadQuery.create({
|
|
16
|
-
trigger
|
|
17
|
-
}), ...marks]), false));
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
dispatch(safeInsert(state.schema.text(trigger, [state.schema.marks.typeAheadQuery.create({
|
|
22
|
-
trigger
|
|
23
|
-
})]))(state.tr));
|
|
24
|
-
return true;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ACTIONS } from '../pm-plugins/actions';
|
|
2
|
-
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
3
|
-
export const itemsListUpdated = items => (state, dispatch) => {
|
|
4
|
-
if (dispatch) {
|
|
5
|
-
dispatch(state.tr.setMeta(pluginKey, {
|
|
6
|
-
action: ACTIONS.ITEMS_LIST_UPDATED,
|
|
7
|
-
items
|
|
8
|
-
}));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return true;
|
|
12
|
-
};
|