@atlaskit/editor-core 187.8.7 → 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 +7 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
- 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/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/cjs/utils/commands.js +3 -109
- package/dist/cjs/utils/document.js +1 -26
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.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/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/es2019/utils/commands.js +2 -102
- package/dist/es2019/utils/document.js +1 -26
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.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/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/esm/utils/commands.js +2 -100
- package/dist/esm/utils/document.js +1 -26
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.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/utils/commands.d.ts +3 -32
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/index.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/utils/commands.d.ts +3 -38
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +0 -3
- package/tmp/api-report-tmp.d.ts +0 -3
- package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
- package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
- package/dist/esm/plugins/list/utils/replace-content.js +0 -17
- package/dist/esm/utils/prosemirror/autojoin.js +0 -63
- package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
- 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/utils/prosemirror/autojoin.d.ts +0 -13
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode, ResolvedPos, NodeType, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { EditorState, Transaction, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
export declare const isPosInsideParagraph: ($pos: ResolvedPos) => boolean;
|
|
5
4
|
export declare const isPosInsideList: ($pos: ResolvedPos) => boolean;
|
|
6
5
|
export declare const isWrappingPossible: (nodeType: NodeType, selection: Selection) => boolean;
|
|
@@ -8,16 +7,6 @@ export declare const isInsideListItem: (state: EditorState) => boolean;
|
|
|
8
7
|
export declare const isInsideTableCell: (state: EditorState) => boolean;
|
|
9
8
|
export declare const canJoinToPreviousListItem: (state: EditorState) => boolean;
|
|
10
9
|
export declare const selectionContainsList: (tr: Transaction) => PMNode | null;
|
|
11
|
-
export declare const numberNestedLists: (resolvedPos: ResolvedPos) => number;
|
|
12
|
-
export declare const getListItemAttributes: ($pos: ResolvedPos) => {
|
|
13
|
-
indentLevel: number;
|
|
14
|
-
itemIndex: number;
|
|
15
|
-
};
|
|
16
|
-
type NormalizeListItemsSelection = (props: {
|
|
17
|
-
selection: Selection;
|
|
18
|
-
doc: PMNode;
|
|
19
|
-
}) => Selection;
|
|
20
|
-
export declare const normalizeListItemsSelection: NormalizeListItemsSelection;
|
|
21
10
|
type CreateNodeRange = (props: {
|
|
22
11
|
selection: Selection;
|
|
23
12
|
}) => NodeRange | null;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { EditorState
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { ResolvedPos
|
|
3
|
+
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
|
|
5
|
-
declare const isEmptySelectionAtStart: (state: EditorState) => boolean;
|
|
6
|
-
declare const isEmptySelectionAtEnd: (state: EditorState) => boolean;
|
|
7
5
|
declare const isFirstChildOfParent: (state: EditorState) => boolean;
|
|
8
6
|
/**
|
|
9
7
|
* Creates a filter that checks if the node at a given number of parents above the current
|
|
@@ -16,24 +14,6 @@ declare const isFirstChildOfParent: (state: EditorState) => boolean;
|
|
|
16
14
|
declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
|
|
17
15
|
declare function findCutBefore($pos: ResolvedPos): ResolvedPos | null;
|
|
18
16
|
declare const withScrollIntoView: HigherOrderCommand;
|
|
19
|
-
export type WalkNode = {
|
|
20
|
-
$pos: ResolvedPos;
|
|
21
|
-
foundNode: boolean;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
25
|
-
* the next node, or reach the end of the document.
|
|
26
|
-
*
|
|
27
|
-
* @param $startPos Position to start walking from.
|
|
28
|
-
*/
|
|
29
|
-
declare const walkNextNode: ($startPos: ResolvedPos) => WalkNode;
|
|
30
|
-
/**
|
|
31
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
32
|
-
* the previous node, or reach the start of the document.
|
|
33
|
-
*
|
|
34
|
-
* @param $startPos Position to start walking from.
|
|
35
|
-
*/
|
|
36
|
-
declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
37
17
|
/**
|
|
38
18
|
* Insert content, delete a range and create a new selection
|
|
39
19
|
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
@@ -43,14 +23,5 @@ declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
|
43
23
|
* @param insertions content to insert at the specified position
|
|
44
24
|
* @param deletions the ranges to delete
|
|
45
25
|
*/
|
|
46
|
-
declare const insertContentDeleteRange: (tr: Transaction, getSelectionResolvedPos: (tr: Transaction) => ResolvedPos, insertions: [Fragment, number][], deletions: [number, number][]) => void;
|
|
47
26
|
declare const selectNode: (pos: number) => Command;
|
|
48
|
-
|
|
49
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
50
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
51
|
-
*
|
|
52
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
53
|
-
* @returns PM Command
|
|
54
|
-
*/
|
|
55
|
-
declare const deleteEmptyParagraphAndMoveBlockUp: (canNextNodeMoveUp: (nextNode: PMNode) => boolean) => Command;
|
|
56
|
-
export { isEmptySelectionAtStart, isEmptySelectionAtEnd, isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, walkNextNode, walkPrevNode, insertContentDeleteRange, selectNode, deleteEmptyParagraphAndMoveBlockUp, };
|
|
27
|
+
export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode, };
|
|
@@ -6,10 +6,6 @@ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
6
6
|
import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
|
|
8
8
|
import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
|
|
9
|
-
/**
|
|
10
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
11
|
-
*/
|
|
12
|
-
export declare function hasVisibleContent(node: Node): boolean;
|
|
13
9
|
/**
|
|
14
10
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
15
11
|
*/
|
|
@@ -2,7 +2,7 @@ import type { MarkType, Node, ResolvedPos, Schema, Slice } from '@atlaskit/edito
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
5
|
-
export {
|
|
5
|
+
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount, } from './document';
|
|
6
6
|
export { sanitiseMarksInSelection } from './mark';
|
|
7
7
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
8
8
|
export { setNodeSelection, setGapCursorSelection, setTextSelection, } from './selection';
|
|
@@ -58,7 +58,7 @@ export { historyPluginKey } from './plugins/history';
|
|
|
58
58
|
export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, } from '@atlaskit/editor-common/analytics';
|
|
59
59
|
export type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
60
60
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
|
|
61
|
-
export { setTextSelection, dedupe, getNodesCount, measurements
|
|
61
|
+
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
62
62
|
export { getListCommands } from './utils/list-commands';
|
|
63
63
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
64
64
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WalkNode } from '
|
|
1
|
+
import type { WalkNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { LIST_TEXT_SCENARIOS } from '../../analytics';
|
|
3
3
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command } from '../../../types';
|
|
2
|
-
import { EditorAnalyticsAPI
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
4
5
|
export declare const indentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => Command;
|
|
5
6
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ResolvedPos, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Command } from '../../../types';
|
|
4
|
-
import {
|
|
4
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { outdentList } from './outdent-list';
|
|
6
7
|
import { indentList } from './indent-list';
|
|
7
8
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { Command } from '../../../types';
|
|
3
3
|
export declare const joinListItemForward: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WalkNode } from '
|
|
1
|
+
import type { WalkNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { Command } from '../../../types';
|
|
2
|
-
import { INPUT_METHOD
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
5
|
type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
5
6
|
export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => Command;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RestartListsAttributesForListOutdented
|
|
3
|
-
export declare const getCommonListAnalyticsAttributes: (state: EditorState) => CommonListAnalyticsAttributes;
|
|
4
|
-
export declare const countListItemsInSelection: (state: EditorState) => number;
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { RestartListsAttributesForListOutdented } from '@atlaskit/editor-common/analytics';
|
|
5
3
|
export declare const RESTART_LISTS_ANALYTICS_KEY = "restartListsAnalytics";
|
|
6
4
|
export declare const getRestartListsAttributes: (tr: Transaction) => RestartListsAttributesForListOutdented;
|
|
7
5
|
export declare const storeRestartListsAttributes: (tr: Transaction, attributes: RestartListsAttributesForListOutdented) => void;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
export declare const getListLiftTarget: (resPos: ResolvedPos) => number;
|
|
4
|
-
export declare const hasValidListIndentationLevel: ({ tr, maxIndentation, }: {
|
|
5
|
-
tr: Transaction;
|
|
6
|
-
maxIndentation: number;
|
|
7
|
-
}) => boolean;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export { isListNode, isListItemNode, isBulletList, isParagraphNode, } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export declare enum JoinDirection {
|
|
5
|
-
LEFT = 1,
|
|
6
|
-
RIGHT = -1
|
|
7
|
-
}
|
|
8
|
-
type JoinSiblingListsProps = {
|
|
9
|
-
tr: Transaction;
|
|
10
|
-
direction?: JoinDirection;
|
|
11
|
-
forceListType?: NodeType;
|
|
12
|
-
};
|
|
13
|
-
type ListsJoined = {
|
|
14
|
-
orderedList: number;
|
|
15
|
-
bulletList: number;
|
|
16
|
-
};
|
|
17
|
-
export declare const joinSiblingLists: ({ tr, direction, forceListType, }: JoinSiblingListsProps) => ListsJoined;
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
export declare function isListNodeValidContent(node: PMNode): boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode, ResolvedPos, NodeType, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { EditorState, Transaction, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
export declare const isPosInsideParagraph: ($pos: ResolvedPos) => boolean;
|
|
5
4
|
export declare const isPosInsideList: ($pos: ResolvedPos) => boolean;
|
|
6
5
|
export declare const isWrappingPossible: (nodeType: NodeType, selection: Selection) => boolean;
|
|
@@ -8,16 +7,6 @@ export declare const isInsideListItem: (state: EditorState) => boolean;
|
|
|
8
7
|
export declare const isInsideTableCell: (state: EditorState) => boolean;
|
|
9
8
|
export declare const canJoinToPreviousListItem: (state: EditorState) => boolean;
|
|
10
9
|
export declare const selectionContainsList: (tr: Transaction) => PMNode | null;
|
|
11
|
-
export declare const numberNestedLists: (resolvedPos: ResolvedPos) => number;
|
|
12
|
-
export declare const getListItemAttributes: ($pos: ResolvedPos) => {
|
|
13
|
-
indentLevel: number;
|
|
14
|
-
itemIndex: number;
|
|
15
|
-
};
|
|
16
|
-
type NormalizeListItemsSelection = (props: {
|
|
17
|
-
selection: Selection;
|
|
18
|
-
doc: PMNode;
|
|
19
|
-
}) => Selection;
|
|
20
|
-
export declare const normalizeListItemsSelection: NormalizeListItemsSelection;
|
|
21
10
|
type CreateNodeRange = (props: {
|
|
22
11
|
selection: Selection;
|
|
23
12
|
}) => NodeRange | null;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { EditorState
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { ResolvedPos
|
|
3
|
+
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
|
|
5
|
-
declare const isEmptySelectionAtStart: (state: EditorState) => boolean;
|
|
6
|
-
declare const isEmptySelectionAtEnd: (state: EditorState) => boolean;
|
|
7
5
|
declare const isFirstChildOfParent: (state: EditorState) => boolean;
|
|
8
6
|
/**
|
|
9
7
|
* Creates a filter that checks if the node at a given number of parents above the current
|
|
@@ -16,24 +14,6 @@ declare const isFirstChildOfParent: (state: EditorState) => boolean;
|
|
|
16
14
|
declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
|
|
17
15
|
declare function findCutBefore($pos: ResolvedPos): ResolvedPos | null;
|
|
18
16
|
declare const withScrollIntoView: HigherOrderCommand;
|
|
19
|
-
export type WalkNode = {
|
|
20
|
-
$pos: ResolvedPos;
|
|
21
|
-
foundNode: boolean;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
25
|
-
* the next node, or reach the end of the document.
|
|
26
|
-
*
|
|
27
|
-
* @param $startPos Position to start walking from.
|
|
28
|
-
*/
|
|
29
|
-
declare const walkNextNode: ($startPos: ResolvedPos) => WalkNode;
|
|
30
|
-
/**
|
|
31
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
32
|
-
* the previous node, or reach the start of the document.
|
|
33
|
-
*
|
|
34
|
-
* @param $startPos Position to start walking from.
|
|
35
|
-
*/
|
|
36
|
-
declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
37
17
|
/**
|
|
38
18
|
* Insert content, delete a range and create a new selection
|
|
39
19
|
* This function automatically handles the mapping of positions for insertion and deletion.
|
|
@@ -43,20 +23,5 @@ declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
|
43
23
|
* @param insertions content to insert at the specified position
|
|
44
24
|
* @param deletions the ranges to delete
|
|
45
25
|
*/
|
|
46
|
-
declare const insertContentDeleteRange: (tr: Transaction, getSelectionResolvedPos: (tr: Transaction) => ResolvedPos, insertions: [
|
|
47
|
-
Fragment,
|
|
48
|
-
number
|
|
49
|
-
][], deletions: [
|
|
50
|
-
number,
|
|
51
|
-
number
|
|
52
|
-
][]) => void;
|
|
53
26
|
declare const selectNode: (pos: number) => Command;
|
|
54
|
-
|
|
55
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
56
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
57
|
-
*
|
|
58
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
59
|
-
* @returns PM Command
|
|
60
|
-
*/
|
|
61
|
-
declare const deleteEmptyParagraphAndMoveBlockUp: (canNextNodeMoveUp: (nextNode: PMNode) => boolean) => Command;
|
|
62
|
-
export { isEmptySelectionAtStart, isEmptySelectionAtEnd, isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, walkNextNode, walkPrevNode, insertContentDeleteRange, selectNode, deleteEmptyParagraphAndMoveBlockUp, };
|
|
27
|
+
export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode, };
|
|
@@ -6,10 +6,6 @@ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
6
6
|
import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
|
|
8
8
|
import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
|
|
9
|
-
/**
|
|
10
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
11
|
-
*/
|
|
12
|
-
export declare function hasVisibleContent(node: Node): boolean;
|
|
13
9
|
/**
|
|
14
10
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
15
11
|
*/
|
|
@@ -2,7 +2,7 @@ import type { MarkType, Node, ResolvedPos, Schema, Slice } from '@atlaskit/edito
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
5
|
-
export {
|
|
5
|
+
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount, } from './document';
|
|
6
6
|
export { sanitiseMarksInSelection } from './mark';
|
|
7
7
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
8
8
|
export { setNodeSelection, setGapCursorSelection, setTextSelection, } from './selection';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.8.
|
|
3
|
+
"version": "187.8.10",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
58
|
-
"@atlaskit/editor-common": "^74.
|
|
58
|
+
"@atlaskit/editor-common": "^74.31.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
package/report.api.md
CHANGED
|
@@ -1156,9 +1156,6 @@ type getPosHandler = boolean | getPosHandlerNode;
|
|
|
1156
1156
|
// @public (undocumented)
|
|
1157
1157
|
type getPosHandlerNode = () => number | undefined;
|
|
1158
1158
|
|
|
1159
|
-
// @public
|
|
1160
|
-
export function hasVisibleContent(node: Node_2): boolean;
|
|
1161
|
-
|
|
1162
1159
|
// @public
|
|
1163
1160
|
export const historyPluginKey: PluginKey<HistoryPluginState>;
|
|
1164
1161
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -1055,9 +1055,6 @@ type getPosHandler = boolean | getPosHandlerNode;
|
|
|
1055
1055
|
// @public (undocumented)
|
|
1056
1056
|
type getPosHandlerNode = () => number | undefined;
|
|
1057
1057
|
|
|
1058
|
-
// @public
|
|
1059
|
-
export function hasVisibleContent(node: Node_2): boolean;
|
|
1060
|
-
|
|
1061
1058
|
// @public
|
|
1062
1059
|
export const historyPluginKey: PluginKey<HistoryPluginState>;
|
|
1063
1060
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.moveTargetIntoList = void 0;
|
|
7
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
8
|
-
var moveTargetIntoList = function moveTargetIntoList(_ref) {
|
|
9
|
-
var _$target$nodeAfter;
|
|
10
|
-
var insertPosition = _ref.insertPosition,
|
|
11
|
-
$target = _ref.$target;
|
|
12
|
-
// take the text content of the paragraph and insert after the paragraph up until before the the cut
|
|
13
|
-
var from = insertPosition;
|
|
14
|
-
var to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
|
|
15
|
-
var gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
|
|
16
|
-
var gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
|
|
17
|
-
|
|
18
|
-
if (gapTo - gapFrom === 0) {
|
|
19
|
-
return new _transform.ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
|
|
20
|
-
}
|
|
21
|
-
var step = new _transform.ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
22
|
-
return step;
|
|
23
|
-
};
|
|
24
|
-
exports.moveTargetIntoList = moveTargetIntoList;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.autoJoinTr = autoJoinTr;
|
|
7
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
8
|
-
/**
|
|
9
|
-
* Checks whether two adjacent nodes can be joined. If so, the document
|
|
10
|
-
* will be updated to join those nodes. If not, the original transaction
|
|
11
|
-
* remains untouched.
|
|
12
|
-
*
|
|
13
|
-
* Nodes are considered joinable if the `isJoinable` predicate returns true or,
|
|
14
|
-
* if an array of strings was passed, if their node type name is in that array.
|
|
15
|
-
*
|
|
16
|
-
* Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
|
|
17
|
-
*/
|
|
18
|
-
function autoJoinTr(tr, isJoinable) {
|
|
19
|
-
if (Array.isArray(isJoinable)) {
|
|
20
|
-
var types = isJoinable;
|
|
21
|
-
isJoinable = function isJoinable(node) {
|
|
22
|
-
return types.indexOf(node.type.name) > -1;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
var ranges = [];
|
|
26
|
-
for (var i = 0; i < tr.mapping.maps.length; i++) {
|
|
27
|
-
var map = tr.mapping.maps[i];
|
|
28
|
-
for (var j = 0; j < ranges.length; j++) {
|
|
29
|
-
ranges[j] = map.map(ranges[j]);
|
|
30
|
-
}
|
|
31
|
-
map.forEach(function (_s, _e, from, to) {
|
|
32
|
-
return ranges.push(from, to);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Figure out which joinable points exist inside those ranges,
|
|
37
|
-
// by checking all node boundaries in their parent nodes.
|
|
38
|
-
var joinable = [];
|
|
39
|
-
for (var _i = 0; _i < ranges.length; _i += 2) {
|
|
40
|
-
var from = ranges[_i];
|
|
41
|
-
var to = ranges[_i + 1];
|
|
42
|
-
var $from = tr.doc.resolve(from);
|
|
43
|
-
var depth = $from.sharedDepth(to);
|
|
44
|
-
var parent = $from.node(depth);
|
|
45
|
-
for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
|
|
46
|
-
var _after = parent.maybeChild(index);
|
|
47
|
-
if (!_after) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
if (index && joinable.indexOf(pos) === -1) {
|
|
51
|
-
var _before = parent.child(index - 1);
|
|
52
|
-
if (_before.type === _after.type && isJoinable(_before, _after)) {
|
|
53
|
-
joinable.push(pos);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
pos += _after.nodeSize;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Join the joinable points
|
|
60
|
-
joinable.sort(function (a, b) {
|
|
61
|
-
return a - b;
|
|
62
|
-
});
|
|
63
|
-
for (var _i2 = joinable.length - 1; _i2 >= 0; _i2--) {
|
|
64
|
-
if ((0, _transform.canJoin)(tr.doc, joinable[_i2])) {
|
|
65
|
-
tr.join(joinable[_i2]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
export const moveTargetIntoList = ({
|
|
3
|
-
insertPosition,
|
|
4
|
-
$target
|
|
5
|
-
}) => {
|
|
6
|
-
var _$target$nodeAfter;
|
|
7
|
-
// take the text content of the paragraph and insert after the paragraph up until before the the cut
|
|
8
|
-
const from = insertPosition;
|
|
9
|
-
const to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
|
|
10
|
-
const gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
|
|
11
|
-
const gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
|
|
12
|
-
|
|
13
|
-
if (gapTo - gapFrom === 0) {
|
|
14
|
-
return new ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
|
|
15
|
-
}
|
|
16
|
-
const step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
17
|
-
return step;
|
|
18
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { canJoin } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether two adjacent nodes can be joined. If so, the document
|
|
5
|
-
* will be updated to join those nodes. If not, the original transaction
|
|
6
|
-
* remains untouched.
|
|
7
|
-
*
|
|
8
|
-
* Nodes are considered joinable if the `isJoinable` predicate returns true or,
|
|
9
|
-
* if an array of strings was passed, if their node type name is in that array.
|
|
10
|
-
*
|
|
11
|
-
* Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
|
|
12
|
-
*/
|
|
13
|
-
export function autoJoinTr(tr, isJoinable) {
|
|
14
|
-
if (Array.isArray(isJoinable)) {
|
|
15
|
-
let types = isJoinable;
|
|
16
|
-
isJoinable = node => types.indexOf(node.type.name) > -1;
|
|
17
|
-
}
|
|
18
|
-
const ranges = [];
|
|
19
|
-
for (let i = 0; i < tr.mapping.maps.length; i++) {
|
|
20
|
-
const map = tr.mapping.maps[i];
|
|
21
|
-
for (let j = 0; j < ranges.length; j++) {
|
|
22
|
-
ranges[j] = map.map(ranges[j]);
|
|
23
|
-
}
|
|
24
|
-
map.forEach((_s, _e, from, to) => ranges.push(from, to));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Figure out which joinable points exist inside those ranges,
|
|
28
|
-
// by checking all node boundaries in their parent nodes.
|
|
29
|
-
const joinable = [];
|
|
30
|
-
for (let i = 0; i < ranges.length; i += 2) {
|
|
31
|
-
const from = ranges[i];
|
|
32
|
-
const to = ranges[i + 1];
|
|
33
|
-
const $from = tr.doc.resolve(from);
|
|
34
|
-
const depth = $from.sharedDepth(to);
|
|
35
|
-
const parent = $from.node(depth);
|
|
36
|
-
for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
|
|
37
|
-
const after = parent.maybeChild(index);
|
|
38
|
-
if (!after) {
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
if (index && joinable.indexOf(pos) === -1) {
|
|
42
|
-
const before = parent.child(index - 1);
|
|
43
|
-
if (before.type === after.type && isJoinable(before, after)) {
|
|
44
|
-
joinable.push(pos);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
pos += after.nodeSize;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Join the joinable points
|
|
51
|
-
joinable.sort((a, b) => a - b);
|
|
52
|
-
for (let i = joinable.length - 1; i >= 0; i--) {
|
|
53
|
-
if (canJoin(tr.doc, joinable[i])) {
|
|
54
|
-
tr.join(joinable[i]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
export var moveTargetIntoList = function moveTargetIntoList(_ref) {
|
|
3
|
-
var _$target$nodeAfter;
|
|
4
|
-
var insertPosition = _ref.insertPosition,
|
|
5
|
-
$target = _ref.$target;
|
|
6
|
-
// take the text content of the paragraph and insert after the paragraph up until before the the cut
|
|
7
|
-
var from = insertPosition;
|
|
8
|
-
var to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
|
|
9
|
-
var gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
|
|
10
|
-
var gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
|
|
11
|
-
|
|
12
|
-
if (gapTo - gapFrom === 0) {
|
|
13
|
-
return new ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
|
|
14
|
-
}
|
|
15
|
-
var step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
16
|
-
return step;
|
|
17
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { canJoin } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether two adjacent nodes can be joined. If so, the document
|
|
5
|
-
* will be updated to join those nodes. If not, the original transaction
|
|
6
|
-
* remains untouched.
|
|
7
|
-
*
|
|
8
|
-
* Nodes are considered joinable if the `isJoinable` predicate returns true or,
|
|
9
|
-
* if an array of strings was passed, if their node type name is in that array.
|
|
10
|
-
*
|
|
11
|
-
* Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
|
|
12
|
-
*/
|
|
13
|
-
export function autoJoinTr(tr, isJoinable) {
|
|
14
|
-
if (Array.isArray(isJoinable)) {
|
|
15
|
-
var types = isJoinable;
|
|
16
|
-
isJoinable = function isJoinable(node) {
|
|
17
|
-
return types.indexOf(node.type.name) > -1;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
var ranges = [];
|
|
21
|
-
for (var i = 0; i < tr.mapping.maps.length; i++) {
|
|
22
|
-
var map = tr.mapping.maps[i];
|
|
23
|
-
for (var j = 0; j < ranges.length; j++) {
|
|
24
|
-
ranges[j] = map.map(ranges[j]);
|
|
25
|
-
}
|
|
26
|
-
map.forEach(function (_s, _e, from, to) {
|
|
27
|
-
return ranges.push(from, to);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Figure out which joinable points exist inside those ranges,
|
|
32
|
-
// by checking all node boundaries in their parent nodes.
|
|
33
|
-
var joinable = [];
|
|
34
|
-
for (var _i = 0; _i < ranges.length; _i += 2) {
|
|
35
|
-
var from = ranges[_i];
|
|
36
|
-
var to = ranges[_i + 1];
|
|
37
|
-
var $from = tr.doc.resolve(from);
|
|
38
|
-
var depth = $from.sharedDepth(to);
|
|
39
|
-
var parent = $from.node(depth);
|
|
40
|
-
for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
|
|
41
|
-
var _after = parent.maybeChild(index);
|
|
42
|
-
if (!_after) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
if (index && joinable.indexOf(pos) === -1) {
|
|
46
|
-
var _before = parent.child(index - 1);
|
|
47
|
-
if (_before.type === _after.type && isJoinable(_before, _after)) {
|
|
48
|
-
joinable.push(pos);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
pos += _after.nodeSize;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Join the joinable points
|
|
55
|
-
joinable.sort(function (a, b) {
|
|
56
|
-
return a - b;
|
|
57
|
-
});
|
|
58
|
-
for (var _i2 = joinable.length - 1; _i2 >= 0; _i2--) {
|
|
59
|
-
if (canJoin(tr.doc, joinable[_i2])) {
|
|
60
|
-
tr.join(joinable[_i2]);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
type Params = {
|
|
4
|
-
insertPosition: number;
|
|
5
|
-
$target: ResolvedPos;
|
|
6
|
-
};
|
|
7
|
-
export declare const moveTargetIntoList: ({ insertPosition, $target, }: Params) => Step;
|
|
8
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether two adjacent nodes can be joined. If so, the document
|
|
5
|
-
* will be updated to join those nodes. If not, the original transaction
|
|
6
|
-
* remains untouched.
|
|
7
|
-
*
|
|
8
|
-
* Nodes are considered joinable if the `isJoinable` predicate returns true or,
|
|
9
|
-
* if an array of strings was passed, if their node type name is in that array.
|
|
10
|
-
*
|
|
11
|
-
* Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
|
|
12
|
-
*/
|
|
13
|
-
export declare function autoJoinTr(tr: Transaction, isJoinable: ((before: Node, after: Node) => boolean) | string[]): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
type Params = {
|
|
4
|
-
insertPosition: number;
|
|
5
|
-
$target: ResolvedPos;
|
|
6
|
-
};
|
|
7
|
-
export declare const moveTargetIntoList: ({ insertPosition, $target, }: Params) => Step;
|
|
8
|
-
export {};
|