@atlaskit/editor-core 166.0.4 → 167.0.2
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/.eslintrc.js +46 -1
- package/CHANGELOG.md +99 -0
- package/dist/cjs/actions/index.js +26 -2
- package/dist/cjs/create-editor/ReactEditorView.js +2 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -2
- package/dist/cjs/editor.js +5 -2
- package/dist/cjs/keymaps/index.js +5 -1
- package/dist/cjs/labs/next/ContentComponents.js +8 -4
- package/dist/cjs/labs/next/full-page.js +14 -8
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +7 -3
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +3 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +3 -1
- package/dist/cjs/plugins/analytics/types/enums.js +3 -0
- package/dist/cjs/plugins/base/index.js +8 -17
- package/dist/cjs/plugins/base/pm-plugins/better-type-history.js +3 -12
- package/dist/cjs/plugins/base/pm-plugins/inline-cursor-target.js +71 -16
- package/dist/cjs/plugins/block-type/commands/block-type.js +32 -22
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +4 -2
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +4 -11
- package/dist/cjs/plugins/card/styles.js +1 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarIconDropdown.js +2 -2
- package/dist/cjs/plugins/code-block/actions.js +36 -2
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +70 -1
- package/dist/cjs/plugins/code-block/pm-plugins/actions.js +2 -1
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +46 -8
- package/dist/cjs/plugins/code-block/styles.js +28 -24
- package/dist/cjs/plugins/collab-edit/styles.js +4 -2
- package/dist/cjs/plugins/collab-edit/ui/styles.js +4 -2
- package/dist/cjs/plugins/collab-edit/utils.js +1 -0
- package/dist/cjs/plugins/date/ui/DatePicker/index.js +3 -1
- package/dist/cjs/plugins/expand/ui/styles.js +16 -14
- package/dist/cjs/plugins/extension/commands.js +3 -2
- package/dist/cjs/plugins/extension/context-panel.js +21 -7
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +6 -4
- package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +3 -1
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +7 -5
- package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.js +4 -2
- package/dist/cjs/plugins/fake-text-cursor/styles.js +3 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/cjs/plugins/find-replace/styles.js +2 -6
- package/dist/cjs/plugins/find-replace/ui/styles.js +4 -2
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Separator.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -4
- package/dist/cjs/plugins/floating-toolbar/ui/styles.js +12 -10
- package/dist/cjs/plugins/grid/styles.js +3 -1
- package/dist/cjs/plugins/help-dialog/ui/styles.js +9 -7
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +23 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +10 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +5 -3
- package/dist/cjs/plugins/hyperlink/utils.js +53 -2
- package/dist/cjs/plugins/insert-block/index.js +1 -1
- package/dist/cjs/plugins/jira-issue/nodeviews/jira-issue.js +4 -2
- package/dist/cjs/plugins/layout/styles.js +1 -1
- package/dist/cjs/plugins/media/commands/helpers.js +10 -9
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +23 -4
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +6 -0
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -3
- package/dist/cjs/plugins/media/pm-plugins/main.js +1 -0
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.js +3 -1
- package/dist/cjs/plugins/media/ui/Media/DropPlaceholder.js +4 -2
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +3 -1
- package/dist/cjs/plugins/mentions/styles.js +3 -1
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +3 -1
- package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +4 -2
- package/dist/cjs/plugins/panel/index.js +1 -0
- package/dist/cjs/plugins/panel/nodeviews/panel.js +4 -1
- package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +21 -3
- package/dist/cjs/plugins/paste/handlers.js +23 -0
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +7 -0
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +9 -1
- package/dist/cjs/plugins/paste/pm-plugins/main.js +27 -1
- package/dist/cjs/plugins/placeholder/index.js +15 -3
- package/dist/cjs/plugins/placeholder/styles.js +3 -1
- package/dist/cjs/plugins/placeholder-text/styles.js +3 -1
- package/dist/cjs/plugins/quick-insert/search.js +3 -1
- package/dist/cjs/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +2 -2
- package/dist/cjs/plugins/status/ui/statusPicker.js +3 -3
- package/dist/cjs/plugins/table/index.js +14 -4
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/cjs/plugins/table/nodeviews/table.js +9 -4
- package/dist/cjs/plugins/table/pm-plugins/main.js +1 -4
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +118 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +2 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +4 -8
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +0 -3
- package/dist/cjs/plugins/table/transforms/column-width.js +1 -2
- package/dist/cjs/plugins/table/transforms/fix-tables.js +1 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +4 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +3 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +4 -2
- package/dist/cjs/plugins/table/ui/consts.js +14 -11
- package/dist/cjs/plugins/table/ui/ui-styles.js +17 -10
- package/dist/cjs/plugins/table/utils/decoration.js +3 -4
- package/dist/cjs/plugins/table/utils/paste.js +9 -9
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/cjs/plugins/type-ahead/index.js +4 -3
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +3 -1
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +4 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +11 -9
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +73 -3
- package/dist/cjs/plugins/unsupported-content/styles.js +1 -1
- package/dist/cjs/ui/Addon/Dropdown/styles.js +3 -1
- package/dist/cjs/ui/Addon/DropdownItem/styles.js +3 -1
- package/dist/cjs/ui/Appearance/Chromeless.js +2 -1
- package/dist/cjs/ui/Appearance/Comment/Comment.js +10 -3
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +4 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +5 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +12 -11
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +6 -3
- package/dist/cjs/ui/ChromeCollapsed/styles.js +1 -1
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +21 -14
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +2 -0
- package/dist/cjs/ui/ConfigPanel/Fields/CheckboxGroup.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Fields/common/RequiredIndicator.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Header.js +4 -2
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +4 -8
- package/dist/cjs/ui/ContentStyles/index.js +4 -2
- package/dist/cjs/ui/ContextPanel/index.js +3 -1
- package/dist/cjs/ui/DropdownMenu/index.js +5 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +6 -4
- package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +4 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +4 -2
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +12 -5
- package/dist/cjs/ui/ElementBrowser/components/ElementList/EmptyState.js +3 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +3 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +3 -1
- package/dist/cjs/ui/FloatingToolbar/styles.js +2 -2
- package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +5 -3
- package/dist/cjs/ui/PanelTextInput/styles.js +3 -1
- package/dist/cjs/ui/PluginSlot/index.js +7 -4
- package/dist/cjs/ui/Toolbar/ToolbarInner.js +2 -1
- package/dist/cjs/ui/Toolbar/ToolbarWithSizeDetector.js +5 -2
- package/dist/cjs/ui/ToolbarFeedback/styles.js +5 -3
- package/dist/cjs/ui/WithFlash/index.js +4 -2
- package/dist/cjs/ui/styles.js +6 -4
- package/dist/cjs/utils/document.js +62 -6
- package/dist/cjs/utils/filter/privacy-filter.js +2 -2
- package/dist/cjs/utils/step.js +17 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +25 -1
- package/dist/es2019/create-editor/ReactEditorView.js +2 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -2
- package/dist/es2019/editor.js +5 -2
- package/dist/es2019/keymaps/index.js +5 -1
- package/dist/es2019/labs/next/ContentComponents.js +7 -2
- package/dist/es2019/labs/next/full-page.js +11 -8
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +4 -3
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +16 -4
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +2 -1
- package/dist/es2019/plugins/analytics/types/enums.js +3 -0
- package/dist/es2019/plugins/base/index.js +6 -15
- package/dist/es2019/plugins/base/pm-plugins/better-type-history.js +1 -11
- package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +72 -17
- package/dist/es2019/plugins/block-type/commands/block-type.js +25 -16
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -2
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +6 -10
- package/dist/es2019/plugins/card/styles.js +1 -1
- package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +2 -2
- package/dist/es2019/plugins/code-block/actions.js +32 -0
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +61 -1
- package/dist/es2019/plugins/code-block/pm-plugins/actions.js +2 -1
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +37 -3
- package/dist/es2019/plugins/code-block/styles.js +30 -27
- package/dist/es2019/plugins/collab-edit/styles.js +3 -2
- package/dist/es2019/plugins/collab-edit/ui/styles.js +4 -3
- package/dist/es2019/plugins/collab-edit/utils.js +1 -0
- package/dist/es2019/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/es2019/plugins/expand/ui/styles.js +15 -14
- package/dist/es2019/plugins/extension/commands.js +3 -2
- package/dist/es2019/plugins/extension/context-panel.js +11 -3
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +5 -4
- package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +2 -1
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +7 -6
- package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.js +4 -4
- package/dist/es2019/plugins/fake-text-cursor/styles.js +3 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/es2019/plugins/find-replace/styles.js +4 -4
- package/dist/es2019/plugins/find-replace/ui/styles.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Separator.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +4 -4
- package/dist/es2019/plugins/floating-toolbar/ui/styles.js +11 -10
- package/dist/es2019/plugins/grid/styles.js +4 -2
- package/dist/es2019/plugins/help-dialog/ui/styles.js +10 -9
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +24 -2
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +9 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +5 -4
- package/dist/es2019/plugins/hyperlink/utils.js +43 -2
- package/dist/es2019/plugins/insert-block/index.js +1 -1
- package/dist/es2019/plugins/jira-issue/nodeviews/jira-issue.js +6 -5
- package/dist/es2019/plugins/layout/styles.js +10 -7
- package/dist/es2019/plugins/media/commands/helpers.js +6 -8
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +21 -5
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +7 -0
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -4
- package/dist/es2019/plugins/media/pm-plugins/main.js +2 -0
- package/dist/es2019/plugins/media/styles.js +3 -3
- package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.js +2 -1
- package/dist/es2019/plugins/media/ui/Media/DropPlaceholder.js +4 -3
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +2 -1
- package/dist/es2019/plugins/mentions/styles.js +5 -4
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +3 -2
- package/dist/es2019/plugins/panel/index.js +1 -0
- package/dist/es2019/plugins/panel/nodeviews/panel.js +4 -1
- package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +22 -4
- package/dist/es2019/plugins/paste/handlers.js +23 -0
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +7 -1
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +4 -1
- package/dist/es2019/plugins/paste/pm-plugins/main.js +27 -2
- package/dist/es2019/plugins/placeholder/index.js +12 -1
- package/dist/es2019/plugins/placeholder/styles.js +3 -1
- package/dist/es2019/plugins/placeholder-text/styles.js +5 -4
- package/dist/es2019/plugins/quick-insert/search.js +1 -1
- package/dist/es2019/plugins/selection/gap-cursor/styles.js +9 -9
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +2 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +3 -3
- package/dist/es2019/plugins/table/index.js +13 -4
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/es2019/plugins/table/nodeviews/table.js +6 -2
- package/dist/es2019/plugins/table/pm-plugins/main.js +1 -4
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +106 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +2 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +3 -7
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +0 -3
- package/dist/es2019/plugins/table/transforms/column-width.js +1 -2
- package/dist/es2019/plugins/table/transforms/fix-tables.js +1 -3
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +4 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/styles.js +4 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +29 -27
- package/dist/es2019/plugins/table/ui/consts.js +15 -12
- package/dist/es2019/plugins/table/ui/ui-styles.js +28 -23
- package/dist/es2019/plugins/table/utils/decoration.js +1 -4
- package/dist/es2019/plugins/table/utils/paste.js +9 -9
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/type-ahead/index.js +4 -3
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +2 -1
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +4 -4
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +10 -9
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +64 -6
- package/dist/es2019/plugins/unsupported-content/styles.js +1 -1
- package/dist/es2019/ui/Addon/Dropdown/styles.js +3 -2
- package/dist/es2019/ui/Addon/DropdownItem/styles.js +3 -2
- package/dist/es2019/ui/Appearance/Chromeless.js +2 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +9 -4
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +4 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +6 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +12 -11
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +7 -3
- package/dist/es2019/ui/ChromeCollapsed/styles.js +4 -3
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +10 -2
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +2 -0
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +3 -0
- package/dist/es2019/ui/ConfigPanel/Fields/CheckboxGroup.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Fields/common/RequiredIndicator.js +2 -1
- package/dist/es2019/ui/ConfigPanel/Header.js +3 -2
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +4 -3
- package/dist/es2019/ui/ContentStyles/index.js +3 -2
- package/dist/es2019/ui/ContextPanel/index.js +2 -1
- package/dist/es2019/ui/DropdownMenu/index.js +5 -0
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +6 -3
- package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +3 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +3 -2
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +12 -5
- package/dist/es2019/ui/ElementBrowser/components/ElementList/EmptyState.js +2 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/NotFoundIllustration.js +3 -0
- package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +2 -1
- package/dist/es2019/ui/ElementBrowser/constants.js +3 -1
- package/dist/es2019/ui/FloatingToolbar/styles.js +4 -4
- package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +4 -3
- package/dist/es2019/ui/PanelTextInput/styles.js +5 -5
- package/dist/es2019/ui/PluginSlot/index.js +7 -4
- package/dist/es2019/ui/Toolbar/ToolbarInner.js +2 -1
- package/dist/es2019/ui/Toolbar/ToolbarWithSizeDetector.js +4 -2
- package/dist/es2019/ui/ToolbarFeedback/styles.js +5 -4
- package/dist/es2019/ui/WithFlash/index.js +4 -3
- package/dist/es2019/ui/styles.js +10 -9
- package/dist/es2019/utils/document.js +58 -5
- package/dist/es2019/utils/filter/privacy-filter.js +1 -1
- package/dist/es2019/utils/step.js +12 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +26 -1
- package/dist/esm/create-editor/ReactEditorView.js +2 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -2
- package/dist/esm/editor.js +5 -2
- package/dist/esm/keymaps/index.js +5 -1
- package/dist/esm/labs/next/ContentComponents.js +8 -4
- package/dist/esm/labs/next/full-page.js +11 -8
- package/dist/esm/nodeviews/getInlineNodeViewProducer.js +4 -3
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +3 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +2 -1
- package/dist/esm/plugins/analytics/types/enums.js +3 -0
- package/dist/esm/plugins/base/index.js +8 -17
- package/dist/esm/plugins/base/pm-plugins/better-type-history.js +1 -11
- package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +72 -17
- package/dist/esm/plugins/block-type/commands/block-type.js +31 -22
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -2
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -5
- package/dist/esm/plugins/card/styles.js +1 -1
- package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +2 -2
- package/dist/esm/plugins/code-block/actions.js +28 -0
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +67 -1
- package/dist/esm/plugins/code-block/pm-plugins/actions.js +2 -1
- package/dist/esm/plugins/code-block/pm-plugins/main.js +39 -3
- package/dist/esm/plugins/code-block/styles.js +27 -23
- package/dist/esm/plugins/collab-edit/styles.js +3 -2
- package/dist/esm/plugins/collab-edit/ui/styles.js +3 -2
- package/dist/esm/plugins/collab-edit/utils.js +2 -0
- package/dist/esm/plugins/date/ui/DatePicker/index.js +2 -1
- package/dist/esm/plugins/expand/ui/styles.js +15 -14
- package/dist/esm/plugins/extension/commands.js +3 -2
- package/dist/esm/plugins/extension/context-panel.js +21 -7
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +5 -4
- package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +2 -1
- package/dist/esm/plugins/extension/ui/Extension/styles.js +6 -5
- package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.js +3 -2
- package/dist/esm/plugins/fake-text-cursor/styles.js +2 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/esm/plugins/find-replace/styles.js +3 -3
- package/dist/esm/plugins/find-replace/ui/styles.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Separator.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -4
- package/dist/esm/plugins/floating-toolbar/ui/styles.js +11 -10
- package/dist/esm/plugins/grid/styles.js +2 -1
- package/dist/esm/plugins/help-dialog/ui/styles.js +8 -7
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +24 -2
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +9 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +4 -3
- package/dist/esm/plugins/hyperlink/utils.js +44 -2
- package/dist/esm/plugins/insert-block/index.js +1 -1
- package/dist/esm/plugins/jira-issue/nodeviews/jira-issue.js +3 -2
- package/dist/esm/plugins/layout/styles.js +1 -1
- package/dist/esm/plugins/media/commands/helpers.js +6 -8
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +22 -4
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +7 -0
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -3
- package/dist/esm/plugins/media/pm-plugins/main.js +2 -0
- package/dist/esm/plugins/media/styles.js +1 -1
- package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.js +2 -1
- package/dist/esm/plugins/media/ui/Media/DropPlaceholder.js +3 -2
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -1
- package/dist/esm/plugins/mentions/styles.js +2 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +3 -2
- package/dist/esm/plugins/panel/index.js +1 -0
- package/dist/esm/plugins/panel/nodeviews/panel.js +4 -1
- package/dist/esm/plugins/panel/pm-plugins/keymaps.js +22 -4
- package/dist/esm/plugins/paste/handlers.js +21 -0
- package/dist/esm/plugins/paste/linkify-md-plugin.js +7 -1
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +6 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +27 -2
- package/dist/esm/plugins/placeholder/index.js +12 -1
- package/dist/esm/plugins/placeholder/styles.js +2 -1
- package/dist/esm/plugins/placeholder-text/styles.js +2 -1
- package/dist/esm/plugins/quick-insert/search.js +3 -1
- package/dist/esm/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +2 -2
- package/dist/esm/plugins/status/ui/statusPicker.js +2 -2
- package/dist/esm/plugins/table/index.js +13 -4
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/esm/plugins/table/nodeviews/table.js +6 -2
- package/dist/esm/plugins/table/pm-plugins/main.js +1 -4
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +102 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +2 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +4 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +0 -3
- package/dist/esm/plugins/table/transforms/column-width.js +1 -2
- package/dist/esm/plugins/table/transforms/fix-tables.js +1 -3
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +3 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +4 -2
- package/dist/esm/plugins/table/ui/consts.js +15 -12
- package/dist/esm/plugins/table/ui/ui-styles.js +15 -10
- package/dist/esm/plugins/table/utils/decoration.js +3 -4
- package/dist/esm/plugins/table/utils/paste.js +9 -9
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/type-ahead/index.js +4 -3
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +2 -1
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +4 -4
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +10 -9
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +71 -5
- package/dist/esm/plugins/unsupported-content/styles.js +1 -1
- package/dist/esm/ui/Addon/Dropdown/styles.js +2 -1
- package/dist/esm/ui/Addon/DropdownItem/styles.js +2 -1
- package/dist/esm/ui/Appearance/Chromeless.js +2 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +10 -3
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +3 -2
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +6 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +12 -11
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +5 -3
- package/dist/esm/ui/ChromeCollapsed/styles.js +1 -1
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +21 -14
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +2 -0
- package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +3 -0
- package/dist/esm/ui/ConfigPanel/Fields/CheckboxGroup.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +2 -1
- package/dist/esm/ui/ConfigPanel/Fields/common/RequiredIndicator.js +2 -1
- package/dist/esm/ui/ConfigPanel/Header.js +3 -2
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +3 -2
- package/dist/esm/ui/ContentStyles/index.js +3 -2
- package/dist/esm/ui/ContextPanel/index.js +2 -1
- package/dist/esm/ui/DropdownMenu/index.js +5 -0
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +5 -4
- package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +3 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +3 -2
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +11 -5
- package/dist/esm/ui/ElementBrowser/components/ElementList/EmptyState.js +2 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/NotFoundIllustration.js +3 -0
- package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +2 -1
- package/dist/esm/ui/ElementBrowser/constants.js +3 -1
- package/dist/esm/ui/FloatingToolbar/styles.js +3 -3
- package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +4 -3
- package/dist/esm/ui/PanelTextInput/styles.js +4 -3
- package/dist/esm/ui/PluginSlot/index.js +7 -4
- package/dist/esm/ui/Toolbar/ToolbarInner.js +2 -1
- package/dist/esm/ui/Toolbar/ToolbarWithSizeDetector.js +4 -2
- package/dist/esm/ui/ToolbarFeedback/styles.js +4 -3
- package/dist/esm/ui/WithFlash/index.js +3 -2
- package/dist/esm/ui/styles.js +5 -4
- package/dist/esm/utils/document.js +59 -5
- package/dist/esm/utils/filter/privacy-filter.js +1 -1
- package/dist/esm/utils/step.js +12 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +6 -0
- package/dist/types/labs/next/ContentComponents.d.ts +7 -1
- package/dist/types/nodeviews/getInlineNodeViewProducer.d.ts +1 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +3 -0
- package/dist/types/plugins/analytics/types/general-events.d.ts +7 -1
- package/dist/types/plugins/base/pm-plugins/inline-cursor-target.d.ts +1 -1
- package/dist/types/plugins/code-block/actions.d.ts +2 -0
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +2 -0
- package/dist/types/plugins/code-block/pm-plugins/actions.d.ts +1 -0
- package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +1 -0
- package/dist/types/plugins/extension/commands.d.ts +1 -1
- package/dist/types/plugins/extension/types.d.ts +1 -0
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
- package/dist/types/plugins/find-replace/styles.d.ts +0 -2
- package/dist/types/plugins/hyperlink/utils.d.ts +8 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +2 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/media/pm-plugins/types.d.ts +2 -1
- package/dist/types/plugins/paste/handlers.d.ts +1 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +1 -0
- package/dist/types/plugins/table/commands/misc.d.ts +0 -1
- package/dist/types/plugins/table/index.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/plugins/table/nodeviews/types.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +0 -1
- package/dist/types/plugins/table/types.d.ts +0 -1
- package/dist/types/plugins/table/ui/consts.d.ts +9 -9
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +2 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +4 -4
- package/dist/types/types/editor-appearance-component.d.ts +0 -1
- package/dist/types/types/editor-props.d.ts +4 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/types/ui-components.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -0
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +3 -2
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +3 -2
- package/dist/types/ui/PluginSlot/index.d.ts +1 -0
- package/dist/types/ui/Toolbar/toolbar-types.d.ts +1 -0
- package/dist/types/utils/document.d.ts +1 -0
- package/dist/types/utils/step.d.ts +1 -0
- package/docs/0-intro.tsx +12 -4
- package/package.json +23 -23
|
@@ -37,13 +37,35 @@ var _default = function _default() {
|
|
|
37
37
|
var selection = tr.selection,
|
|
38
38
|
doc = tr.doc;
|
|
39
39
|
var $from = selection.$from,
|
|
40
|
-
$to = selection.$to;
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
$to = selection.$to; // In Safari, if the cursor target is to the right of the cursor it will block selections
|
|
41
|
+
// made with shift + arrowRight and vice versa for shift + arrowLeft. This is due to a
|
|
42
|
+
// contenteditable bug in safari, where editable elements block the selection but we need
|
|
43
|
+
// the cursor target to be editable for the following:
|
|
44
|
+
// - Ability to navigate with down/up arrows when between inline nodes
|
|
45
|
+
// - Ability to navigate with down/up arrows when between the start of a paragraph & an inline node
|
|
46
|
+
// - Ability to click and drag to select an inline node if it is the first node
|
|
47
|
+
// To prevent blocking the selection, we check handleDOMEvents and add meta to
|
|
48
|
+
// the transaction to prevent the plugin from making cursor target decorations.
|
|
49
|
+
|
|
50
|
+
var safariShiftSelection = tr.getMeta(inlineCursorTargetStateKey);
|
|
51
|
+
|
|
52
|
+
if (selection && (0, _utils2.isTextSelection)(selection) && !safariShiftSelection) {
|
|
43
53
|
var hasInlineNodeViewAfter = isInlineNodeView($from.nodeAfter);
|
|
44
54
|
var hasInlineNodeViewBefore = isInlineNodeView($from.nodeBefore);
|
|
45
|
-
var
|
|
46
|
-
var
|
|
55
|
+
var isAtStartAndInlineNodeViewAfter = $from.parentOffset === 0 && isInlineNodeView($from.nodeAfter);
|
|
56
|
+
var isAtEndAndInlineNodeViewBefore = doc.resolve($from.pos).node().lastChild === $from.nodeBefore && isInlineNodeView($from.nodeBefore);
|
|
57
|
+
|
|
58
|
+
var createWidget = function createWidget(side) {
|
|
59
|
+
var node = document.createElement('span');
|
|
60
|
+
node.contentEditable = 'true';
|
|
61
|
+
node.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
|
|
62
|
+
node.className = 'cursor-target';
|
|
63
|
+
return _prosemirrorView.Decoration.widget(selection.from, node, {
|
|
64
|
+
raw: true,
|
|
65
|
+
side: side === 'left' ? -1 : 1,
|
|
66
|
+
key: 'inlineCursor'
|
|
67
|
+
});
|
|
68
|
+
}; // Create editable decoration widgets either side of the cursor to allow
|
|
47
69
|
// text input.
|
|
48
70
|
// We check beforeInput events below to prevent content
|
|
49
71
|
// being added to the decorations.
|
|
@@ -54,18 +76,8 @@ var _default = function _default() {
|
|
|
54
76
|
// - positioned between the beginning of another node and an inline node (firefox)
|
|
55
77
|
// - positioned between an inline node and the end of a node (chrome)
|
|
56
78
|
|
|
57
|
-
if ((hasInlineNodeViewAfter || isAtEnd) && (hasInlineNodeViewBefore || isAtStart)) {
|
|
58
|
-
var createWidget = function createWidget(side) {
|
|
59
|
-
var node = document.createElement('span');
|
|
60
|
-
node.contentEditable = 'true';
|
|
61
|
-
node.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
|
|
62
|
-
return _prosemirrorView.Decoration.widget(selection.from, node, {
|
|
63
|
-
raw: true,
|
|
64
|
-
side: side === 'left' ? -1 : 1,
|
|
65
|
-
key: 'inlineCursor'
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
79
|
|
|
80
|
+
if (!_utils.browser.safari && (hasInlineNodeViewAfter || isAtEndAndInlineNodeViewBefore) && (hasInlineNodeViewBefore || isAtStartAndInlineNodeViewAfter)) {
|
|
69
81
|
return {
|
|
70
82
|
cursorTarget: {
|
|
71
83
|
decorations: [createWidget('left'), createWidget('right')],
|
|
@@ -75,6 +87,34 @@ var _default = function _default() {
|
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
};
|
|
90
|
+
} // Only create one widget on the left or right of the cursor in Safari.
|
|
91
|
+
// This is to prevent the left key from being blocked when at the start of a paragraph,
|
|
92
|
+
// and the right key from being blocked when at the end of a paragraph. This also
|
|
93
|
+
// improves click and drag selections, making it easier to select the first node.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if (_utils.browser.safari) {
|
|
97
|
+
if (isAtEndAndInlineNodeViewBefore || hasInlineNodeViewBefore && hasInlineNodeViewAfter) {
|
|
98
|
+
return {
|
|
99
|
+
cursorTarget: {
|
|
100
|
+
decorations: [createWidget('left')],
|
|
101
|
+
positions: {
|
|
102
|
+
from: $from.pos,
|
|
103
|
+
to: $to.pos
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
} else if (isAtStartAndInlineNodeViewAfter) {
|
|
108
|
+
return {
|
|
109
|
+
cursorTarget: {
|
|
110
|
+
decorations: [createWidget('right')],
|
|
111
|
+
positions: {
|
|
112
|
+
from: $from.pos,
|
|
113
|
+
to: $to.pos
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
78
118
|
}
|
|
79
119
|
}
|
|
80
120
|
|
|
@@ -97,6 +137,21 @@ var _default = function _default() {
|
|
|
97
137
|
return null;
|
|
98
138
|
},
|
|
99
139
|
handleDOMEvents: {
|
|
140
|
+
// Workaround to prevent the decorations created by the plugin from
|
|
141
|
+
// blocking shift + arrow left/right selections in safari. When
|
|
142
|
+
// a shift + arrow left/right event is detected, send meta data to the
|
|
143
|
+
// plugin to prevent it from creating decorations.
|
|
144
|
+
// TODO We may be able to remove this when playing the following ticket:
|
|
145
|
+
// https://product-fabric.atlassian.net/browse/ED-14938
|
|
146
|
+
keydown: function keydown(view, event) {
|
|
147
|
+
if (_utils.browser.safari && event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
148
|
+
view.dispatch(view.state.tr.setMeta(inlineCursorTargetStateKey, {
|
|
149
|
+
cursorTarget: undefined
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return false;
|
|
154
|
+
},
|
|
100
155
|
// Check the DOM to see if there are inline cursor targets
|
|
101
156
|
// after a composition event ends. If so, manually insert the
|
|
102
157
|
// event data in order to prevent contents ending up inside
|
|
@@ -31,6 +31,8 @@ var _utils = require("../../../utils");
|
|
|
31
31
|
|
|
32
32
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
33
33
|
|
|
34
|
+
var _editorTables = require("@atlaskit/editor-tables");
|
|
35
|
+
|
|
34
36
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
35
37
|
|
|
36
38
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -75,14 +77,18 @@ function setBlockTypeWithAnalytics(name, inputMethod) {
|
|
|
75
77
|
|
|
76
78
|
function setNormalText() {
|
|
77
79
|
return function (state, dispatch) {
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
var selection = state.selection,
|
|
81
|
+
schema = state.schema,
|
|
82
|
+
tr = state.tr;
|
|
83
|
+
var ranges = selection instanceof _editorTables.CellSelection ? selection.ranges : [selection];
|
|
84
|
+
ranges.forEach(function (_ref) {
|
|
85
|
+
var $from = _ref.$from,
|
|
86
|
+
$to = _ref.$to;
|
|
87
|
+
tr.setBlockType($from.pos, $to.pos, schema.nodes.paragraph);
|
|
88
|
+
});
|
|
83
89
|
|
|
84
90
|
if (dispatch) {
|
|
85
|
-
dispatch(tr
|
|
91
|
+
dispatch(tr);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
return true;
|
|
@@ -145,16 +151,20 @@ function setNormalTextWithAnalytics(inputMethod) {
|
|
|
145
151
|
|
|
146
152
|
function setHeading(level) {
|
|
147
153
|
return function (state, dispatch) {
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
var selection = state.selection,
|
|
155
|
+
schema = state.schema,
|
|
156
|
+
tr = state.tr;
|
|
157
|
+
var ranges = selection instanceof _editorTables.CellSelection ? selection.ranges : [selection];
|
|
158
|
+
ranges.forEach(function (_ref2) {
|
|
159
|
+
var $from = _ref2.$from,
|
|
160
|
+
$to = _ref2.$to;
|
|
161
|
+
tr.setBlockType($from.pos, $to.pos, schema.nodes.heading, {
|
|
162
|
+
level: level
|
|
163
|
+
});
|
|
164
|
+
});
|
|
153
165
|
|
|
154
166
|
if (dispatch) {
|
|
155
|
-
dispatch(tr
|
|
156
|
-
level: level
|
|
157
|
-
}));
|
|
167
|
+
dispatch(tr);
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
return true;
|
|
@@ -264,9 +274,9 @@ exports.insertBlockTypesWithAnalytics = insertBlockTypesWithAnalytics;
|
|
|
264
274
|
function wrapSelectionIn(type) {
|
|
265
275
|
return function (state, dispatch) {
|
|
266
276
|
var tr = state.tr;
|
|
267
|
-
var _state$
|
|
268
|
-
$from = _state$
|
|
269
|
-
$to = _state$
|
|
277
|
+
var _state$selection = state.selection,
|
|
278
|
+
$from = _state$selection.$from,
|
|
279
|
+
$to = _state$selection.$to;
|
|
270
280
|
var _state$schema$marks = state.schema.marks,
|
|
271
281
|
alignment = _state$schema$marks.alignment,
|
|
272
282
|
indentation = _state$schema$marks.indentation;
|
|
@@ -301,9 +311,9 @@ function insertCodeBlock() {
|
|
|
301
311
|
var _state$selection$$fro;
|
|
302
312
|
|
|
303
313
|
var tr = state.tr;
|
|
304
|
-
var _state$
|
|
305
|
-
$to = _state$
|
|
306
|
-
$from = _state$
|
|
314
|
+
var _state$selection2 = state.selection,
|
|
315
|
+
$to = _state$selection2.$to,
|
|
316
|
+
$from = _state$selection2.$from;
|
|
307
317
|
var codeBlock = state.schema.nodes.codeBlock;
|
|
308
318
|
var grandParentType = (_state$selection$$fro = state.selection.$from.node(-1)) === null || _state$selection$$fro === void 0 ? void 0 : _state$selection$$fro.type;
|
|
309
319
|
var parentType = state.selection.$from.parent.type;
|
|
@@ -327,8 +337,8 @@ function insertCodeBlock() {
|
|
|
327
337
|
}
|
|
328
338
|
|
|
329
339
|
var cleanUpAtTheStartOfDocument = function cleanUpAtTheStartOfDocument(state, dispatch) {
|
|
330
|
-
var
|
|
331
|
-
$cursor =
|
|
340
|
+
var _ref3 = state.selection,
|
|
341
|
+
$cursor = _ref3.$cursor;
|
|
332
342
|
|
|
333
343
|
if ($cursor && !$cursor.nodeBefore && !$cursor.nodeAfter && $cursor.pos === 1) {
|
|
334
344
|
var tr = state.tr,
|
|
@@ -17,11 +17,13 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
17
17
|
|
|
18
18
|
var _styles2 = require("../../../../ui/styles");
|
|
19
19
|
|
|
20
|
+
var _tokens = require("@atlaskit/tokens");
|
|
21
|
+
|
|
20
22
|
var _templateObject, _templateObject2, _templateObject3;
|
|
21
23
|
|
|
22
24
|
var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
|
|
23
25
|
// TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
|
|
24
|
-
var selectedStyle = selected ? "".concat(tagName, " { color: white !important; }") : '';
|
|
26
|
+
var selectedStyle = selected ? "".concat(tagName, " { color: ").concat((0, _tokens.token)('color.text.inverse', 'white'), " !important; }") : '';
|
|
25
27
|
return function (themeProps) {
|
|
26
28
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n "])), (0, _styles.headingsSharedStyles)(themeProps), selectedStyle);
|
|
27
29
|
};
|
|
@@ -30,5 +32,5 @@ var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected)
|
|
|
30
32
|
exports.blockTypeMenuItemStyle = blockTypeMenuItemStyle;
|
|
31
33
|
var keyboardShortcut = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n margin-left: 16px;\n"])), _styles2.shortcutStyle);
|
|
32
34
|
exports.keyboardShortcut = keyboardShortcut;
|
|
33
|
-
var keyboardShortcutSelect = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), _colors.N400);
|
|
35
|
+
var keyboardShortcutSelect = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), (0, _tokens.token)('color.icon', _colors.N400));
|
|
34
36
|
exports.keyboardShortcutSelect = keyboardShortcutSelect;
|
|
@@ -2,8 +2,6 @@
|
|
|
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
|
});
|
|
@@ -29,7 +27,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
29
27
|
|
|
30
28
|
var _react2 = require("@emotion/react");
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
33
31
|
|
|
34
32
|
var _reactIntlNext = require("react-intl-next");
|
|
35
33
|
|
|
@@ -61,20 +59,15 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
61
59
|
|
|
62
60
|
var _isSupportedNode = require("../utils/is-supported-node");
|
|
63
61
|
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
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); }
|
|
62
|
+
var _tokens = require("@atlaskit/tokens");
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
var _templateObject;
|
|
69
65
|
|
|
70
66
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
71
67
|
|
|
72
68
|
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; } }
|
|
73
69
|
|
|
74
|
-
var
|
|
75
|
-
N300 = colors.N300,
|
|
76
|
-
N20A = colors.N20A;
|
|
77
|
-
var toolbarButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n && button {\n background: ", ";\n color: ", ";\n :hover {\n background: ", ";\n color: white !important;\n }\n }\n"])), N20A, N300, B300);
|
|
70
|
+
var toolbarButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n && button {\n background: ", ";\n color: ", ";\n :hover {\n background: ", ";\n color: ", " !important;\n }\n }\n"])), (0, _tokens.token)('color.background.neutral', _colors.N20A), (0, _tokens.token)('color.icon', _colors.N300), (0, _tokens.token)('color.background.neutral.hovered', _colors.B300), (0, _tokens.token)('color.icon', 'white'));
|
|
78
71
|
var BREAKOUT_MODE = {
|
|
79
72
|
FULL_WIDTH: 'full-width',
|
|
80
73
|
CENTER: 'center',
|
|
@@ -21,5 +21,5 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
21
21
|
|
|
22
22
|
var _templateObject;
|
|
23
23
|
|
|
24
|
-
var smartCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n"])), _styles.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _colors.N20, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder));
|
|
24
|
+
var smartCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n"])), _styles.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder));
|
|
25
25
|
exports.smartCardStyles = smartCardStyles;
|
|
@@ -36,7 +36,7 @@ var iconBoxStyles = (0, _react2.css)({
|
|
|
36
36
|
width: ICON_HEIGHT,
|
|
37
37
|
height: ICON_WIDTH,
|
|
38
38
|
overflow: 'hidden',
|
|
39
|
-
border:
|
|
39
|
+
border: "1px solid ".concat((0, _tokens.token)('color.border', 'rgba(223, 225, 229, 0.5)'))
|
|
40
40
|
/* N60 at 50% */
|
|
41
41
|
,
|
|
42
42
|
borderRadius: (0, _constants.borderRadius)(),
|
|
@@ -44,7 +44,7 @@ var iconBoxStyles = (0, _react2.css)({
|
|
|
44
44
|
display: 'flex',
|
|
45
45
|
justifyContent: 'center',
|
|
46
46
|
alignItems: 'center',
|
|
47
|
-
backgroundColor: (0, _tokens.token)('
|
|
47
|
+
backgroundColor: (0, _tokens.token)('elevation.surface', 'white')
|
|
48
48
|
});
|
|
49
49
|
var primitiveStyles = (0, _react2.css)({
|
|
50
50
|
padding: '0.75rem',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resetCopiedState = exports.removeCodeBlock = exports.copyContentToClipboard = exports.changeLanguage = void 0;
|
|
6
|
+
exports.resetShouldIgnoreFollowingMutations = exports.resetCopiedState = exports.removeCodeBlock = exports.ignoreFollowingMutations = exports.copyContentToClipboard = exports.changeLanguage = void 0;
|
|
7
7
|
|
|
8
8
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
9
9
|
|
|
@@ -119,4 +119,38 @@ var resetCopiedState = function resetCopiedState(state, dispatch) {
|
|
|
119
119
|
return true;
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
exports.resetCopiedState = resetCopiedState;
|
|
122
|
+
exports.resetCopiedState = resetCopiedState;
|
|
123
|
+
|
|
124
|
+
var ignoreFollowingMutations = function ignoreFollowingMutations(state, dispatch) {
|
|
125
|
+
var tr = state.tr;
|
|
126
|
+
var ignoreFollowingMutationsTr = tr;
|
|
127
|
+
ignoreFollowingMutationsTr.setMeta(_pluginKey.pluginKey, {
|
|
128
|
+
type: _actions.ACTIONS.SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS,
|
|
129
|
+
data: true
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (dispatch) {
|
|
133
|
+
dispatch(ignoreFollowingMutationsTr);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return true;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
exports.ignoreFollowingMutations = ignoreFollowingMutations;
|
|
140
|
+
|
|
141
|
+
var resetShouldIgnoreFollowingMutations = function resetShouldIgnoreFollowingMutations(state, dispatch) {
|
|
142
|
+
var tr = state.tr;
|
|
143
|
+
var ignoreFollowingMutationsTr = tr;
|
|
144
|
+
ignoreFollowingMutationsTr.setMeta(_pluginKey.pluginKey, {
|
|
145
|
+
type: _actions.ACTIONS.SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS,
|
|
146
|
+
data: false
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
if (dispatch) {
|
|
150
|
+
dispatch(ignoreFollowingMutationsTr);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return true;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
exports.resetShouldIgnoreFollowingMutations = resetShouldIgnoreFollowingMutations;
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.codeBlockNodeView = exports.CodeBlockView = void 0;
|
|
9
9
|
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -15,10 +17,16 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
17
|
|
|
16
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
17
19
|
|
|
20
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
|
+
|
|
18
22
|
var _prosemirrorModel = require("prosemirror-model");
|
|
19
23
|
|
|
20
24
|
var _classNames = require("../ui/class-names");
|
|
21
25
|
|
|
26
|
+
var _actions = require("../actions");
|
|
27
|
+
|
|
28
|
+
var _mainState = require("../pm-plugins/main-state");
|
|
29
|
+
|
|
22
30
|
var MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
23
31
|
|
|
24
32
|
var toDOM = function toDOM(node) {
|
|
@@ -75,6 +83,56 @@ var CodeBlockView = /*#__PURE__*/function () {
|
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
(0, _createClass2.default)(CodeBlockView, [{
|
|
86
|
+
key: "updateDOMAndSelection",
|
|
87
|
+
value: function updateDOMAndSelection(savedInnerHTML, newCursorPosition) {
|
|
88
|
+
var _this$dom;
|
|
89
|
+
|
|
90
|
+
if ((_this$dom = this.dom) !== null && _this$dom !== void 0 && _this$dom.childNodes && this.dom.childNodes.length > 1) {
|
|
91
|
+
var _contentView$childNod;
|
|
92
|
+
|
|
93
|
+
var contentView = this.dom.childNodes[1];
|
|
94
|
+
|
|
95
|
+
if ((contentView === null || contentView === void 0 ? void 0 : (_contentView$childNod = contentView.childNodes) === null || _contentView$childNod === void 0 ? void 0 : _contentView$childNod.length) > 0) {
|
|
96
|
+
var codeElement = contentView.firstChild;
|
|
97
|
+
codeElement.innerHTML = savedInnerHTML; // We need to set cursor for the DOM update
|
|
98
|
+
|
|
99
|
+
var textElement = (0, _toConsumableArray2.default)(codeElement.childNodes).find(function (child) {
|
|
100
|
+
return child.nodeName === '#text';
|
|
101
|
+
});
|
|
102
|
+
var sel = window.getSelection();
|
|
103
|
+
var range = document.createRange();
|
|
104
|
+
range.setStart(textElement, newCursorPosition);
|
|
105
|
+
range.collapse(true);
|
|
106
|
+
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
|
107
|
+
sel === null || sel === void 0 ? void 0 : sel.addRange(range);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "coalesceDOMElements",
|
|
113
|
+
value: function coalesceDOMElements() {
|
|
114
|
+
var _this$dom2;
|
|
115
|
+
|
|
116
|
+
if ((_this$dom2 = this.dom) !== null && _this$dom2 !== void 0 && _this$dom2.childNodes && this.dom.childNodes.length > 1) {
|
|
117
|
+
var contentView = this.dom.childNodes[1];
|
|
118
|
+
|
|
119
|
+
if (contentView !== null && contentView !== void 0 && contentView.childNodes && contentView.childNodes.length > 1) {
|
|
120
|
+
var savedInnerHTML = '';
|
|
121
|
+
|
|
122
|
+
while (contentView.childNodes.length > 1) {
|
|
123
|
+
var lastChild = contentView.lastChild;
|
|
124
|
+
savedInnerHTML = lastChild.innerHTML + savedInnerHTML;
|
|
125
|
+
contentView.removeChild(lastChild);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var firstChild = contentView.firstChild;
|
|
129
|
+
savedInnerHTML = firstChild.innerHTML + '\n' + savedInnerHTML;
|
|
130
|
+
var newCursorPosition = firstChild.innerHTML.length + 1;
|
|
131
|
+
setTimeout(this.updateDOMAndSelection.bind(this, savedInnerHTML, newCursorPosition), 20);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
78
136
|
key: "update",
|
|
79
137
|
value: function update(node) {
|
|
80
138
|
if (node.type !== this.node.type) {
|
|
@@ -88,6 +146,11 @@ var CodeBlockView = /*#__PURE__*/function () {
|
|
|
88
146
|
|
|
89
147
|
this.node = node;
|
|
90
148
|
this.ensureLineNumbers();
|
|
149
|
+
|
|
150
|
+
if (_utils.browser.android) {
|
|
151
|
+
this.coalesceDOMElements();
|
|
152
|
+
(0, _actions.resetShouldIgnoreFollowingMutations)(this.view.state, this.view.dispatch);
|
|
153
|
+
}
|
|
91
154
|
}
|
|
92
155
|
|
|
93
156
|
return true;
|
|
@@ -95,7 +158,13 @@ var CodeBlockView = /*#__PURE__*/function () {
|
|
|
95
158
|
}, {
|
|
96
159
|
key: "ignoreMutation",
|
|
97
160
|
value: function ignoreMutation(record) {
|
|
98
|
-
|
|
161
|
+
var pluginState = (0, _mainState.getPluginState)(this.view.state);
|
|
162
|
+
|
|
163
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.shouldIgnoreFollowingMutations) {
|
|
164
|
+
return true;
|
|
165
|
+
} // Ensure updating the line-number gutter doesn't trigger reparsing the codeblock
|
|
166
|
+
|
|
167
|
+
|
|
99
168
|
return record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
|
|
100
169
|
}
|
|
101
170
|
}]);
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ACTIONS = void 0;
|
|
7
7
|
var ACTIONS = {
|
|
8
|
-
SET_COPIED_TO_CLIPBOARD: 'SET_COPIED_TO_CLIPBOARD'
|
|
8
|
+
SET_COPIED_TO_CLIPBOARD: 'SET_COPIED_TO_CLIPBOARD',
|
|
9
|
+
SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS: 'SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS'
|
|
9
10
|
};
|
|
10
11
|
exports.ACTIONS = ACTIONS;
|
|
@@ -11,6 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
13
|
|
|
14
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
+
|
|
14
16
|
var _prosemirrorState = require("prosemirror-state");
|
|
15
17
|
|
|
16
18
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
@@ -19,13 +21,15 @@ var _codeBlock = require("../nodeviews/code-block");
|
|
|
19
21
|
|
|
20
22
|
var _highlightingCodeBlock = require("../nodeviews/highlighting-code-block");
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _utils2 = require("../../selection/utils");
|
|
23
25
|
|
|
24
26
|
var _pluginKey = require("../plugin-key");
|
|
25
27
|
|
|
26
28
|
var _actions = require("./actions");
|
|
27
29
|
|
|
28
|
-
var
|
|
30
|
+
var _actions2 = require("../actions");
|
|
31
|
+
|
|
32
|
+
var _utils3 = require("../utils");
|
|
29
33
|
|
|
30
34
|
var _classNames = require("../ui/class-names");
|
|
31
35
|
|
|
@@ -49,10 +53,39 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
49
53
|
|
|
50
54
|
if (allowCompositionInputOverride) {
|
|
51
55
|
handleDOMEvents.beforeinput = function (view, event) {
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
var keyEvent = event;
|
|
57
|
+
var eventInputType = keyEvent.inputType;
|
|
58
|
+
var eventText = keyEvent.data;
|
|
59
|
+
|
|
60
|
+
if (_utils.browser.ios && event.composed && // insertParagraph will be the input type when the enter key is pressed.
|
|
61
|
+
eventInputType === 'insertParagraph' && (0, _utils3.findCodeBlock)(view.state, view.state.selection)) {
|
|
54
62
|
event.preventDefault();
|
|
55
63
|
return true;
|
|
64
|
+
} else if (_utils.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _utils3.findCodeBlock)(view.state, view.state.selection)) {
|
|
65
|
+
var resultingText = event.target.outerText + '\n';
|
|
66
|
+
|
|
67
|
+
if (resultingText.endsWith(eventText)) {
|
|
68
|
+
// End of paragraph
|
|
69
|
+
setTimeout(function () {
|
|
70
|
+
view.someProp('handleKeyDown', function (f) {
|
|
71
|
+
return f(view, new KeyboardEvent('keydown', {
|
|
72
|
+
bubbles: true,
|
|
73
|
+
cancelable: true,
|
|
74
|
+
key: 'Enter',
|
|
75
|
+
code: 'Enter'
|
|
76
|
+
}));
|
|
77
|
+
});
|
|
78
|
+
}, 0);
|
|
79
|
+
} else {
|
|
80
|
+
// Middle of paragraph, end of line
|
|
81
|
+
(0, _actions2.ignoreFollowingMutations)(view.state, view.dispatch);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (_utils.browser.android) {
|
|
88
|
+
(0, _actions2.resetShouldIgnoreFollowingMutations)(view.state, view.dispatch);
|
|
56
89
|
}
|
|
57
90
|
|
|
58
91
|
return false;
|
|
@@ -62,16 +95,17 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
62
95
|
return new _safePlugin.SafePlugin({
|
|
63
96
|
state: {
|
|
64
97
|
init: function init(_, state) {
|
|
65
|
-
var node = (0,
|
|
98
|
+
var node = (0, _utils3.findCodeBlock)(state, state.selection);
|
|
66
99
|
return {
|
|
67
100
|
pos: node ? node.pos : null,
|
|
68
101
|
contentCopied: false,
|
|
69
|
-
isNodeSelected: false
|
|
102
|
+
isNodeSelected: false,
|
|
103
|
+
shouldIgnoreFollowingMutations: false
|
|
70
104
|
};
|
|
71
105
|
},
|
|
72
106
|
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
73
107
|
if (tr.docChanged || tr.selectionSet) {
|
|
74
|
-
var node = (0,
|
|
108
|
+
var node = (0, _utils3.findCodeBlock)(newState, tr.selection);
|
|
75
109
|
|
|
76
110
|
var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
77
111
|
pos: node ? node.pos : null,
|
|
@@ -87,6 +121,10 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
87
121
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
88
122
|
contentCopied: meta.data
|
|
89
123
|
});
|
|
124
|
+
} else if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS) {
|
|
125
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
126
|
+
shouldIgnoreFollowingMutations: meta.data
|
|
127
|
+
});
|
|
90
128
|
}
|
|
91
129
|
|
|
92
130
|
return pluginState;
|
|
@@ -111,7 +149,7 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
111
149
|
return createCodeBlockNodeView(node, view, getPos);
|
|
112
150
|
}
|
|
113
151
|
},
|
|
114
|
-
handleClickOn: (0,
|
|
152
|
+
handleClickOn: (0, _utils2.createSelectionClickHandler)(['codeBlock'], function (target) {
|
|
115
153
|
return !!(target.closest(".".concat(_classNames.codeBlockClassNames.gutter)) || target.classList.contains(_classNames.codeBlockClassNames.content));
|
|
116
154
|
}, {
|
|
117
155
|
useLongPressSelection: useLongPressSelection
|