@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,53 @@
|
|
|
1
|
+
import React, { useMemo, useEffect, useContext, useLayoutEffect, createContext } from 'react';
|
|
2
|
+
import { browser } from '@atlaskit/editor-common';
|
|
3
|
+
const Context = /*#__PURE__*/createContext(null);
|
|
4
|
+
export const ResizeObserverContext = Context;
|
|
5
|
+
export const ResizeObserverProvider = /*#__PURE__*/React.memo(({
|
|
6
|
+
children
|
|
7
|
+
}) => {
|
|
8
|
+
const instance = useMemo(() => {
|
|
9
|
+
if (!browser.supportsResizeObserver) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return new window.ResizeObserver(entries => {
|
|
14
|
+
entries.forEach(entry => {
|
|
15
|
+
const {
|
|
16
|
+
onResize
|
|
17
|
+
} = entry.target;
|
|
18
|
+
|
|
19
|
+
if (onResize) {
|
|
20
|
+
onResize(entry);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
return () => {
|
|
27
|
+
if (instance) {
|
|
28
|
+
instance.disconnect();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, [instance]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
33
|
+
value: instance
|
|
34
|
+
}, children);
|
|
35
|
+
});
|
|
36
|
+
export const useResizeObserver = (targetRef, onResize) => {
|
|
37
|
+
const resizeObserver = useContext(Context);
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
if (!targetRef || !targetRef.current || resizeObserver === null) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
current: target
|
|
45
|
+
} = targetRef;
|
|
46
|
+
target.onResize = onResize;
|
|
47
|
+
resizeObserver.observe(target);
|
|
48
|
+
return () => {
|
|
49
|
+
resizeObserver.unobserve(target);
|
|
50
|
+
delete target.onResize;
|
|
51
|
+
};
|
|
52
|
+
}, [targetRef, resizeObserver, onResize]);
|
|
53
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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 const findTypeAheadDecorations = state => {
|
|
8
|
+
const {
|
|
9
|
+
selection
|
|
10
|
+
} = state;
|
|
11
|
+
const {
|
|
12
|
+
decorationSet
|
|
13
|
+
} = typeAheadPluginKey.getState(state);
|
|
14
|
+
|
|
15
|
+
if (!decorationSet || decorationSet === DecorationSet.empty || !(selection instanceof TextSelection) || !selection.$cursor) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
$cursor: {
|
|
21
|
+
pos
|
|
22
|
+
}
|
|
23
|
+
} = selection;
|
|
24
|
+
const decoration = decorationSet.find(pos, pos, spec => spec === null || spec === void 0 ? void 0 : spec.isTypeAheadDecoration);
|
|
25
|
+
|
|
26
|
+
if (!decoration || decoration.length !== 1) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return decoration[0];
|
|
31
|
+
};
|
|
32
|
+
export const isTypeAheadHandler = handler => {
|
|
33
|
+
return handler && Object.values(TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
|
|
34
|
+
};
|
|
35
|
+
export const isTypeAheadOpen = editorState => {
|
|
36
|
+
var _typeAheadPluginKey$g, _typeAheadPluginKey$g2;
|
|
37
|
+
|
|
38
|
+
return (typeAheadPluginKey === null || typeAheadPluginKey === void 0 ? void 0 : (_typeAheadPluginKey$g = typeAheadPluginKey.getState(editorState)) === null || _typeAheadPluginKey$g === void 0 ? void 0 : (_typeAheadPluginKey$g2 = _typeAheadPluginKey$g.decorationSet) === null || _typeAheadPluginKey$g2 === void 0 ? void 0 : _typeAheadPluginKey$g2.find().length) > 0;
|
|
39
|
+
};
|
|
40
|
+
export const getPluginState = editorState => {
|
|
41
|
+
return typeAheadPluginKey.getState(editorState);
|
|
42
|
+
};
|
|
43
|
+
export const getTypeAheadHandler = editorState => {
|
|
44
|
+
return typeAheadPluginKey.getState(editorState).triggerHandler;
|
|
45
|
+
};
|
|
46
|
+
export const getTypeAheadQuery = editorState => {
|
|
47
|
+
return typeAheadPluginKey.getState(editorState).query;
|
|
48
|
+
};
|
|
49
|
+
export const isTypeAheadAllowed = state => {
|
|
50
|
+
const isOpen = isTypeAheadOpen(state); // if the TypeAhead is open
|
|
51
|
+
// we should not allow it
|
|
52
|
+
|
|
53
|
+
return !isOpen;
|
|
54
|
+
};
|
|
55
|
+
export const findHandler = (id, state) => {
|
|
56
|
+
const pluginState = typeAheadPluginKey.getState(state);
|
|
57
|
+
|
|
58
|
+
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
typeAheadHandlers
|
|
64
|
+
} = pluginState;
|
|
65
|
+
return typeAheadHandlers.find(h => h.id === id) || null;
|
|
66
|
+
};
|
|
67
|
+
export const moveSelectedIndex = ({
|
|
68
|
+
editorView,
|
|
69
|
+
direction
|
|
70
|
+
}) => () => {
|
|
71
|
+
const typeAheadState = getPluginState(editorView.state);
|
|
72
|
+
|
|
73
|
+
if (!typeAheadState) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const {
|
|
78
|
+
selectedIndex,
|
|
79
|
+
items
|
|
80
|
+
} = typeAheadState;
|
|
81
|
+
const stats = typeAheadState.stats instanceof StatsModifier ? typeAheadState.stats : new StatsModifier();
|
|
82
|
+
let nextIndex = 0;
|
|
83
|
+
|
|
84
|
+
if (direction === 'next') {
|
|
85
|
+
stats.increaseArrowDown();
|
|
86
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
87
|
+
} else {
|
|
88
|
+
stats.increaseArrowUp();
|
|
89
|
+
nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
|
|
93
|
+
};
|
|
@@ -6,7 +6,34 @@ import { undo as undoKeymap, redo as redoKeymap, ToolTipContent } from '../../..
|
|
|
6
6
|
import { ButtonGroup, Separator } from '../../../../ui/styles';
|
|
7
7
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
8
8
|
import { messages } from '../../messages';
|
|
9
|
+
import { createTypeAheadTools } from '../../../type-ahead/api';
|
|
9
10
|
import { undoFromToolbar, redoFromToolbar } from '../../commands';
|
|
11
|
+
|
|
12
|
+
const closeTypeAheadAndRunCommand = editorView => command => {
|
|
13
|
+
if (!editorView) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const tool = createTypeAheadTools(editorView);
|
|
18
|
+
|
|
19
|
+
if (tool.isOpen()) {
|
|
20
|
+
tool.close({
|
|
21
|
+
attachCommand: command,
|
|
22
|
+
insertCurrentQueryAsRawText: false
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
command(editorView.state, editorView.dispatch);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const forceFocus = editorView => command => {
|
|
30
|
+
closeTypeAheadAndRunCommand(editorView)(command);
|
|
31
|
+
|
|
32
|
+
if (!editorView.hasFocus()) {
|
|
33
|
+
editorView.focus();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
10
37
|
export class ToolbarUndoRedo extends PureComponent {
|
|
11
38
|
render() {
|
|
12
39
|
const {
|
|
@@ -20,11 +47,11 @@ export class ToolbarUndoRedo extends PureComponent {
|
|
|
20
47
|
} = this.props;
|
|
21
48
|
|
|
22
49
|
const handleUndo = () => {
|
|
23
|
-
|
|
50
|
+
forceFocus(editorView)(undoFromToolbar);
|
|
24
51
|
};
|
|
25
52
|
|
|
26
53
|
const handleRedo = () => {
|
|
27
|
-
|
|
54
|
+
forceFocus(editorView)(redoFromToolbar);
|
|
28
55
|
};
|
|
29
56
|
|
|
30
57
|
const labelUndo = formatMessage(messages.undo);
|
|
@@ -24,7 +24,7 @@ class Tracker {
|
|
|
24
24
|
const pluginKey = new PluginKey('viewUpdateSubscriptionKey');
|
|
25
25
|
|
|
26
26
|
const createViewUpdateSubscriptionPlugin = () => {
|
|
27
|
-
|
|
27
|
+
let tracker;
|
|
28
28
|
const lastUpdateRef = {
|
|
29
29
|
current: null,
|
|
30
30
|
initial: null,
|
|
@@ -38,12 +38,14 @@ const createViewUpdateSubscriptionPlugin = () => {
|
|
|
38
38
|
key: pluginKey,
|
|
39
39
|
|
|
40
40
|
view(editorView) {
|
|
41
|
-
trackerStore.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
41
|
+
tracker = trackerStore.get(editorView);
|
|
42
|
+
|
|
43
|
+
if (!tracker) {
|
|
44
|
+
tracker = new Tracker();
|
|
45
|
+
trackerStore.set(editorView, tracker);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {};
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
});
|
|
@@ -62,17 +64,20 @@ const createViewUpdateSubscriptionPlugin = () => {
|
|
|
62
64
|
lastUpdateRef.initial = props;
|
|
63
65
|
lastUpdateRef.queued = true;
|
|
64
66
|
queueMicrotask(() => {
|
|
65
|
-
var _lastUpdateRef$initia;
|
|
66
|
-
|
|
67
67
|
if (!lastUpdateRef.current || !lastUpdateRef.initial) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
tracker
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
if (tracker) {
|
|
72
|
+
var _lastUpdateRef$initia;
|
|
73
|
+
|
|
74
|
+
tracker.update({
|
|
75
|
+
newEditorState: lastUpdateRef.current.newEditorState,
|
|
76
|
+
oldEditorState: (_lastUpdateRef$initia = lastUpdateRef.initial) === null || _lastUpdateRef$initia === void 0 ? void 0 : _lastUpdateRef$initia.oldEditorState,
|
|
77
|
+
transactions: lastUpdateRef.transactions
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
lastUpdateRef.queued = false;
|
|
77
82
|
lastUpdateRef.current = null;
|
|
78
83
|
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
|
const areToolbarsSame = (left, right) => {
|
|
@@ -35,6 +36,13 @@ export const subscribeToToolbarAndPickerUpdates = (editorView, cb) => {
|
|
|
35
36
|
const subscription = ({
|
|
36
37
|
newEditorState
|
|
37
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
|
+
|
|
38
46
|
const dateState = datePluginKey.getState(newEditorState);
|
|
39
47
|
const statusState = statusPluginKey.getState(newEditorState);
|
|
40
48
|
const {
|
|
@@ -52,9 +60,7 @@ export const subscribeToToolbarAndPickerUpdates = (editorView, cb) => {
|
|
|
52
60
|
const oldToolbarConfig = getOldConfigWithNodeInfo(lastUpdatedState);
|
|
53
61
|
const isToolbarEqual = areToolbarsSame(toolbarConfig, oldToolbarConfig);
|
|
54
62
|
|
|
55
|
-
if (dateState !== oldDateState || statusState !== oldStatusState ||
|
|
56
|
-
// EG A nested status or date node in a table
|
|
57
|
-
!isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
63
|
+
if (dateState !== oldDateState || statusState !== oldStatusState || !isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
58
64
|
shouldCallback = true;
|
|
59
65
|
}
|
|
60
66
|
} else {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { trackerStore } from '..';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../../type-ahead/pm-plugins/key';
|
|
3
|
+
export const subscribeTypeAheadUpdates = (editorView, cb) => {
|
|
4
|
+
const subscription = ({
|
|
5
|
+
newEditorState,
|
|
6
|
+
oldEditorState
|
|
7
|
+
}) => {
|
|
8
|
+
const newPluginState = typeAheadPluginKey.getState(newEditorState);
|
|
9
|
+
const oldPluginState = typeAheadPluginKey.getState(oldEditorState);
|
|
10
|
+
|
|
11
|
+
if (!oldPluginState || !newPluginState) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
cb({
|
|
16
|
+
oldPluginState,
|
|
17
|
+
newPluginState
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const tracker = trackerStore.get(editorView);
|
|
22
|
+
|
|
23
|
+
if (tracker) {
|
|
24
|
+
tracker.add(subscription);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
const tracker = trackerStore.get(editorView);
|
|
29
|
+
|
|
30
|
+
if (tracker) {
|
|
31
|
+
tracker.remove(subscription);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -3,7 +3,14 @@ import { sortByOrder } from './create-editor/sort-by-order';
|
|
|
3
3
|
import { Preset } from './labs/next/presets/preset';
|
|
4
4
|
import { createSchema } from './create-editor/create-schema';
|
|
5
5
|
import basePlugin from './plugins/base';
|
|
6
|
+
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
7
|
+
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
6
8
|
export { Preset } from './labs/next/presets/preset';
|
|
9
|
+
export function getFireAnalytics(editorView) {
|
|
10
|
+
var _analyticsPluginKey$g;
|
|
11
|
+
|
|
12
|
+
return analyticsPluginKey === null || analyticsPluginKey === void 0 ? void 0 : (_analyticsPluginKey$g = analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
|
|
13
|
+
}
|
|
7
14
|
|
|
8
15
|
function lightProcessPluginsList(editorPlugins) {
|
|
9
16
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Field } from '@atlaskit/form';
|
|
3
3
|
import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
|
|
4
4
|
import { isValidHex } from '../utils';
|
|
@@ -118,7 +118,6 @@ const ColorPicker = props => {
|
|
|
118
118
|
title,
|
|
119
119
|
currentColor,
|
|
120
120
|
colorPalette,
|
|
121
|
-
fieldProps,
|
|
122
121
|
onChange,
|
|
123
122
|
onFieldChange
|
|
124
123
|
} = props;
|
|
@@ -131,7 +130,6 @@ const ColorPicker = props => {
|
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
onChange(colorValue);
|
|
134
|
-
fieldProps.onChange(colorValue);
|
|
135
133
|
onFieldChange(name, currentColor !== colorValue);
|
|
136
134
|
};
|
|
137
135
|
|
|
@@ -160,11 +158,10 @@ const ColorPickerField = ({
|
|
|
160
158
|
defaultValue,
|
|
161
159
|
isRequired
|
|
162
160
|
} = field;
|
|
163
|
-
const [currentColor, setCurrentColor] = useState(defaultValue || '');
|
|
164
161
|
return /*#__PURE__*/React.createElement(Field, {
|
|
165
162
|
name: name,
|
|
166
163
|
isRequired: isRequired,
|
|
167
|
-
defaultValue:
|
|
164
|
+
defaultValue: defaultValue,
|
|
168
165
|
validate: value => validate(field, value || '')
|
|
169
166
|
}, ({
|
|
170
167
|
fieldProps,
|
|
@@ -174,10 +171,9 @@ const ColorPickerField = ({
|
|
|
174
171
|
}, "*")), /*#__PURE__*/React.createElement(ColorPicker, {
|
|
175
172
|
name: name,
|
|
176
173
|
title: label,
|
|
177
|
-
currentColor:
|
|
174
|
+
currentColor: fieldProps.value,
|
|
178
175
|
colorPalette: colorPalette,
|
|
179
|
-
|
|
180
|
-
onChange: setCurrentColor,
|
|
176
|
+
onChange: fieldProps.onChange,
|
|
181
177
|
onFieldChange: onFieldChange
|
|
182
178
|
})), error && /*#__PURE__*/React.createElement(FieldMessages, {
|
|
183
179
|
error: error,
|
|
@@ -66,16 +66,16 @@ export const serialize = async (manifest, data, fields, depth = 0) => {
|
|
|
66
66
|
} // WARNING: don't recursively serialize, limit to depth < 1
|
|
67
67
|
// serializable?
|
|
68
68
|
else if (isFieldset(field) && depth === 0) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
69
|
+
const fieldSerializer = await getFieldSerializer(manifest, field.options.transformer);
|
|
70
|
+
|
|
71
|
+
if (fieldSerializer) {
|
|
72
|
+
const {
|
|
73
|
+
fields: fieldsetFields
|
|
74
|
+
} = field;
|
|
75
|
+
const extracted = await serialize(manifest, value, fieldsetFields, depth + 1);
|
|
76
|
+
value = fieldSerializer(extracted);
|
|
78
77
|
}
|
|
78
|
+
}
|
|
79
79
|
|
|
80
80
|
result.push({
|
|
81
81
|
[field.name]: value
|
|
@@ -94,7 +94,8 @@ export default class ElementBrowser extends PureComponent {
|
|
|
94
94
|
onSelectItem,
|
|
95
95
|
showSearch,
|
|
96
96
|
showCategories,
|
|
97
|
-
mode
|
|
97
|
+
mode,
|
|
98
|
+
emptyStateHandler
|
|
98
99
|
} = this.props;
|
|
99
100
|
const {
|
|
100
101
|
categories,
|
|
@@ -113,7 +114,8 @@ export default class ElementBrowser extends PureComponent {
|
|
|
113
114
|
showSearch: showSearch,
|
|
114
115
|
showCategories: showCategories,
|
|
115
116
|
mode: mode,
|
|
116
|
-
searchTerm: searchTerm
|
|
117
|
+
searchTerm: searchTerm,
|
|
118
|
+
emptyStateHandler: emptyStateHandler
|
|
117
119
|
});
|
|
118
120
|
}
|
|
119
121
|
|
|
@@ -67,6 +67,7 @@ const InsertMenu = ({
|
|
|
67
67
|
}, /*#__PURE__*/React.createElement(ElementBrowser, {
|
|
68
68
|
mode: "inline",
|
|
69
69
|
getItems: getItems(quickInsertState),
|
|
70
|
+
emptyStateHandler: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.emptyStateHandler,
|
|
70
71
|
onInsertItem: onInsertItem,
|
|
71
72
|
showSearch: true,
|
|
72
73
|
showCategories: false // On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React, { useState, useCallback } from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { injectIntl } from 'react-intl';
|
|
@@ -6,7 +5,7 @@ import { DN50, N0 } from '@atlaskit/theme/colors';
|
|
|
6
5
|
import { themed } from '@atlaskit/theme/components';
|
|
7
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
8
7
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
9
|
-
import Modal, {
|
|
8
|
+
import Modal, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
|
|
10
9
|
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
11
10
|
import ElementBrowser from './components/ElementBrowserLoader';
|
|
12
11
|
import { getCategories } from './categories';
|
|
@@ -25,10 +24,10 @@ const ModalElementBrowser = props => {
|
|
|
25
24
|
const onInsertItem = useCallback(item => {
|
|
26
25
|
props.onInsertItem(item);
|
|
27
26
|
}, [props]);
|
|
28
|
-
const RenderFooter = useCallback(
|
|
27
|
+
const RenderFooter = useCallback(() => /*#__PURE__*/React.createElement(Footer, {
|
|
29
28
|
onInsert: () => onInsertItem(selectedItem),
|
|
30
29
|
beforeElement: helpUrl ? HelpLink(helpUrl, intl.formatMessage(messages.help)) : undefined
|
|
31
|
-
})
|
|
30
|
+
}), [onInsertItem, selectedItem, helpUrl, intl]); // Since Modal uses stackIndex it's shouldCloseOnEscapePress prop doesn't work.
|
|
32
31
|
|
|
33
32
|
const onKeyDown = useCallback(e => {
|
|
34
33
|
if (e.key === 'Escape') {
|
|
@@ -42,12 +41,9 @@ const ModalElementBrowser = props => {
|
|
|
42
41
|
showCategories: true,
|
|
43
42
|
mode: "full",
|
|
44
43
|
onSelectItem: onSelectItem,
|
|
45
|
-
onInsertItem: onInsertItem
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Body: RenderBody,
|
|
49
|
-
Footer: RenderFooter
|
|
50
|
-
};
|
|
44
|
+
onInsertItem: onInsertItem,
|
|
45
|
+
emptyStateHandler: props.emptyStateHandler
|
|
46
|
+
})), [props.intl, props.getItems, onSelectItem, onInsertItem, props.emptyStateHandler]);
|
|
51
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
52
48
|
"data-editor-popup": true,
|
|
53
49
|
onClick: onModalClick,
|
|
@@ -60,12 +56,11 @@ const ModalElementBrowser = props => {
|
|
|
60
56
|
onClose: props.onClose,
|
|
61
57
|
height: "664px",
|
|
62
58
|
width: "x-large",
|
|
63
|
-
autoFocus: false
|
|
64
|
-
components: components // defaults to true and doesn't work along with stackIndex=1.
|
|
59
|
+
autoFocus: false // defaults to true and doesn't work along with stackIndex=1.
|
|
65
60
|
// packages/design-system/modal-dialog/src/components/Content.tsx Line 287
|
|
66
61
|
,
|
|
67
62
|
shouldCloseOnEscapePress: false
|
|
68
|
-
})));
|
|
63
|
+
}, /*#__PURE__*/React.createElement(RenderBody, null), /*#__PURE__*/React.createElement(RenderFooter, null))));
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
ModalElementBrowser.displayName = 'ModalElementBrowser'; // Prevent ModalElementBrowser click propagation through to the editor.
|
|
@@ -74,16 +69,12 @@ const onModalClick = e => e.stopPropagation();
|
|
|
74
69
|
|
|
75
70
|
const Footer = ({
|
|
76
71
|
onInsert,
|
|
77
|
-
onClose,
|
|
78
|
-
showKeyline,
|
|
79
72
|
beforeElement
|
|
80
73
|
}) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}, beforeElement ? beforeElement : /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement(Actions, null, /*#__PURE__*/React.createElement(ActionItem, null, /*#__PURE__*/React.createElement(Button, {
|
|
74
|
+
const {
|
|
75
|
+
onClose
|
|
76
|
+
} = useModal();
|
|
77
|
+
return /*#__PURE__*/React.createElement(ModalFooter, null, beforeElement ? beforeElement : /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement(Actions, null, /*#__PURE__*/React.createElement(ActionItem, null, /*#__PURE__*/React.createElement(Button, {
|
|
87
78
|
appearance: "primary",
|
|
88
79
|
onClick: onInsert,
|
|
89
80
|
testId: "ModalElementBrowser__insert-button"
|
|
@@ -125,4 +116,12 @@ const Wrapper = styled.div`
|
|
|
125
116
|
})()};
|
|
126
117
|
border-radius: ${borderRadius()}px;
|
|
127
118
|
`;
|
|
119
|
+
const ModalFooter = styled.div`
|
|
120
|
+
display: flex;
|
|
121
|
+
padding: ${MODAL_WRAPPER_PADDING}px;
|
|
122
|
+
|
|
123
|
+
position: relative;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
`;
|
|
128
127
|
export default injectIntl(ModalElementBrowser);
|
|
@@ -11,7 +11,7 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
|
11
11
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../../plugins/analytics';
|
|
13
13
|
import IconFallback from '../../../../plugins/quick-insert/assets/fallback';
|
|
14
|
-
import { ItemIcon } from '../../../../plugins/type-ahead/ui/
|
|
14
|
+
import { ItemIcon } from '../../../../plugins/type-ahead/ui/TypeAheadListItem';
|
|
15
15
|
import { Shortcut } from '../../../styles';
|
|
16
16
|
import { ELEMENT_ITEM_HEIGHT, ELEMENT_LIST_PADDING, GRID_SIZE, SCROLLBAR_THUMB_COLOR, SCROLLBAR_TRACK_COLOR, SCROLLBAR_WIDTH } from '../../constants';
|
|
17
17
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
@@ -28,6 +28,9 @@ function ElementList({
|
|
|
28
28
|
focusedItemIndex,
|
|
29
29
|
setColumnCount,
|
|
30
30
|
createAnalyticsEvent,
|
|
31
|
+
emptyStateHandler,
|
|
32
|
+
selectedCategory,
|
|
33
|
+
searchTerm,
|
|
31
34
|
...props
|
|
32
35
|
}) {
|
|
33
36
|
const {
|
|
@@ -77,7 +80,11 @@ function ElementList({
|
|
|
77
80
|
focus: focusedItemIndex === index
|
|
78
81
|
}, props)));
|
|
79
82
|
}, [items, fullMode, selectedItemIndex, focusedItemIndex, props]);
|
|
80
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContainerWidthMonitor, null), !items.length ?
|
|
83
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContainerWidthMonitor, null), !items.length ? emptyStateHandler ? emptyStateHandler({
|
|
84
|
+
mode,
|
|
85
|
+
selectedCategory,
|
|
86
|
+
searchTerm
|
|
87
|
+
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
81
88
|
onExternalLinkClick: onExternalLinkClick
|
|
82
89
|
}) : /*#__PURE__*/React.createElement(ElementItemsWrapper, {
|
|
83
90
|
"data-testid": "element-items"
|
|
@@ -124,7 +124,8 @@ function MobileBrowser({
|
|
|
124
124
|
onKeyPress,
|
|
125
125
|
onKeyDown,
|
|
126
126
|
searchTerm,
|
|
127
|
-
createAnalyticsEvent
|
|
127
|
+
createAnalyticsEvent,
|
|
128
|
+
emptyStateHandler
|
|
128
129
|
}) {
|
|
129
130
|
return /*#__PURE__*/React.createElement(MobileElementBrowserContainer, {
|
|
130
131
|
onKeyPress: onKeyPress,
|
|
@@ -152,7 +153,10 @@ function MobileBrowser({
|
|
|
152
153
|
focusedItemIndex: focusedItemIndex,
|
|
153
154
|
setFocusedItemIndex: setFocusedItemIndex,
|
|
154
155
|
setColumnCount: setColumnCount,
|
|
155
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
156
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
157
|
+
emptyStateHandler: emptyStateHandler,
|
|
158
|
+
selectedCategory: selectedCategory,
|
|
159
|
+
searchTerm: searchTerm
|
|
156
160
|
})));
|
|
157
161
|
}
|
|
158
162
|
|
|
@@ -175,7 +179,8 @@ function DesktopBrowser({
|
|
|
175
179
|
onKeyPress,
|
|
176
180
|
onKeyDown,
|
|
177
181
|
searchTerm,
|
|
178
|
-
createAnalyticsEvent
|
|
182
|
+
createAnalyticsEvent,
|
|
183
|
+
emptyStateHandler
|
|
179
184
|
}) {
|
|
180
185
|
return /*#__PURE__*/React.createElement(ElementBrowserContainer, {
|
|
181
186
|
"data-testid": "desktop__element-browser"
|
|
@@ -207,7 +212,10 @@ function DesktopBrowser({
|
|
|
207
212
|
focusedItemIndex: focusedItemIndex,
|
|
208
213
|
setFocusedItemIndex: setFocusedItemIndex,
|
|
209
214
|
setColumnCount: setColumnCount,
|
|
210
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
215
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
216
|
+
emptyStateHandler: emptyStateHandler,
|
|
217
|
+
selectedCategory: selectedCategory,
|
|
218
|
+
searchTerm: searchTerm
|
|
211
219
|
})));
|
|
212
220
|
}
|
|
213
221
|
|
|
@@ -143,9 +143,7 @@ export default class PanelTextInput extends PureComponent {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
isUndoEvent(event) {
|
|
146
|
-
return event.keyCode === KeyZCode && (
|
|
147
|
-
browser.mac && event.metaKey && !event.shiftKey || // ctrl + z for non-mac
|
|
148
|
-
!browser.mac && event.ctrlKey);
|
|
146
|
+
return event.keyCode === KeyZCode && (browser.mac && event.metaKey && !event.shiftKey || !browser.mac && event.ctrlKey);
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
isRedoEvent(event) {
|
|
@@ -26,13 +26,13 @@ export const serializeValue = value => {
|
|
|
26
26
|
} // Calling toString of function returns whole function text with body.
|
|
27
27
|
// So, just return function with name.
|
|
28
28
|
else if (valueType === 'function') {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
return `function:${value.name}`;
|
|
30
|
+
} else if (valueType === 'object') {
|
|
31
|
+
return {
|
|
32
|
+
type: 'object',
|
|
33
|
+
keys: Object.keys(value)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
36
|
};
|
|
37
37
|
export const getPropsDifference = (object1, object2, curDepth = 0, maxDepth = 2, keysToIgnore = []) => {
|
|
38
38
|
const {
|
|
@@ -278,17 +278,16 @@ export function liftSelection(tr, doc, $from, $to) {
|
|
|
278
278
|
let endPos = $to.end($to.depth);
|
|
279
279
|
const target = Math.max(0, findAncestorPosition(doc, $from).depth - 1);
|
|
280
280
|
tr.doc.nodesBetween(startPos, endPos, (node, pos) => {
|
|
281
|
-
if (node.isText || //
|
|
282
|
-
node.isTextblock && !node.textContent // Empty paragraph
|
|
281
|
+
if (node.isText || node.isTextblock && !node.textContent // Empty paragraph
|
|
283
282
|
) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
const res = tr.doc.resolve(tr.mapping.map(pos));
|
|
284
|
+
const sel = new NodeSelection(res);
|
|
285
|
+
const range = sel.$from.blockRange(sel.$to);
|
|
287
286
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
287
|
+
if (liftTarget(range) !== undefined) {
|
|
288
|
+
tr.lift(range, target);
|
|
291
289
|
}
|
|
290
|
+
}
|
|
292
291
|
});
|
|
293
292
|
startPos = tr.mapping.map(startPos);
|
|
294
293
|
endPos = tr.mapping.map(endPos);
|