@atlaskit/editor-core 187.8.3 → 187.8.10
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 +15 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +4 -5
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/annotation/commands/transform.js +2 -2
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/cjs/plugins/block-type/commands/block-type.js +2 -2
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +2 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +2 -2
- package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/list/actions/conversions.js +5 -5
- package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
- package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
- package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
- package/dist/cjs/plugins/list/commands/index.js +8 -10
- package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
- package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
- package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
- package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
- package/dist/cjs/plugins/list/utils/analytics.js +1 -35
- package/dist/cjs/plugins/list/utils/indentation.js +2 -20
- package/dist/cjs/plugins/list/utils/node.js +2 -106
- package/dist/cjs/plugins/list/utils/selection.js +3 -54
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +9 -9
- package/dist/cjs/plugins/text-formatting/commands/transform-to-code.js +2 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -5
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +2 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +2 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +2 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +5 -5
- package/dist/cjs/ui/Dropdown/index.js +1 -2
- package/dist/cjs/ui/styles.js +3 -5
- package/dist/cjs/utils/commands.js +3 -222
- package/dist/cjs/utils/document.js +1 -26
- package/dist/cjs/utils/index.js +0 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +3 -6
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/annotation/commands/transform.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/commands/block-type.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -5
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -1
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/actions/conversions.js +2 -2
- package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
- package/dist/es2019/plugins/list/commands/index.js +4 -5
- package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
- package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +0 -36
- package/dist/es2019/plugins/list/utils/indentation.js +0 -18
- package/dist/es2019/plugins/list/utils/node.js +3 -89
- package/dist/es2019/plugins/list/utils/selection.js +1 -52
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -1
- package/dist/es2019/plugins/text-formatting/commands/transform-to-code.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +3 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -3
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/es2019/ui/Dropdown/index.js +1 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/es2019/ui/styles.js +0 -5
- package/dist/es2019/utils/commands.js +2 -214
- package/dist/es2019/utils/document.js +1 -26
- package/dist/es2019/utils/index.js +1 -13
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +3 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/annotation/commands/transform.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -5
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -1
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/actions/conversions.js +2 -2
- package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/esm/plugins/list/commands/indent-list.js +3 -4
- package/dist/esm/plugins/list/commands/index.js +4 -5
- package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
- package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +0 -32
- package/dist/esm/plugins/list/utils/indentation.js +0 -17
- package/dist/esm/plugins/list/utils/node.js +3 -81
- package/dist/esm/plugins/list/utils/selection.js +3 -51
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -1
- package/dist/esm/plugins/text-formatting/commands/transform-to-code.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +4 -5
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +3 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -3
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/esm/ui/Dropdown/index.js +1 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/esm/ui/styles.js +2 -3
- package/dist/esm/utils/commands.js +2 -211
- package/dist/esm/utils/document.js +1 -26
- package/dist/esm/utils/index.js +1 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -2
- package/dist/types/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
- package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types/plugins/list/commands/index.d.ts +2 -1
- package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types/plugins/list/utils/node.d.ts +2 -17
- package/dist/types/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types/plugins/text-color/commands/toggle-color.d.ts +1 -1
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +2 -2
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +4 -4
- package/dist/types/types/editor-instance.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +5 -8
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +2 -2
- package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +1 -2
- 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/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -1
- package/dist/types/ui/styles.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +3 -42
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -5
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -2
- package/dist/types-ts4.5/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
- package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types-ts4.5/plugins/text-color/commands/toggle-color.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-appearance-component.d.ts +4 -4
- package/dist/types-ts4.5/types/editor-instance.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +5 -8
- package/dist/types-ts4.5/ui/Appearance/Comment/Comment.d.ts +2 -2
- package/dist/types-ts4.5/ui/Appearance/Comment/Toolbar.d.ts +1 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/commands.d.ts +3 -48
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +1 -5
- package/package.json +3 -3
- package/report.api.md +2 -13
- package/tmp/api-report-tmp.d.ts +2 -10
- package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
- package/dist/cjs/ui/Appearance/FullPage/messages.js +0 -25
- package/dist/cjs/ui/DropdownMenu/index.js +0 -31
- package/dist/cjs/ui/DropdownMenu/types.js +0 -5
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -218
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
- package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
- package/dist/es2019/ui/Appearance/FullPage/messages.js +0 -18
- package/dist/es2019/ui/DropdownMenu/index.js +0 -18
- package/dist/es2019/ui/DropdownMenu/types.js +0 -1
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -205
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
- package/dist/esm/plugins/list/utils/replace-content.js +0 -17
- package/dist/esm/ui/Appearance/FullPage/messages.js +0 -18
- package/dist/esm/ui/DropdownMenu/index.js +0 -20
- package/dist/esm/ui/DropdownMenu/types.js +0 -1
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -205
- package/dist/esm/utils/prosemirror/autojoin.js +0 -63
- package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types/ui/Appearance/FullPage/messages.d.ts +0 -18
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -3
- package/dist/types/ui/DropdownMenu/types.d.ts +0 -1
- package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +0 -31
- package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
- package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types-ts4.5/ui/Appearance/FullPage/messages.d.ts +0 -18
- package/dist/types-ts4.5/ui/DropdownMenu/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/DropdownMenu/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +0 -31
- package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
-
import { transformSmartCharsMentionsAndEmojis } from '../plugins/text-formatting/commands/transform-to-code';
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
2
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
5
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
|
-
const isEmptySelectionAtStart = state => {
|
|
7
|
-
const {
|
|
8
|
-
empty,
|
|
9
|
-
$from
|
|
10
|
-
} = state.selection;
|
|
11
|
-
return empty && ($from.parentOffset === 0 || state.selection instanceof GapCursorSelection);
|
|
12
|
-
};
|
|
13
|
-
const isEmptySelectionAtEnd = state => {
|
|
14
|
-
const {
|
|
15
|
-
empty,
|
|
16
|
-
$from
|
|
17
|
-
} = state.selection;
|
|
18
|
-
return empty && ($from.end() === $from.pos || state.selection instanceof GapCursorSelection);
|
|
19
|
-
};
|
|
20
3
|
const isFirstChildOfParent = state => {
|
|
21
4
|
const {
|
|
22
5
|
$from
|
|
@@ -65,160 +48,12 @@ function findCutBefore($pos) {
|
|
|
65
48
|
}
|
|
66
49
|
return null;
|
|
67
50
|
}
|
|
68
|
-
const applyMarkOnRange = (from, to, removeMark, mark, tr) => {
|
|
69
|
-
const {
|
|
70
|
-
schema
|
|
71
|
-
} = tr.doc.type;
|
|
72
|
-
const {
|
|
73
|
-
code
|
|
74
|
-
} = schema.marks;
|
|
75
|
-
if (mark.type === code) {
|
|
76
|
-
transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
77
|
-
}
|
|
78
|
-
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), (node, pos) => {
|
|
79
|
-
if (!node.isText) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// This is an issue when the user selects some text.
|
|
84
|
-
// We need to check if the current node position is less than the range selection from.
|
|
85
|
-
// If it’s true, that means we should apply the mark using the range selection,
|
|
86
|
-
// not the current node position.
|
|
87
|
-
const nodeBetweenFrom = Math.max(pos, tr.mapping.map(from));
|
|
88
|
-
const nodeBetweenTo = Math.min(pos + node.nodeSize, tr.mapping.map(to));
|
|
89
|
-
if (removeMark) {
|
|
90
|
-
tr.removeMark(nodeBetweenFrom, nodeBetweenTo, mark);
|
|
91
|
-
} else {
|
|
92
|
-
tr.addMark(nodeBetweenFrom, nodeBetweenTo, mark);
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
});
|
|
96
|
-
return tr;
|
|
97
|
-
};
|
|
98
|
-
const entireSelectionContainsMark = (mark, doc, fromPos, toPos) => {
|
|
99
|
-
let onlyContainsMark = true;
|
|
100
|
-
doc.nodesBetween(fromPos, toPos, node => {
|
|
101
|
-
// Skip recursion once we've found text which doesn't include the mark
|
|
102
|
-
if (!onlyContainsMark) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
if (node.isText) {
|
|
106
|
-
onlyContainsMark && (onlyContainsMark = mark.isInSet(node.marks));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return onlyContainsMark;
|
|
110
|
-
};
|
|
111
|
-
const toggleMarkInRange = mark => (state, dispatch) => {
|
|
112
|
-
const tr = state.tr;
|
|
113
|
-
if (state.selection instanceof CellSelection) {
|
|
114
|
-
let removeMark = true;
|
|
115
|
-
const cells = [];
|
|
116
|
-
state.selection.forEachCell((cell, cellPos) => {
|
|
117
|
-
cells.push({
|
|
118
|
-
node: cell,
|
|
119
|
-
pos: cellPos
|
|
120
|
-
});
|
|
121
|
-
const from = cellPos;
|
|
122
|
-
const to = cellPos + cell.nodeSize;
|
|
123
|
-
removeMark && (removeMark = entireSelectionContainsMark(mark, state.doc, from, to));
|
|
124
|
-
});
|
|
125
|
-
for (let i = cells.length - 1; i >= 0; i--) {
|
|
126
|
-
const cell = cells[i];
|
|
127
|
-
const from = cell.pos;
|
|
128
|
-
const to = from + cell.node.nodeSize;
|
|
129
|
-
applyMarkOnRange(from, to, removeMark, mark, tr);
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
const {
|
|
133
|
-
$from,
|
|
134
|
-
$to
|
|
135
|
-
} = state.selection;
|
|
136
|
-
// We decide to remove the mark only if the entire selection contains the mark
|
|
137
|
-
// Examples with *bold* text
|
|
138
|
-
// Scenario 1: Selection contains both bold and non-bold text -> bold entire selection
|
|
139
|
-
// Scenario 2: Selection contains only bold text -> un-bold entire selection
|
|
140
|
-
// Scenario 3: Selection contains no bold text -> bold entire selection
|
|
141
|
-
const removeMark = entireSelectionContainsMark(mark, state.doc, $from.pos, $to.pos);
|
|
142
|
-
applyMarkOnRange($from.pos, $to.pos, removeMark, mark, tr);
|
|
143
|
-
}
|
|
144
|
-
if (tr.docChanged) {
|
|
145
|
-
if (dispatch) {
|
|
146
|
-
dispatch(tr);
|
|
147
|
-
}
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
return false;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* A wrapper over the default toggleMark, except when we have a selection
|
|
155
|
-
* we only toggle marks on text nodes rather than inline nodes.
|
|
156
|
-
* @param markType
|
|
157
|
-
* @param attrs
|
|
158
|
-
*/
|
|
159
|
-
const toggleMark = (markType, attrs) => (state, dispatch) => {
|
|
160
|
-
const mark = markType.create(attrs);
|
|
161
|
-
|
|
162
|
-
// For cursor selections we can use the default behaviour.
|
|
163
|
-
if (state.selection instanceof TextSelection && state.selection.$cursor) {
|
|
164
|
-
const tr = state.tr;
|
|
165
|
-
if (mark.isInSet(state.storedMarks || state.selection.$cursor.marks())) {
|
|
166
|
-
tr.removeStoredMark(mark);
|
|
167
|
-
} else {
|
|
168
|
-
tr.addStoredMark(mark);
|
|
169
|
-
}
|
|
170
|
-
if (dispatch) {
|
|
171
|
-
dispatch(tr);
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
return toggleMarkInRange(mark)(state, dispatch);
|
|
177
|
-
};
|
|
178
51
|
const withScrollIntoView = command => (state, dispatch, view) => command(state, tr => {
|
|
179
52
|
tr.scrollIntoView();
|
|
180
53
|
if (dispatch) {
|
|
181
54
|
dispatch(tr);
|
|
182
55
|
}
|
|
183
56
|
}, view);
|
|
184
|
-
/**
|
|
185
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
186
|
-
* the next node, or reach the end of the document.
|
|
187
|
-
*
|
|
188
|
-
* @param $startPos Position to start walking from.
|
|
189
|
-
*/
|
|
190
|
-
const walkNextNode = $startPos => {
|
|
191
|
-
let $pos = $startPos;
|
|
192
|
-
|
|
193
|
-
// invariant 1: don't walk past the end of the document
|
|
194
|
-
// invariant 2: we are at the beginning or
|
|
195
|
-
// we haven't walked to the start of *any* node
|
|
196
|
-
// parentOffset includes textOffset.
|
|
197
|
-
while ($pos.pos < $pos.doc.nodeSize - 2 && ($pos.pos === $startPos.pos || $pos.parentOffset > 0)) {
|
|
198
|
-
$pos = $pos.doc.resolve($pos.pos + 1);
|
|
199
|
-
}
|
|
200
|
-
return {
|
|
201
|
-
$pos: $pos,
|
|
202
|
-
foundNode: $pos.pos < $pos.doc.nodeSize - 2
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
208
|
-
* the previous node, or reach the start of the document.
|
|
209
|
-
*
|
|
210
|
-
* @param $startPos Position to start walking from.
|
|
211
|
-
*/
|
|
212
|
-
const walkPrevNode = $startPos => {
|
|
213
|
-
let $pos = $startPos;
|
|
214
|
-
while ($pos.pos > 0 && ($pos.pos === $startPos.pos || $pos.parentOffset < $pos.parent.nodeSize - 2)) {
|
|
215
|
-
$pos = $pos.doc.resolve($pos.pos - 1);
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
$pos: $pos,
|
|
219
|
-
foundNode: $pos.pos > 0
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
57
|
|
|
223
58
|
/**
|
|
224
59
|
* Insert content, delete a range and create a new selection
|
|
@@ -230,57 +65,10 @@ const walkPrevNode = $startPos => {
|
|
|
230
65
|
* @param deletions the ranges to delete
|
|
231
66
|
*/
|
|
232
67
|
|
|
233
|
-
const insertContentDeleteRange = (tr, getSelectionResolvedPos, insertions, deletions) => {
|
|
234
|
-
insertions.forEach(contentInsert => {
|
|
235
|
-
let [content, pos] = contentInsert;
|
|
236
|
-
tr.insert(tr.mapping.map(pos), content);
|
|
237
|
-
});
|
|
238
|
-
deletions.forEach(deleteRange => {
|
|
239
|
-
let [firstPos, lastPos] = deleteRange;
|
|
240
|
-
tr.delete(tr.mapping.map(firstPos), tr.mapping.map(lastPos));
|
|
241
|
-
});
|
|
242
|
-
tr.setSelection(new TextSelection(getSelectionResolvedPos(tr)));
|
|
243
|
-
};
|
|
244
68
|
const selectNode = pos => (state, dispatch) => {
|
|
245
69
|
if (dispatch) {
|
|
246
70
|
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
247
71
|
}
|
|
248
72
|
return true;
|
|
249
73
|
};
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
253
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
254
|
-
*
|
|
255
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
256
|
-
* @returns PM Command
|
|
257
|
-
*/
|
|
258
|
-
const deleteEmptyParagraphAndMoveBlockUp = canNextNodeMoveUp => {
|
|
259
|
-
return (state, dispatch, view) => {
|
|
260
|
-
const {
|
|
261
|
-
selection: {
|
|
262
|
-
$from: {
|
|
263
|
-
pos,
|
|
264
|
-
parent
|
|
265
|
-
},
|
|
266
|
-
$head,
|
|
267
|
-
empty
|
|
268
|
-
},
|
|
269
|
-
tr,
|
|
270
|
-
doc
|
|
271
|
-
} = state;
|
|
272
|
-
const {
|
|
273
|
-
$pos
|
|
274
|
-
} = walkNextNode($head);
|
|
275
|
-
const nextPMNode = doc.nodeAt($pos.pos - 1);
|
|
276
|
-
if (empty && nextPMNode && canNextNodeMoveUp(nextPMNode) && isEmptyParagraph(parent) && view !== null && view !== void 0 && view.endOfTextblock('right')) {
|
|
277
|
-
tr.deleteRange(pos - 1, pos + 1);
|
|
278
|
-
if (dispatch) {
|
|
279
|
-
dispatch(tr);
|
|
280
|
-
}
|
|
281
|
-
return true;
|
|
282
|
-
}
|
|
283
|
-
return false;
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
export { isEmptySelectionAtStart, isEmptySelectionAtEnd, isFirstChildOfParent, isNthParentOfType, findCutBefore, toggleMark, applyMarkOnRange, withScrollIntoView, walkNextNode, walkPrevNode, insertContentDeleteRange, selectNode, deleteEmptyParagraphAndMoveBlockUp };
|
|
74
|
+
export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode };
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
2
|
import { getBreakoutMode } from './node-width';
|
|
4
|
-
import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
8
|
-
*/
|
|
9
|
-
export function hasVisibleContent(node) {
|
|
10
|
-
const isInlineNodeHasVisibleContent = inlineNode => {
|
|
11
|
-
return inlineNode.isText ? !!inlineNode.textContent.trim() : inlineNode.type.name !== 'hardBreak';
|
|
12
|
-
};
|
|
13
|
-
if (node.isInline) {
|
|
14
|
-
return isInlineNodeHasVisibleContent(node);
|
|
15
|
-
} else if (node.isBlock && (node.isLeaf || node.isAtom)) {
|
|
16
|
-
return true;
|
|
17
|
-
} else if (!node.childCount) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
for (let index = 0; index < node.childCount; index++) {
|
|
21
|
-
const child = node.child(index);
|
|
22
|
-
const invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
23
|
-
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
3
|
+
import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
29
4
|
|
|
30
5
|
/**
|
|
31
6
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
|
|
|
7
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
8
|
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
-
export {
|
|
10
|
+
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
11
|
export { sanitiseMarksInSelection } from './mark';
|
|
12
12
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
13
|
export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
|
@@ -294,18 +294,6 @@ export const isInsideBlockQuote = state => {
|
|
|
294
294
|
} = state.schema.nodes;
|
|
295
295
|
return hasParentNodeOfType(blockquote)(state.selection);
|
|
296
296
|
};
|
|
297
|
-
export function filterChildrenBetween(doc, from, to, predicate) {
|
|
298
|
-
const results = [];
|
|
299
|
-
doc.nodesBetween(from, to, (node, pos, parent) => {
|
|
300
|
-
if (predicate(node, pos, parent)) {
|
|
301
|
-
results.push({
|
|
302
|
-
node,
|
|
303
|
-
pos
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
return results;
|
|
308
|
-
}
|
|
309
297
|
export function dedupe(list = [], iteratee = p => p) {
|
|
310
298
|
/**
|
|
311
299
|
.,
|
package/dist/es2019/version.json
CHANGED
|
@@ -15,10 +15,9 @@ import PropTypes from 'prop-types';
|
|
|
15
15
|
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
16
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
17
|
import { editorMessages } from './messages';
|
|
18
|
-
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking, processRawValue, analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
20
20
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
21
|
-
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
22
21
|
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
23
22
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
24
23
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
|
@@ -30,17 +29,16 @@ import { getDocStructure } from '../utils/document-logger';
|
|
|
30
29
|
import { isFullPage } from '../utils/is-full-page';
|
|
31
30
|
import measurements from '../utils/performance/measure-enum';
|
|
32
31
|
import { getNodesCount } from '../utils/document';
|
|
33
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
34
32
|
import { createSchema } from './create-schema';
|
|
35
33
|
import { PluginPerformanceObserver } from '../utils/performance/plugin-performance-observer';
|
|
36
34
|
import { getParticipantsCount } from '../plugins/collab-edit/get-participants-count';
|
|
35
|
+
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE, TransactionTracker } from '../utils/performance/track-transactions';
|
|
37
36
|
import { countNodes as _countNodes } from '../utils/count-nodes';
|
|
38
|
-
import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
39
|
-
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE } from '../utils/performance/track-transactions';
|
|
40
37
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
41
38
|
import { getContextIdentifier } from '../plugins/base/pm-plugins/context-identifier';
|
|
42
39
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
43
40
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
41
|
+
import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
|
|
44
42
|
function handleEditorFocus(view) {
|
|
45
43
|
if (view.hasFocus()) {
|
|
46
44
|
return;
|
|
@@ -78,7 +76,6 @@ function handleEditorFocus(view) {
|
|
|
78
76
|
view.focus();
|
|
79
77
|
}, 0);
|
|
80
78
|
}
|
|
81
|
-
export var EDIT_AREA_ID = 'ak-editor-textarea';
|
|
82
79
|
export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
83
80
|
_inherits(ReactEditorView, _React$Component);
|
|
84
81
|
var _super = _createSuper(ReactEditorView);
|
package/dist/esm/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } f
|
|
|
42
42
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
43
43
|
|
|
44
44
|
// Used in editor-test-helpers and mobile bridge
|
|
45
|
-
export { setTextSelection, dedupe, getNodesCount, measurements
|
|
45
|
+
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
46
46
|
export { getListCommands } from './utils/list-commands';
|
|
47
47
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
48
48
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -3,7 +3,7 @@ import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addAnalytics } from '../../analytics/utils';
|
|
5
5
|
import { getSelectionPositions, getPluginState, getDraftCommandAnalyticsPayload } from '../utils';
|
|
6
|
-
import { applyMarkOnRange } from '
|
|
6
|
+
import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
|
|
7
7
|
var addAnnotationMark = function addAnnotationMark(id) {
|
|
8
8
|
return function (transaction, state) {
|
|
9
9
|
var inlineCommentState = getPluginState(state);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import {
|
|
4
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { isSelectionEndOfParagraph } from '../../../utils';
|
|
6
6
|
export var newlinePreserveMarksKey = new PluginKey('newlinePreserveMarksPlugin');
|
|
7
7
|
var isSelectionAligned = function isSelectionAligned(state) {
|
|
@@ -9,7 +9,7 @@ import { shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/
|
|
|
9
9
|
import { withAnalytics as withAnalyticsDeprecated } from '../../analytics';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
11
11
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
12
|
-
import { filterChildrenBetween } from '
|
|
12
|
+
import { filterChildrenBetween } from '@atlaskit/editor-common/mark';
|
|
13
13
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
14
14
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
15
15
|
import { transformToCodeBlockAction } from './transform-to-code-block';
|
|
@@ -5,7 +5,7 @@ import * as commands from '../../../commands';
|
|
|
5
5
|
import * as blockTypes from '../types';
|
|
6
6
|
import { keymap } from '../../../utils/keymap';
|
|
7
7
|
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockTypesWithAnalytics } from '../commands';
|
|
8
|
-
import { deleteEmptyParagraphAndMoveBlockUp } from '
|
|
8
|
+
import { deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { INPUT_METHOD } from '../../analytics';
|
|
10
10
|
import { isNodeAWrappingBlockNode } from '../utils';
|
|
11
11
|
var backspace = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
|
14
14
|
import { jsx } from '@emotion/react';
|
|
15
15
|
import { injectIntl } from 'react-intl-next';
|
|
16
16
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
17
|
-
import DropdownMenu from '
|
|
17
|
+
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
18
18
|
import { separatorStyles, wrapperStyle } from '@atlaskit/editor-common/styles';
|
|
19
19
|
import { blockTypeMenuItemStyle, keyboardShortcut, keyboardShortcutSelect } from './styled';
|
|
20
20
|
import { tooltip, findKeymapByDescription } from '../../../../keymaps';
|
|
@@ -3,7 +3,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { getCursor } from '../../../utils';
|
|
6
|
-
import {
|
|
6
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isCursorBeforeClosingCharacter, isClosingCharacter } from '../ide-ux/paired-character-handling';
|
|
8
8
|
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bracket-handling';
|
|
9
9
|
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
|
|
@@ -11,9 +11,8 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
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; } }
|
|
13
13
|
/** @jsx jsx */
|
|
14
|
-
import React from 'react';
|
|
14
|
+
import React, { Component } from 'react';
|
|
15
15
|
import { css, jsx } from '@emotion/react';
|
|
16
|
-
import { Component } from 'react';
|
|
17
16
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
18
17
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
19
18
|
import { themed } from '@atlaskit/theme/components';
|
|
@@ -21,7 +20,7 @@ import { borderRadius } from '@atlaskit/theme/constants';
|
|
|
21
20
|
import { DN70 } from '@atlaskit/theme/colors';
|
|
22
21
|
import { compareArrays, shallowEqual } from '../utils';
|
|
23
22
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
24
|
-
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
23
|
+
import { FloatingToolbarButton as Button, Announcer } from '@atlaskit/editor-common/ui';
|
|
25
24
|
import Dropdown from './Dropdown';
|
|
26
25
|
import Select from './Select';
|
|
27
26
|
import Separator from './Separator';
|
|
@@ -30,12 +29,11 @@ import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
|
30
29
|
import ColorPickerButton from '../../../ui/ColorPickerButton';
|
|
31
30
|
import { backgroundPaletteTooltipMessages } from '../../../ui/ColorPalette';
|
|
32
31
|
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
33
|
-
import { Announcer } from '@atlaskit/editor-common/ui';
|
|
34
32
|
import { injectIntl } from 'react-intl-next';
|
|
35
33
|
import messages from './messages';
|
|
36
34
|
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
37
35
|
import ScrollButtons from './ScrollButtons';
|
|
38
|
-
import { ToolbarArrowKeyNavigationProvider } from '
|
|
36
|
+
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
39
37
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
40
38
|
var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
41
39
|
var items = _ref.items,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import DropdownMenu from '
|
|
3
|
+
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
4
4
|
import { DropDownButton } from './dropdown-button';
|
|
5
5
|
export var BlockInsertMenuLegacy = function BlockInsertMenuLegacy(props) {
|
|
6
6
|
var items = props.items;
|
|
@@ -6,7 +6,7 @@ import { TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
8
8
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { createSelectionClickHandler } from '../../selection/utils';
|
|
11
11
|
import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from '../actions';
|
|
12
12
|
import { pluginKey } from './plugin-key';
|
|
@@ -2,8 +2,8 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isEmptyParagraph, isListNode } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { joinSiblingLists } from '@atlaskit/editor-common/lists';
|
|
7
7
|
import { findFirstParentListNode } from '../utils/find';
|
|
8
8
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
9
9
|
export function convertListType(_ref) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
5
5
|
import { findFirstParentListItemNode } from '../utils/find';
|
|
6
|
-
import {
|
|
6
|
+
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
8
8
|
export var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
9
9
|
var originalSelection = tr.selection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LIST_TEXT_SCENARIOS } from '../../analytics';
|
|
2
|
-
import { isParagraphNode, isListNode, isListItemNode } from '
|
|
2
|
+
import { isParagraphNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
4
4
|
import { joinParagrapWithList, joinSiblingListItems, joinNestedListWithParentListItem, joinListItemWithParentNestedList, joinListItemWithParagraph } from './join-list-items-scenarios';
|
|
5
5
|
export var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange, isListNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { isListNode } from '../../utils/node';
|
|
4
3
|
// Case for when a users selection is at the end of a paragraph, the paragraph
|
|
5
4
|
// is followed by a list, and they delete forward
|
|
6
5
|
export var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of greater indentation
|
|
4
4
|
export var joinListItemWithParentNestedList = function joinListItemWithParentNestedList(_ref) {
|
|
5
5
|
var tr = _ref.tr,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of lower indentation
|
|
4
4
|
export var joinNestedListWithParentListItem = function joinNestedListWithParentListItem(_ref) {
|
|
5
5
|
var tr = _ref.tr,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
2
|
//Case for two adjacent nodes with the first being a list item and the last being a paragraph
|
|
3
3
|
export var joinParagrapWithList = function joinParagrapWithList(_ref) {
|
|
4
4
|
var tr = _ref.tr,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
2
|
//Case for two adjacent list items of the same indentation
|
|
3
3
|
export var joinSiblingListItems = function joinSiblingListItems(_ref) {
|
|
4
4
|
var tr = _ref.tr,
|
|
@@ -4,10 +4,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { NodeRange, Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { liftTarget, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
7
|
-
import { getOrderFromOrderedListNode } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import {
|
|
7
|
+
import { getOrderFromOrderedListNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { joinSiblingLists, JoinDirection, normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
9
9
|
import { findFirstParentListItemNode, findRootParentListNode } from '../utils/find';
|
|
10
|
-
import {
|
|
10
|
+
import { createListNodeRange } from '../utils/selection';
|
|
11
11
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
12
12
|
import { storeRestartListsAttributes, getRestartListsAttributes } from '../utils/analytics';
|
|
13
13
|
import { OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, Slice, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { ReplaceAroundStep, findWrapping, canSplit } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import { autoJoinTr } from '
|
|
3
|
+
import { autoJoinTr } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
5
5
|
import { isWrappingPossible } from '../utils/selection';
|
|
6
6
|
|
|
@@ -2,13 +2,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { hasValidListIndentationLevel } from '
|
|
5
|
+
import { hasValidListIndentationLevel, getListItemAttributes, getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
6
6
|
import { indentListItemsSelected as indentListAction } from '../actions/indent-list-items-selected';
|
|
7
|
-
import { isBulletList } from '
|
|
7
|
+
import { isBulletList } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { findFirstParentListNode } from '../utils/find';
|
|
9
9
|
import { MAX_NESTED_LIST_INDENTATION } from '../types';
|
|
10
|
-
import { isInsideListItem, isInsideTableCell
|
|
11
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
10
|
+
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
12
11
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
13
12
|
export var indentList = function indentList(editorAnalyticsAPI) {
|
|
14
13
|
return function () {
|