@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,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useResizeObserver = exports.ResizeObserverProvider = exports.ResizeObserverContext = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _editorCommon = require("@atlaskit/editor-common");
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
var Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
19
|
+
var ResizeObserverContext = Context;
|
|
20
|
+
exports.ResizeObserverContext = ResizeObserverContext;
|
|
21
|
+
|
|
22
|
+
var ResizeObserverProvider = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
23
|
+
var children = _ref.children;
|
|
24
|
+
var instance = (0, _react.useMemo)(function () {
|
|
25
|
+
if (!_editorCommon.browser.supportsResizeObserver) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return new window.ResizeObserver(function (entries) {
|
|
30
|
+
entries.forEach(function (entry) {
|
|
31
|
+
var onResize = entry.target.onResize;
|
|
32
|
+
|
|
33
|
+
if (onResize) {
|
|
34
|
+
onResize(entry);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
(0, _react.useEffect)(function () {
|
|
40
|
+
return function () {
|
|
41
|
+
if (instance) {
|
|
42
|
+
instance.disconnect();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, [instance]);
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
47
|
+
value: instance
|
|
48
|
+
}, children);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.ResizeObserverProvider = ResizeObserverProvider;
|
|
52
|
+
|
|
53
|
+
var useResizeObserver = function useResizeObserver(targetRef, onResize) {
|
|
54
|
+
var resizeObserver = (0, _react.useContext)(Context);
|
|
55
|
+
(0, _react.useLayoutEffect)(function () {
|
|
56
|
+
if (!targetRef || !targetRef.current || resizeObserver === null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var target = targetRef.current;
|
|
61
|
+
target.onResize = onResize;
|
|
62
|
+
resizeObserver.observe(target);
|
|
63
|
+
return function () {
|
|
64
|
+
resizeObserver.unobserve(target);
|
|
65
|
+
delete target.onResize;
|
|
66
|
+
};
|
|
67
|
+
}, [targetRef, resizeObserver, onResize]);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.useResizeObserver = useResizeObserver;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.moveSelectedIndex = exports.findHandler = exports.isTypeAheadAllowed = exports.getTypeAheadQuery = exports.getTypeAheadHandler = exports.getPluginState = exports.isTypeAheadOpen = exports.isTypeAheadHandler = exports.findTypeAheadDecorations = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var _prosemirrorView = require("prosemirror-view");
|
|
11
|
+
|
|
12
|
+
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
13
|
+
|
|
14
|
+
var _key = require("./pm-plugins/key");
|
|
15
|
+
|
|
16
|
+
var _updateSelectedIndex = require("./commands/update-selected-index");
|
|
17
|
+
|
|
18
|
+
var _statsModifier = require("./stats-modifier");
|
|
19
|
+
|
|
20
|
+
var findTypeAheadDecorations = function findTypeAheadDecorations(state) {
|
|
21
|
+
var selection = state.selection;
|
|
22
|
+
|
|
23
|
+
var _typeAheadPluginKey$g = _key.pluginKey.getState(state),
|
|
24
|
+
decorationSet = _typeAheadPluginKey$g.decorationSet;
|
|
25
|
+
|
|
26
|
+
if (!decorationSet || decorationSet === _prosemirrorView.DecorationSet.empty || !(selection instanceof _prosemirrorState.TextSelection) || !selection.$cursor) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var pos = selection.$cursor.pos;
|
|
31
|
+
var decoration = decorationSet.find(pos, pos, function (spec) {
|
|
32
|
+
return spec === null || spec === void 0 ? void 0 : spec.isTypeAheadDecoration;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!decoration || decoration.length !== 1) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return decoration[0];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.findTypeAheadDecorations = findTypeAheadDecorations;
|
|
43
|
+
|
|
44
|
+
var isTypeAheadHandler = function isTypeAheadHandler(handler) {
|
|
45
|
+
return handler && Object.values(_typeAhead.TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.isTypeAheadHandler = isTypeAheadHandler;
|
|
49
|
+
|
|
50
|
+
var isTypeAheadOpen = function isTypeAheadOpen(editorState) {
|
|
51
|
+
var _typeAheadPluginKey$g2, _typeAheadPluginKey$g3;
|
|
52
|
+
|
|
53
|
+
return (_key.pluginKey === null || _key.pluginKey === void 0 ? void 0 : (_typeAheadPluginKey$g2 = _key.pluginKey.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;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.isTypeAheadOpen = isTypeAheadOpen;
|
|
57
|
+
|
|
58
|
+
var getPluginState = function getPluginState(editorState) {
|
|
59
|
+
return _key.pluginKey.getState(editorState);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.getPluginState = getPluginState;
|
|
63
|
+
|
|
64
|
+
var getTypeAheadHandler = function getTypeAheadHandler(editorState) {
|
|
65
|
+
return _key.pluginKey.getState(editorState).triggerHandler;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.getTypeAheadHandler = getTypeAheadHandler;
|
|
69
|
+
|
|
70
|
+
var getTypeAheadQuery = function getTypeAheadQuery(editorState) {
|
|
71
|
+
return _key.pluginKey.getState(editorState).query;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
exports.getTypeAheadQuery = getTypeAheadQuery;
|
|
75
|
+
|
|
76
|
+
var isTypeAheadAllowed = function isTypeAheadAllowed(state) {
|
|
77
|
+
var isOpen = isTypeAheadOpen(state); // if the TypeAhead is open
|
|
78
|
+
// we should not allow it
|
|
79
|
+
|
|
80
|
+
return !isOpen;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.isTypeAheadAllowed = isTypeAheadAllowed;
|
|
84
|
+
|
|
85
|
+
var findHandler = function findHandler(id, state) {
|
|
86
|
+
var pluginState = _key.pluginKey.getState(state);
|
|
87
|
+
|
|
88
|
+
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var typeAheadHandlers = pluginState.typeAheadHandlers;
|
|
93
|
+
return typeAheadHandlers.find(function (h) {
|
|
94
|
+
return h.id === id;
|
|
95
|
+
}) || null;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.findHandler = findHandler;
|
|
99
|
+
|
|
100
|
+
var moveSelectedIndex = function moveSelectedIndex(_ref) {
|
|
101
|
+
var editorView = _ref.editorView,
|
|
102
|
+
direction = _ref.direction;
|
|
103
|
+
return function () {
|
|
104
|
+
var typeAheadState = getPluginState(editorView.state);
|
|
105
|
+
|
|
106
|
+
if (!typeAheadState) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var selectedIndex = typeAheadState.selectedIndex,
|
|
111
|
+
items = typeAheadState.items;
|
|
112
|
+
var stats = typeAheadState.stats instanceof _statsModifier.StatsModifier ? typeAheadState.stats : new _statsModifier.StatsModifier();
|
|
113
|
+
var nextIndex = 0;
|
|
114
|
+
|
|
115
|
+
if (direction === 'next') {
|
|
116
|
+
stats.increaseArrowDown();
|
|
117
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
118
|
+
} else {
|
|
119
|
+
stats.increaseArrowUp();
|
|
120
|
+
nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
(0, _updateSelectedIndex.updateSelectedIndex)(nextIndex)(editorView.state, editorView.dispatch);
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
exports.moveSelectedIndex = moveSelectedIndex;
|
|
@@ -35,6 +35,8 @@ var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButt
|
|
|
35
35
|
|
|
36
36
|
var _messages = require("../../messages");
|
|
37
37
|
|
|
38
|
+
var _api = require("../../../type-ahead/api");
|
|
39
|
+
|
|
38
40
|
var _commands = require("../../commands");
|
|
39
41
|
|
|
40
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -45,6 +47,35 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
45
47
|
|
|
46
48
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
49
|
|
|
50
|
+
var closeTypeAheadAndRunCommand = function closeTypeAheadAndRunCommand(editorView) {
|
|
51
|
+
return function (command) {
|
|
52
|
+
if (!editorView) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var tool = (0, _api.createTypeAheadTools)(editorView);
|
|
57
|
+
|
|
58
|
+
if (tool.isOpen()) {
|
|
59
|
+
tool.close({
|
|
60
|
+
attachCommand: command,
|
|
61
|
+
insertCurrentQueryAsRawText: false
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
command(editorView.state, editorView.dispatch);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var forceFocus = function forceFocus(editorView) {
|
|
70
|
+
return function (command) {
|
|
71
|
+
closeTypeAheadAndRunCommand(editorView)(command);
|
|
72
|
+
|
|
73
|
+
if (!editorView.hasFocus()) {
|
|
74
|
+
editorView.focus();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
48
79
|
var ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
|
|
49
80
|
(0, _inherits2.default)(ToolbarUndoRedo, _PureComponent);
|
|
50
81
|
|
|
@@ -66,11 +97,11 @@ var ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
|
|
|
66
97
|
formatMessage = _this$props.intl.formatMessage;
|
|
67
98
|
|
|
68
99
|
var handleUndo = function handleUndo() {
|
|
69
|
-
(
|
|
100
|
+
forceFocus(editorView)(_commands.undoFromToolbar);
|
|
70
101
|
};
|
|
71
102
|
|
|
72
103
|
var handleRedo = function handleRedo() {
|
|
73
|
-
(
|
|
104
|
+
forceFocus(editorView)(_commands.redoFromToolbar);
|
|
74
105
|
};
|
|
75
106
|
|
|
76
107
|
var labelUndo = formatMessage(_messages.messages.undo);
|
|
@@ -41,7 +41,7 @@ var Tracker = function Tracker() {
|
|
|
41
41
|
var pluginKey = new _prosemirrorState.PluginKey('viewUpdateSubscriptionKey');
|
|
42
42
|
|
|
43
43
|
var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPlugin() {
|
|
44
|
-
var tracker
|
|
44
|
+
var tracker;
|
|
45
45
|
var lastUpdateRef = {
|
|
46
46
|
current: null,
|
|
47
47
|
initial: null,
|
|
@@ -55,12 +55,14 @@ var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPl
|
|
|
55
55
|
return new _prosemirrorState.Plugin({
|
|
56
56
|
key: pluginKey,
|
|
57
57
|
view: function view(editorView) {
|
|
58
|
-
trackerStore.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
58
|
+
tracker = trackerStore.get(editorView);
|
|
59
|
+
|
|
60
|
+
if (!tracker) {
|
|
61
|
+
tracker = new Tracker();
|
|
62
|
+
trackerStore.set(editorView, tracker);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {};
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
};
|
|
@@ -81,17 +83,20 @@ var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPl
|
|
|
81
83
|
lastUpdateRef.initial = props;
|
|
82
84
|
lastUpdateRef.queued = true;
|
|
83
85
|
queueMicrotask(function () {
|
|
84
|
-
var _lastUpdateRef$initia;
|
|
85
|
-
|
|
86
86
|
if (!lastUpdateRef.current || !lastUpdateRef.initial) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
tracker
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
if (tracker) {
|
|
91
|
+
var _lastUpdateRef$initia;
|
|
92
|
+
|
|
93
|
+
tracker.update({
|
|
94
|
+
newEditorState: lastUpdateRef.current.newEditorState,
|
|
95
|
+
oldEditorState: (_lastUpdateRef$initia = lastUpdateRef.initial) === null || _lastUpdateRef$initia === void 0 ? void 0 : _lastUpdateRef$initia.oldEditorState,
|
|
96
|
+
transactions: lastUpdateRef.transactions
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
lastUpdateRef.queued = false;
|
|
96
101
|
lastUpdateRef.current = null;
|
|
97
102
|
lastUpdateRef.transactions = [];
|
|
@@ -13,6 +13,8 @@ var _pluginKey2 = require("../../status/plugin-key");
|
|
|
13
13
|
|
|
14
14
|
var _Toolbar = require("../../floating-toolbar/ui/Toolbar");
|
|
15
15
|
|
|
16
|
+
var _utils = require("../../type-ahead/utils");
|
|
17
|
+
|
|
16
18
|
var _ = require("..");
|
|
17
19
|
|
|
18
20
|
var areToolbarsSame = function areToolbarsSame(left, right) {
|
|
@@ -46,6 +48,13 @@ var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPickerUpd
|
|
|
46
48
|
var subscription = function subscription(_ref) {
|
|
47
49
|
var newEditorState = _ref.newEditorState;
|
|
48
50
|
|
|
51
|
+
// TypeAhead has priority in the mobile-bridge
|
|
52
|
+
// In case it is open we don't need to send
|
|
53
|
+
// any toolbar updates don't need to be send
|
|
54
|
+
if ((0, _utils.isTypeAheadOpen)(newEditorState)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
var dateState = _pluginKey.pluginKey.getState(newEditorState);
|
|
50
59
|
|
|
51
60
|
var statusState = _pluginKey2.pluginKey.getState(newEditorState);
|
|
@@ -67,9 +76,7 @@ var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPickerUpd
|
|
|
67
76
|
var oldToolbarConfig = getOldConfigWithNodeInfo(lastUpdatedState);
|
|
68
77
|
var isToolbarEqual = areToolbarsSame(toolbarConfig, oldToolbarConfig);
|
|
69
78
|
|
|
70
|
-
if (dateState !== oldDateState || statusState !== oldStatusState ||
|
|
71
|
-
// EG A nested status or date node in a table
|
|
72
|
-
!isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
79
|
+
if (dateState !== oldDateState || statusState !== oldStatusState || !isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
|
|
73
80
|
shouldCallback = true;
|
|
74
81
|
}
|
|
75
82
|
} else {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.subscribeTypeAheadUpdates = void 0;
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _key = require("../../type-ahead/pm-plugins/key");
|
|
11
|
+
|
|
12
|
+
var subscribeTypeAheadUpdates = function subscribeTypeAheadUpdates(editorView, cb) {
|
|
13
|
+
var subscription = function subscription(_ref) {
|
|
14
|
+
var newEditorState = _ref.newEditorState,
|
|
15
|
+
oldEditorState = _ref.oldEditorState;
|
|
16
|
+
|
|
17
|
+
var newPluginState = _key.pluginKey.getState(newEditorState);
|
|
18
|
+
|
|
19
|
+
var oldPluginState = _key.pluginKey.getState(oldEditorState);
|
|
20
|
+
|
|
21
|
+
if (!oldPluginState || !newPluginState) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
cb({
|
|
26
|
+
oldPluginState: oldPluginState,
|
|
27
|
+
newPluginState: newPluginState
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var tracker = _.trackerStore.get(editorView);
|
|
32
|
+
|
|
33
|
+
if (tracker) {
|
|
34
|
+
tracker.add(subscription);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return function () {
|
|
38
|
+
var tracker = _.trackerStore.get(editorView);
|
|
39
|
+
|
|
40
|
+
if (tracker) {
|
|
41
|
+
tracker.remove(subscription);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.subscribeTypeAheadUpdates = subscribeTypeAheadUpdates;
|
package/dist/cjs/test-utils.js
CHANGED
|
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.getFireAnalytics = getFireAnalytics;
|
|
8
9
|
exports.setTextSelection = setTextSelection;
|
|
9
10
|
Object.defineProperty(exports, "Preset", {
|
|
10
11
|
enumerable: true,
|
|
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "Preset", {
|
|
|
12
13
|
return _preset.Preset;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "createTypeAheadTools", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _api.createTypeAheadTools;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
Object.defineProperty(exports, "PortalProviderAPI", {
|
|
16
23
|
enumerable: true,
|
|
17
24
|
get: function get() {
|
|
@@ -52,6 +59,10 @@ var _createSchema = require("./create-editor/create-schema");
|
|
|
52
59
|
|
|
53
60
|
var _base = _interopRequireDefault(require("./plugins/base"));
|
|
54
61
|
|
|
62
|
+
var _pluginKey = require("./plugins/analytics/plugin-key");
|
|
63
|
+
|
|
64
|
+
var _api = require("./plugins/type-ahead/api");
|
|
65
|
+
|
|
55
66
|
var _PortalProvider = require("./ui/PortalProvider");
|
|
56
67
|
|
|
57
68
|
var _eventDispatcher = require("./event-dispatcher");
|
|
@@ -62,6 +73,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
62
73
|
|
|
63
74
|
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) { (0, _defineProperty2.default)(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; }
|
|
64
75
|
|
|
76
|
+
function getFireAnalytics(editorView) {
|
|
77
|
+
var _analyticsPluginKey$g;
|
|
78
|
+
|
|
79
|
+
return _pluginKey.analyticsPluginKey === null || _pluginKey.analyticsPluginKey === void 0 ? void 0 : (_analyticsPluginKey$g = _pluginKey.analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
function lightProcessPluginsList(editorPlugins) {
|
|
66
83
|
/**
|
|
67
84
|
* First pass to collect pluginsOptions
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
9
|
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
11
|
|
|
16
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
13
|
|
|
18
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
15
|
|
|
20
16
|
var _form = require("@atlaskit/form");
|
|
21
17
|
|
|
@@ -37,10 +33,6 @@ var _ColorPickerButton = _interopRequireDefault(require("../../ColorPickerButton
|
|
|
37
33
|
|
|
38
34
|
var _templateObject, _templateObject2;
|
|
39
35
|
|
|
40
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
|
-
|
|
42
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
-
|
|
44
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
45
37
|
|
|
46
38
|
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) { (0, _defineProperty2.default)(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; }
|
|
@@ -147,7 +139,6 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
147
139
|
title = props.title,
|
|
148
140
|
currentColor = props.currentColor,
|
|
149
141
|
colorPalette = props.colorPalette,
|
|
150
|
-
fieldProps = props.fieldProps,
|
|
151
142
|
onChange = props.onChange,
|
|
152
143
|
onFieldChange = props.onFieldChange;
|
|
153
144
|
|
|
@@ -159,7 +150,6 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
159
150
|
}
|
|
160
151
|
|
|
161
152
|
onChange(colorValue);
|
|
162
|
-
fieldProps.onChange(colorValue);
|
|
163
153
|
onFieldChange(name, currentColor !== colorValue);
|
|
164
154
|
};
|
|
165
155
|
|
|
@@ -185,16 +175,10 @@ var ColorPickerField = function ColorPickerField(_ref) {
|
|
|
185
175
|
var label = field.label,
|
|
186
176
|
defaultValue = field.defaultValue,
|
|
187
177
|
isRequired = field.isRequired;
|
|
188
|
-
|
|
189
|
-
var _useState = (0, _react.useState)(defaultValue || ''),
|
|
190
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
191
|
-
currentColor = _useState2[0],
|
|
192
|
-
setCurrentColor = _useState2[1];
|
|
193
|
-
|
|
194
178
|
return /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
195
179
|
name: name,
|
|
196
180
|
isRequired: isRequired,
|
|
197
|
-
defaultValue:
|
|
181
|
+
defaultValue: defaultValue,
|
|
198
182
|
validate: function validate(value) {
|
|
199
183
|
return (0, _utils.validate)(field, value || '');
|
|
200
184
|
}
|
|
@@ -206,10 +190,9 @@ var ColorPickerField = function ColorPickerField(_ref) {
|
|
|
206
190
|
}, "*")), /*#__PURE__*/_react.default.createElement(ColorPicker, {
|
|
207
191
|
name: name,
|
|
208
192
|
title: label,
|
|
209
|
-
currentColor:
|
|
193
|
+
currentColor: fieldProps.value,
|
|
210
194
|
colorPalette: colorPalette,
|
|
211
|
-
|
|
212
|
-
onChange: setCurrentColor,
|
|
195
|
+
onChange: fieldProps.onChange,
|
|
213
196
|
onFieldChange: onFieldChange
|
|
214
197
|
})), error && /*#__PURE__*/_react.default.createElement(_FieldMessages.default, {
|
|
215
198
|
error: error,
|
|
@@ -142,7 +142,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
142
142
|
onSelectItem = _this$props.onSelectItem,
|
|
143
143
|
showSearch = _this$props.showSearch,
|
|
144
144
|
showCategories = _this$props.showCategories,
|
|
145
|
-
mode = _this$props.mode
|
|
145
|
+
mode = _this$props.mode,
|
|
146
|
+
emptyStateHandler = _this$props.emptyStateHandler;
|
|
146
147
|
var _this$state2 = this.state,
|
|
147
148
|
categories = _this$state2.categories,
|
|
148
149
|
searchTerm = _this$state2.searchTerm,
|
|
@@ -159,7 +160,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
|
|
|
159
160
|
showSearch: showSearch,
|
|
160
161
|
showCategories: showCategories,
|
|
161
162
|
mode: mode,
|
|
162
|
-
searchTerm: searchTerm
|
|
163
|
+
searchTerm: searchTerm,
|
|
164
|
+
emptyStateHandler: emptyStateHandler
|
|
163
165
|
});
|
|
164
166
|
}
|
|
165
167
|
}]);
|
|
@@ -113,6 +113,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
113
113
|
}, /*#__PURE__*/_react.default.createElement(_ElementBrowserLoader.default, {
|
|
114
114
|
mode: "inline",
|
|
115
115
|
getItems: getItems(quickInsertState),
|
|
116
|
+
emptyStateHandler: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.emptyStateHandler,
|
|
116
117
|
onInsertItem: onInsertItem,
|
|
117
118
|
showSearch: true,
|
|
118
119
|
showCategories: false // On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
@@ -11,8 +11,6 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
15
|
|
|
18
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -41,7 +39,7 @@ var _constants2 = require("./constants");
|
|
|
41
39
|
|
|
42
40
|
var _messages = require("./messages");
|
|
43
41
|
|
|
44
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
42
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
45
43
|
|
|
46
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
45
|
|
|
@@ -61,13 +59,13 @@ var ModalElementBrowser = function ModalElementBrowser(props) {
|
|
|
61
59
|
var onInsertItem = (0, _react.useCallback)(function (item) {
|
|
62
60
|
props.onInsertItem(item);
|
|
63
61
|
}, [props]);
|
|
64
|
-
var RenderFooter = (0, _react.useCallback)(function (
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(Footer,
|
|
62
|
+
var RenderFooter = (0, _react.useCallback)(function () {
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(Footer, {
|
|
66
64
|
onInsert: function onInsert() {
|
|
67
65
|
return onInsertItem(selectedItem);
|
|
68
66
|
},
|
|
69
67
|
beforeElement: helpUrl ? HelpLink(helpUrl, intl.formatMessage(_messages.messages.help)) : undefined
|
|
70
|
-
})
|
|
68
|
+
});
|
|
71
69
|
}, [onInsertItem, selectedItem, helpUrl, intl]); // Since Modal uses stackIndex it's shouldCloseOnEscapePress prop doesn't work.
|
|
72
70
|
|
|
73
71
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
@@ -83,13 +81,10 @@ var ModalElementBrowser = function ModalElementBrowser(props) {
|
|
|
83
81
|
showCategories: true,
|
|
84
82
|
mode: "full",
|
|
85
83
|
onSelectItem: onSelectItem,
|
|
86
|
-
onInsertItem: onInsertItem
|
|
84
|
+
onInsertItem: onInsertItem,
|
|
85
|
+
emptyStateHandler: props.emptyStateHandler
|
|
87
86
|
}));
|
|
88
|
-
}, [props.intl, props.getItems, onSelectItem, onInsertItem]);
|
|
89
|
-
var components = {
|
|
90
|
-
Body: RenderBody,
|
|
91
|
-
Footer: RenderFooter
|
|
92
|
-
};
|
|
87
|
+
}, [props.intl, props.getItems, onSelectItem, onInsertItem, props.emptyStateHandler]);
|
|
93
88
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
94
89
|
"data-editor-popup": true,
|
|
95
90
|
onClick: onModalClick,
|
|
@@ -102,12 +97,11 @@ var ModalElementBrowser = function ModalElementBrowser(props) {
|
|
|
102
97
|
onClose: props.onClose,
|
|
103
98
|
height: "664px",
|
|
104
99
|
width: "x-large",
|
|
105
|
-
autoFocus: false
|
|
106
|
-
components: components // defaults to true and doesn't work along with stackIndex=1.
|
|
100
|
+
autoFocus: false // defaults to true and doesn't work along with stackIndex=1.
|
|
107
101
|
// packages/design-system/modal-dialog/src/components/Content.tsx Line 287
|
|
108
102
|
,
|
|
109
103
|
shouldCloseOnEscapePress: false
|
|
110
|
-
})));
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement(RenderBody, null), /*#__PURE__*/_react.default.createElement(RenderFooter, null))));
|
|
111
105
|
};
|
|
112
106
|
|
|
113
107
|
ModalElementBrowser.displayName = 'ModalElementBrowser'; // Prevent ModalElementBrowser click propagation through to the editor.
|
|
@@ -118,15 +112,12 @@ var onModalClick = function onModalClick(e) {
|
|
|
118
112
|
|
|
119
113
|
var Footer = function Footer(_ref) {
|
|
120
114
|
var onInsert = _ref.onInsert,
|
|
121
|
-
onClose = _ref.onClose,
|
|
122
|
-
showKeyline = _ref.showKeyline,
|
|
123
115
|
beforeElement = _ref.beforeElement;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}, beforeElement ? beforeElement : /*#__PURE__*/_react.default.createElement("span", null), /*#__PURE__*/_react.default.createElement(Actions, null, /*#__PURE__*/_react.default.createElement(ActionItem, null, /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
|
|
116
|
+
|
|
117
|
+
var _useModal = (0, _modalDialog.useModal)(),
|
|
118
|
+
onClose = _useModal.onClose;
|
|
119
|
+
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(ModalFooter, null, beforeElement ? beforeElement : /*#__PURE__*/_react.default.createElement("span", null), /*#__PURE__*/_react.default.createElement(Actions, null, /*#__PURE__*/_react.default.createElement(ActionItem, null, /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
|
|
130
121
|
appearance: "primary",
|
|
131
122
|
onClick: onInsert,
|
|
132
123
|
testId: "ModalElementBrowser__insert-button"
|
|
@@ -159,6 +150,8 @@ var Wrapper = _styledComponents.default.div(_templateObject3 || (_templateObject
|
|
|
159
150
|
dark: _colors.DN50
|
|
160
151
|
})(), (0, _constants.borderRadius)());
|
|
161
152
|
|
|
153
|
+
var ModalFooter = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n padding: ", "px;\n\n position: relative;\n align-items: center;\n justify-content: space-between;\n"])), _constants2.MODAL_WRAPPER_PADDING);
|
|
154
|
+
|
|
162
155
|
var _default = (0, _reactIntl.injectIntl)(ModalElementBrowser);
|
|
163
156
|
|
|
164
157
|
exports.default = _default;
|