@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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useLayoutEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
+
import { closeTypeAhead } from '../../transforms/close-type-ahead';
|
|
4
|
+
import { setSelectionBeforeQuery } from '../../transforms/set-selection-before-query';
|
|
5
|
+
import { insertTypeAheadItem } from '../../commands/insert-type-ahead-item';
|
|
6
|
+
import { CloseSelectionOptions } from '../../constants';
|
|
7
|
+
|
|
8
|
+
var insertRawQuery = function insertRawQuery(_ref) {
|
|
9
|
+
var view = _ref.view,
|
|
10
|
+
setSelectionAt = _ref.setSelectionAt,
|
|
11
|
+
text = _ref.text,
|
|
12
|
+
forceFocusOnEditor = _ref.forceFocusOnEditor;
|
|
13
|
+
var _view$state = view.state,
|
|
14
|
+
tr = _view$state.tr,
|
|
15
|
+
schema = _view$state.schema;
|
|
16
|
+
closeTypeAhead(tr);
|
|
17
|
+
|
|
18
|
+
if (text.length > 0) {
|
|
19
|
+
tr.replaceSelectionWith(schema.text(text));
|
|
20
|
+
|
|
21
|
+
if (setSelectionAt === CloseSelectionOptions.BEFORE_TEXT_INSERTED) {
|
|
22
|
+
setSelectionBeforeQuery(text)(tr);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
view.dispatch(tr);
|
|
27
|
+
|
|
28
|
+
if (forceFocusOnEditor) {
|
|
29
|
+
view.focus();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export var useItemInsert = function useItemInsert(triggerHandler, editorView, items) {
|
|
34
|
+
var editorViewRef = useRef(editorView);
|
|
35
|
+
var itemsRef = useRef(items);
|
|
36
|
+
var onTextInsert = useCallback(function (_ref2) {
|
|
37
|
+
var setSelectionAt = _ref2.setSelectionAt,
|
|
38
|
+
text = _ref2.text,
|
|
39
|
+
forceFocusOnEditor = _ref2.forceFocusOnEditor;
|
|
40
|
+
|
|
41
|
+
if (!triggerHandler) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var view = editorViewRef.current;
|
|
46
|
+
insertRawQuery({
|
|
47
|
+
view: view,
|
|
48
|
+
setSelectionAt: setSelectionAt,
|
|
49
|
+
text: text,
|
|
50
|
+
forceFocusOnEditor: forceFocusOnEditor
|
|
51
|
+
});
|
|
52
|
+
}, [triggerHandler]);
|
|
53
|
+
var onItemInsert = useCallback(function (_ref3) {
|
|
54
|
+
var mode = _ref3.mode,
|
|
55
|
+
index = _ref3.index,
|
|
56
|
+
query = _ref3.query;
|
|
57
|
+
var sourceListItem = itemsRef.current;
|
|
58
|
+
|
|
59
|
+
if (sourceListItem.length === 0 || !triggerHandler) {
|
|
60
|
+
var text = "".concat(triggerHandler.trigger).concat(query);
|
|
61
|
+
onTextInsert({
|
|
62
|
+
forceFocusOnEditor: true,
|
|
63
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
64
|
+
text: text
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var itemToInsert = sourceListItem[index];
|
|
70
|
+
|
|
71
|
+
if (!itemToInsert) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var view = editorViewRef.current;
|
|
76
|
+
insertTypeAheadItem(view)({
|
|
77
|
+
item: itemToInsert,
|
|
78
|
+
handler: triggerHandler,
|
|
79
|
+
mode: mode,
|
|
80
|
+
query: query,
|
|
81
|
+
sourceListItem: sourceListItem
|
|
82
|
+
});
|
|
83
|
+
}, [triggerHandler, onTextInsert]);
|
|
84
|
+
var onItemMatch = useCallback(function (_ref4) {
|
|
85
|
+
var mode = _ref4.mode,
|
|
86
|
+
query = _ref4.query;
|
|
87
|
+
var _items = itemsRef.current;
|
|
88
|
+
|
|
89
|
+
if (_items && _items.length > 1) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (_items.length === 1) {
|
|
94
|
+
queueMicrotask(function () {
|
|
95
|
+
onItemInsert({
|
|
96
|
+
mode: mode,
|
|
97
|
+
query: query,
|
|
98
|
+
index: 0
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
var text = "".concat(triggerHandler.trigger).concat(query);
|
|
103
|
+
queueMicrotask(function () {
|
|
104
|
+
onTextInsert({
|
|
105
|
+
forceFocusOnEditor: true,
|
|
106
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
107
|
+
text: mode === SelectItemMode.SPACE ? text.concat(' ') : text
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return true;
|
|
113
|
+
}, [onItemInsert, triggerHandler, onTextInsert]);
|
|
114
|
+
useLayoutEffect(function () {
|
|
115
|
+
itemsRef.current = items;
|
|
116
|
+
}, [items]);
|
|
117
|
+
return [onItemInsert, onTextInsert, onItemMatch];
|
|
118
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { updateListItem } from '../../commands/update-list-items';
|
|
4
|
+
var EMPTY_LIST_ITEM = [];
|
|
5
|
+
export var useLoadItems = function useLoadItems(triggerHandler, editorView, query) {
|
|
6
|
+
var _useState = useState(EMPTY_LIST_ITEM),
|
|
7
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
+
items = _useState2[0],
|
|
9
|
+
setItems = _useState2[1];
|
|
10
|
+
|
|
11
|
+
var componentIsMounted = useRef(true);
|
|
12
|
+
var editorViewRef = useRef(editorView);
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
var getItems = triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.getItems;
|
|
15
|
+
|
|
16
|
+
if (!getItems) {
|
|
17
|
+
setItems(EMPTY_LIST_ITEM);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var options = {
|
|
22
|
+
query: query || '',
|
|
23
|
+
editorState: editorView.state
|
|
24
|
+
};
|
|
25
|
+
var view = editorViewRef.current;
|
|
26
|
+
getItems(options).then(function (result) {
|
|
27
|
+
var list = result.length > 0 ? result : EMPTY_LIST_ITEM;
|
|
28
|
+
|
|
29
|
+
if (componentIsMounted.current) {
|
|
30
|
+
setItems(list);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
queueMicrotask(function () {
|
|
34
|
+
updateListItem(list)(view.state, view.dispatch);
|
|
35
|
+
});
|
|
36
|
+
}); // ignore because EditorView is mutable but we don't want to
|
|
37
|
+
// call loadItems when it changes, only when the query changes
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, [triggerHandler, query]);
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
return function () {
|
|
42
|
+
componentIsMounted.current = false;
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return items;
|
|
46
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
+
import { insertTypeAheadItem } from '../../commands/insert-type-ahead-item';
|
|
4
|
+
export var useOnForceSelect = function useOnForceSelect(_ref) {
|
|
5
|
+
var triggerHandler = _ref.triggerHandler,
|
|
6
|
+
items = _ref.items,
|
|
7
|
+
query = _ref.query,
|
|
8
|
+
editorView = _ref.editorView,
|
|
9
|
+
closePopup = _ref.closePopup;
|
|
10
|
+
var editorViewRef = useRef(editorView);
|
|
11
|
+
useLayoutEffect(function () {
|
|
12
|
+
if (!query || typeof triggerHandler.forceSelect !== 'function') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var item = triggerHandler.forceSelect({
|
|
17
|
+
items: items,
|
|
18
|
+
query: query,
|
|
19
|
+
editorState: editorViewRef.current.state
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!item) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var view = editorViewRef.current;
|
|
27
|
+
closePopup();
|
|
28
|
+
queueMicrotask(function () {
|
|
29
|
+
insertTypeAheadItem(view)({
|
|
30
|
+
item: item,
|
|
31
|
+
mode: SelectItemMode.SPACE,
|
|
32
|
+
query: query,
|
|
33
|
+
handler: triggerHandler,
|
|
34
|
+
sourceListItem: items
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}, [triggerHandler, closePopup, query, items]);
|
|
38
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useMemo, useEffect, useContext, useLayoutEffect, createContext } from 'react';
|
|
2
|
+
import { browser } from '@atlaskit/editor-common';
|
|
3
|
+
var Context = /*#__PURE__*/createContext(null);
|
|
4
|
+
export var ResizeObserverContext = Context;
|
|
5
|
+
export var ResizeObserverProvider = /*#__PURE__*/React.memo(function (_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
var instance = useMemo(function () {
|
|
8
|
+
if (!browser.supportsResizeObserver) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return new window.ResizeObserver(function (entries) {
|
|
13
|
+
entries.forEach(function (entry) {
|
|
14
|
+
var onResize = entry.target.onResize;
|
|
15
|
+
|
|
16
|
+
if (onResize) {
|
|
17
|
+
onResize(entry);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
return function () {
|
|
24
|
+
if (instance) {
|
|
25
|
+
instance.disconnect();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}, [instance]);
|
|
29
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
30
|
+
value: instance
|
|
31
|
+
}, children);
|
|
32
|
+
});
|
|
33
|
+
export var useResizeObserver = function useResizeObserver(targetRef, onResize) {
|
|
34
|
+
var resizeObserver = useContext(Context);
|
|
35
|
+
useLayoutEffect(function () {
|
|
36
|
+
if (!targetRef || !targetRef.current || resizeObserver === null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var target = targetRef.current;
|
|
41
|
+
target.onResize = onResize;
|
|
42
|
+
resizeObserver.observe(target);
|
|
43
|
+
return function () {
|
|
44
|
+
resizeObserver.unobserve(target);
|
|
45
|
+
delete target.onResize;
|
|
46
|
+
};
|
|
47
|
+
}, [targetRef, resizeObserver, onResize]);
|
|
48
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { DecorationSet } from 'prosemirror-view';
|
|
3
|
+
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
+
import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
|
|
5
|
+
import { updateSelectedIndex } from './commands/update-selected-index';
|
|
6
|
+
import { StatsModifier } from './stats-modifier';
|
|
7
|
+
export var findTypeAheadDecorations = function findTypeAheadDecorations(state) {
|
|
8
|
+
var selection = state.selection;
|
|
9
|
+
|
|
10
|
+
var _typeAheadPluginKey$g = typeAheadPluginKey.getState(state),
|
|
11
|
+
decorationSet = _typeAheadPluginKey$g.decorationSet;
|
|
12
|
+
|
|
13
|
+
if (!decorationSet || decorationSet === DecorationSet.empty || !(selection instanceof TextSelection) || !selection.$cursor) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var pos = selection.$cursor.pos;
|
|
18
|
+
var decoration = decorationSet.find(pos, pos, function (spec) {
|
|
19
|
+
return spec === null || spec === void 0 ? void 0 : spec.isTypeAheadDecoration;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!decoration || decoration.length !== 1) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return decoration[0];
|
|
27
|
+
};
|
|
28
|
+
export var isTypeAheadHandler = function isTypeAheadHandler(handler) {
|
|
29
|
+
return handler && Object.values(TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
|
|
30
|
+
};
|
|
31
|
+
export var isTypeAheadOpen = function isTypeAheadOpen(editorState) {
|
|
32
|
+
var _typeAheadPluginKey$g2, _typeAheadPluginKey$g3;
|
|
33
|
+
|
|
34
|
+
return (typeAheadPluginKey === null || typeAheadPluginKey === void 0 ? void 0 : (_typeAheadPluginKey$g2 = typeAheadPluginKey.getState(editorState)) === null || _typeAheadPluginKey$g2 === void 0 ? void 0 : (_typeAheadPluginKey$g3 = _typeAheadPluginKey$g2.decorationSet) === null || _typeAheadPluginKey$g3 === void 0 ? void 0 : _typeAheadPluginKey$g3.find().length) > 0;
|
|
35
|
+
};
|
|
36
|
+
export var getPluginState = function getPluginState(editorState) {
|
|
37
|
+
return typeAheadPluginKey.getState(editorState);
|
|
38
|
+
};
|
|
39
|
+
export var getTypeAheadHandler = function getTypeAheadHandler(editorState) {
|
|
40
|
+
return typeAheadPluginKey.getState(editorState).triggerHandler;
|
|
41
|
+
};
|
|
42
|
+
export var getTypeAheadQuery = function getTypeAheadQuery(editorState) {
|
|
43
|
+
return typeAheadPluginKey.getState(editorState).query;
|
|
44
|
+
};
|
|
45
|
+
export var isTypeAheadAllowed = function isTypeAheadAllowed(state) {
|
|
46
|
+
var isOpen = isTypeAheadOpen(state); // if the TypeAhead is open
|
|
47
|
+
// we should not allow it
|
|
48
|
+
|
|
49
|
+
return !isOpen;
|
|
50
|
+
};
|
|
51
|
+
export var findHandler = function findHandler(id, state) {
|
|
52
|
+
var pluginState = typeAheadPluginKey.getState(state);
|
|
53
|
+
|
|
54
|
+
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var typeAheadHandlers = pluginState.typeAheadHandlers;
|
|
59
|
+
return typeAheadHandlers.find(function (h) {
|
|
60
|
+
return h.id === id;
|
|
61
|
+
}) || null;
|
|
62
|
+
};
|
|
63
|
+
export var moveSelectedIndex = function moveSelectedIndex(_ref) {
|
|
64
|
+
var editorView = _ref.editorView,
|
|
65
|
+
direction = _ref.direction;
|
|
66
|
+
return function () {
|
|
67
|
+
var typeAheadState = getPluginState(editorView.state);
|
|
68
|
+
|
|
69
|
+
if (!typeAheadState) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var selectedIndex = typeAheadState.selectedIndex,
|
|
74
|
+
items = typeAheadState.items;
|
|
75
|
+
var stats = typeAheadState.stats instanceof StatsModifier ? typeAheadState.stats : new StatsModifier();
|
|
76
|
+
var nextIndex = 0;
|
|
77
|
+
|
|
78
|
+
if (direction === 'next') {
|
|
79
|
+
stats.increaseArrowDown();
|
|
80
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
81
|
+
} else {
|
|
82
|
+
stats.increaseArrowUp();
|
|
83
|
+
nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -16,7 +16,38 @@ import { undo as undoKeymap, redo as redoKeymap, ToolTipContent } from '../../..
|
|
|
16
16
|
import { ButtonGroup, Separator } from '../../../../ui/styles';
|
|
17
17
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
18
18
|
import { messages } from '../../messages';
|
|
19
|
+
import { createTypeAheadTools } from '../../../type-ahead/api';
|
|
19
20
|
import { undoFromToolbar, redoFromToolbar } from '../../commands';
|
|
21
|
+
|
|
22
|
+
var closeTypeAheadAndRunCommand = function closeTypeAheadAndRunCommand(editorView) {
|
|
23
|
+
return function (command) {
|
|
24
|
+
if (!editorView) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var tool = createTypeAheadTools(editorView);
|
|
29
|
+
|
|
30
|
+
if (tool.isOpen()) {
|
|
31
|
+
tool.close({
|
|
32
|
+
attachCommand: command,
|
|
33
|
+
insertCurrentQueryAsRawText: false
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
command(editorView.state, editorView.dispatch);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var forceFocus = function forceFocus(editorView) {
|
|
42
|
+
return function (command) {
|
|
43
|
+
closeTypeAheadAndRunCommand(editorView)(command);
|
|
44
|
+
|
|
45
|
+
if (!editorView.hasFocus()) {
|
|
46
|
+
editorView.focus();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
20
51
|
export var ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
|
|
21
52
|
_inherits(ToolbarUndoRedo, _PureComponent);
|
|
22
53
|
|
|
@@ -39,11 +70,11 @@ export var ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
|
|
|
39
70
|
formatMessage = _this$props.intl.formatMessage;
|
|
40
71
|
|
|
41
72
|
var handleUndo = function handleUndo() {
|
|
42
|
-
|
|
73
|
+
forceFocus(editorView)(undoFromToolbar);
|
|
43
74
|
};
|
|
44
75
|
|
|
45
76
|
var handleRedo = function handleRedo() {
|
|
46
|
-
|
|
77
|
+
forceFocus(editorView)(redoFromToolbar);
|
|
47
78
|
};
|
|
48
79
|
|
|
49
80
|
var labelUndo = formatMessage(messages.undo);
|
|
@@ -31,7 +31,7 @@ var Tracker = function Tracker() {
|
|
|
31
31
|
var pluginKey = new PluginKey('viewUpdateSubscriptionKey');
|
|
32
32
|
|
|
33
33
|
var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPlugin() {
|
|
34
|
-
var tracker
|
|
34
|
+
var tracker;
|
|
35
35
|
var lastUpdateRef = {
|
|
36
36
|
current: null,
|
|
37
37
|
initial: null,
|
|
@@ -45,12 +45,14 @@ var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPl
|
|
|
45
45
|
return new Plugin({
|
|
46
46
|
key: pluginKey,
|
|
47
47
|
view: function view(editorView) {
|
|
48
|
-
trackerStore.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
tracker = trackerStore.get(editorView);
|
|
49
|
+
|
|
50
|
+
if (!tracker) {
|
|
51
|
+
tracker = new Tracker();
|
|
52
|
+
trackerStore.set(editorView, tracker);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {};
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
58
|
};
|
|
@@ -71,17 +73,20 @@ var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPl
|
|
|
71
73
|
lastUpdateRef.initial = props;
|
|
72
74
|
lastUpdateRef.queued = true;
|
|
73
75
|
queueMicrotask(function () {
|
|
74
|
-
var _lastUpdateRef$initia;
|
|
75
|
-
|
|
76
76
|
if (!lastUpdateRef.current || !lastUpdateRef.initial) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
tracker
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
if (tracker) {
|
|
81
|
+
var _lastUpdateRef$initia;
|
|
82
|
+
|
|
83
|
+
tracker.update({
|
|
84
|
+
newEditorState: lastUpdateRef.current.newEditorState,
|
|
85
|
+
oldEditorState: (_lastUpdateRef$initia = lastUpdateRef.initial) === null || _lastUpdateRef$initia === void 0 ? void 0 : _lastUpdateRef$initia.oldEditorState,
|
|
86
|
+
transactions: lastUpdateRef.transactions
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
lastUpdateRef.queued = false;
|
|
86
91
|
lastUpdateRef.current = null;
|
|
87
92
|
lastUpdateRef.transactions = [];
|
|
@@ -2,6 +2,7 @@ import { pluginKey as datePluginKey } from '../../date/pm-plugins/plugin-key';
|
|
|
2
2
|
import { pluginKey as floatingToolbarPluginKey } from '../../floating-toolbar';
|
|
3
3
|
import { pluginKey as statusPluginKey } from '../../status/plugin-key';
|
|
4
4
|
import { areSameItems } from '../../floating-toolbar/ui/Toolbar';
|
|
5
|
+
import { isTypeAheadOpen } from '../../type-ahead/utils';
|
|
5
6
|
import { trackerStore } from '..';
|
|
6
7
|
|
|
7
8
|
var areToolbarsSame = function areToolbarsSame(left, right) {
|
|
@@ -34,6 +35,14 @@ export var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPi
|
|
|
34
35
|
|
|
35
36
|
var subscription = function subscription(_ref) {
|
|
36
37
|
var newEditorState = _ref.newEditorState;
|
|
38
|
+
|
|
39
|
+
// TypeAhead has priority in the mobile-bridge
|
|
40
|
+
// In case it is open we don't need to send
|
|
41
|
+
// any toolbar updates don't need to be send
|
|
42
|
+
if (isTypeAheadOpen(newEditorState)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
var dateState = datePluginKey.getState(newEditorState);
|
|
38
47
|
var statusState = statusPluginKey.getState(newEditorState);
|
|
39
48
|
|
|
@@ -53,9 +62,7 @@ export var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPi
|
|
|
53
62
|
var oldToolbarConfig = getOldConfigWithNodeInfo(lastUpdatedState);
|
|
54
63
|
var isToolbarEqual = areToolbarsSame(toolbarConfig, oldToolbarConfig);
|
|
55
64
|
|
|
56
|
-
if (dateState !== oldDateState || statusState !== oldStatusState ||
|
|
57
|
-
// EG A nested status or date node in a table
|
|
58
|
-
!isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
65
|
+
if (dateState !== oldDateState || statusState !== oldStatusState || !isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
59
66
|
shouldCallback = true;
|
|
60
67
|
}
|
|
61
68
|
} else {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { trackerStore } from '..';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../../type-ahead/pm-plugins/key';
|
|
3
|
+
export var subscribeTypeAheadUpdates = function subscribeTypeAheadUpdates(editorView, cb) {
|
|
4
|
+
var subscription = function subscription(_ref) {
|
|
5
|
+
var newEditorState = _ref.newEditorState,
|
|
6
|
+
oldEditorState = _ref.oldEditorState;
|
|
7
|
+
var newPluginState = typeAheadPluginKey.getState(newEditorState);
|
|
8
|
+
var oldPluginState = typeAheadPluginKey.getState(oldEditorState);
|
|
9
|
+
|
|
10
|
+
if (!oldPluginState || !newPluginState) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
cb({
|
|
15
|
+
oldPluginState: oldPluginState,
|
|
16
|
+
newPluginState: newPluginState
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var tracker = trackerStore.get(editorView);
|
|
21
|
+
|
|
22
|
+
if (tracker) {
|
|
23
|
+
tracker.add(subscription);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return function () {
|
|
27
|
+
var tracker = trackerStore.get(editorView);
|
|
28
|
+
|
|
29
|
+
if (tracker) {
|
|
30
|
+
tracker.remove(subscription);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
package/dist/esm/test-utils.js
CHANGED
|
@@ -10,7 +10,14 @@ import { sortByOrder } from './create-editor/sort-by-order';
|
|
|
10
10
|
import { Preset } from './labs/next/presets/preset';
|
|
11
11
|
import { createSchema } from './create-editor/create-schema';
|
|
12
12
|
import basePlugin from './plugins/base';
|
|
13
|
+
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
14
|
+
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
13
15
|
export { Preset } from './labs/next/presets/preset';
|
|
16
|
+
export function getFireAnalytics(editorView) {
|
|
17
|
+
var _analyticsPluginKey$g;
|
|
18
|
+
|
|
19
|
+
return analyticsPluginKey === null || analyticsPluginKey === void 0 ? void 0 : (_analyticsPluginKey$g = analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
|
|
20
|
+
}
|
|
14
21
|
|
|
15
22
|
function lightProcessPluginsList(editorPlugins) {
|
|
16
23
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
|
|
@@ -8,7 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
7
|
|
|
9
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
9
|
|
|
11
|
-
import React
|
|
10
|
+
import React from 'react';
|
|
12
11
|
import { Field } from '@atlaskit/form';
|
|
13
12
|
import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
|
|
14
13
|
import { isValidHex } from '../utils';
|
|
@@ -120,7 +119,6 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
120
119
|
title = props.title,
|
|
121
120
|
currentColor = props.currentColor,
|
|
122
121
|
colorPalette = props.colorPalette,
|
|
123
|
-
fieldProps = props.fieldProps,
|
|
124
122
|
onChange = props.onChange,
|
|
125
123
|
onFieldChange = props.onFieldChange;
|
|
126
124
|
|
|
@@ -132,7 +130,6 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
onChange(colorValue);
|
|
135
|
-
fieldProps.onChange(colorValue);
|
|
136
133
|
onFieldChange(name, currentColor !== colorValue);
|
|
137
134
|
};
|
|
138
135
|
|
|
@@ -158,16 +155,10 @@ var ColorPickerField = function ColorPickerField(_ref) {
|
|
|
158
155
|
var label = field.label,
|
|
159
156
|
defaultValue = field.defaultValue,
|
|
160
157
|
isRequired = field.isRequired;
|
|
161
|
-
|
|
162
|
-
var _useState = useState(defaultValue || ''),
|
|
163
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
164
|
-
currentColor = _useState2[0],
|
|
165
|
-
setCurrentColor = _useState2[1];
|
|
166
|
-
|
|
167
158
|
return /*#__PURE__*/React.createElement(Field, {
|
|
168
159
|
name: name,
|
|
169
160
|
isRequired: isRequired,
|
|
170
|
-
defaultValue:
|
|
161
|
+
defaultValue: defaultValue,
|
|
171
162
|
validate: function validate(value) {
|
|
172
163
|
return _validate(field, value || '');
|
|
173
164
|
}
|
|
@@ -179,10 +170,9 @@ var ColorPickerField = function ColorPickerField(_ref) {
|
|
|
179
170
|
}, "*")), /*#__PURE__*/React.createElement(ColorPicker, {
|
|
180
171
|
name: name,
|
|
181
172
|
title: label,
|
|
182
|
-
currentColor:
|
|
173
|
+
currentColor: fieldProps.value,
|
|
183
174
|
colorPalette: colorPalette,
|
|
184
|
-
|
|
185
|
-
onChange: setCurrentColor,
|
|
175
|
+
onChange: fieldProps.onChange,
|
|
186
176
|
onFieldChange: onFieldChange
|
|
187
177
|
})), error && /*#__PURE__*/React.createElement(FieldMessages, {
|
|
188
178
|
error: error,
|
|
@@ -127,7 +127,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
127
127
|
onSelectItem = _this$props.onSelectItem,
|
|
128
128
|
showSearch = _this$props.showSearch,
|
|
129
129
|
showCategories = _this$props.showCategories,
|
|
130
|
-
mode = _this$props.mode
|
|
130
|
+
mode = _this$props.mode,
|
|
131
|
+
emptyStateHandler = _this$props.emptyStateHandler;
|
|
131
132
|
var _this$state2 = this.state,
|
|
132
133
|
categories = _this$state2.categories,
|
|
133
134
|
searchTerm = _this$state2.searchTerm,
|
|
@@ -144,7 +145,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
144
145
|
showSearch: showSearch,
|
|
145
146
|
showCategories: showCategories,
|
|
146
147
|
mode: mode,
|
|
147
|
-
searchTerm: searchTerm
|
|
148
|
+
searchTerm: searchTerm,
|
|
149
|
+
emptyStateHandler: emptyStateHandler
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
152
|
}]);
|
|
@@ -85,6 +85,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
85
85
|
}, /*#__PURE__*/React.createElement(ElementBrowser, {
|
|
86
86
|
mode: "inline",
|
|
87
87
|
getItems: getItems(quickInsertState),
|
|
88
|
+
emptyStateHandler: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.emptyStateHandler,
|
|
88
89
|
onInsertItem: onInsertItem,
|
|
89
90
|
showSearch: true,
|
|
90
91
|
showCategories: false // On page resize we want the InlineElementBrowser to show updated tools/overflow items
|