@atlaskit/editor-core 187.8.7 → 187.8.11

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +0 -6
  3. package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  4. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
  5. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
  6. package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
  7. package/dist/cjs/plugins/list/actions/conversions.js +5 -5
  8. package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
  9. package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
  10. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
  11. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
  12. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
  13. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
  14. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
  15. package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
  16. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
  17. package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
  18. package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
  19. package/dist/cjs/plugins/list/commands/index.js +8 -10
  20. package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
  21. package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
  22. package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
  23. package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
  24. package/dist/cjs/plugins/list/utils/analytics.js +1 -35
  25. package/dist/cjs/plugins/list/utils/indentation.js +2 -20
  26. package/dist/cjs/plugins/list/utils/node.js +2 -106
  27. package/dist/cjs/plugins/list/utils/selection.js +3 -54
  28. package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
  29. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
  30. package/dist/cjs/plugins/text-formatting/index.js +23 -21
  31. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  32. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
  33. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  34. package/dist/cjs/utils/commands.js +3 -109
  35. package/dist/cjs/utils/document.js +1 -26
  36. package/dist/cjs/utils/index.js +0 -6
  37. package/dist/cjs/version-wrapper.js +1 -1
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/index.js +1 -1
  40. package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  41. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
  42. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  43. package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
  44. package/dist/es2019/plugins/list/actions/conversions.js +2 -2
  45. package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
  46. package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
  47. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  48. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  49. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  50. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  51. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  52. package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
  53. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
  54. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
  55. package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
  56. package/dist/es2019/plugins/list/commands/index.js +4 -5
  57. package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
  58. package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
  59. package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
  60. package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
  61. package/dist/es2019/plugins/list/utils/analytics.js +0 -36
  62. package/dist/es2019/plugins/list/utils/indentation.js +0 -18
  63. package/dist/es2019/plugins/list/utils/node.js +3 -89
  64. package/dist/es2019/plugins/list/utils/selection.js +1 -52
  65. package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
  66. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  67. package/dist/es2019/plugins/text-formatting/index.js +15 -10
  68. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
  69. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
  70. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  71. package/dist/es2019/utils/commands.js +2 -102
  72. package/dist/es2019/utils/document.js +1 -26
  73. package/dist/es2019/utils/index.js +1 -1
  74. package/dist/es2019/version-wrapper.js +1 -1
  75. package/dist/es2019/version.json +1 -1
  76. package/dist/esm/index.js +1 -1
  77. package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  78. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
  79. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  80. package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
  81. package/dist/esm/plugins/list/actions/conversions.js +2 -2
  82. package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
  83. package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
  84. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  85. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  86. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  87. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  88. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  89. package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
  90. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
  91. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
  92. package/dist/esm/plugins/list/commands/indent-list.js +3 -4
  93. package/dist/esm/plugins/list/commands/index.js +4 -5
  94. package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
  95. package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
  96. package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
  97. package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
  98. package/dist/esm/plugins/list/utils/analytics.js +0 -32
  99. package/dist/esm/plugins/list/utils/indentation.js +0 -17
  100. package/dist/esm/plugins/list/utils/node.js +3 -81
  101. package/dist/esm/plugins/list/utils/selection.js +3 -51
  102. package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
  103. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  104. package/dist/esm/plugins/text-formatting/index.js +23 -21
  105. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  106. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
  107. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  108. package/dist/esm/utils/commands.js +2 -100
  109. package/dist/esm/utils/document.js +1 -26
  110. package/dist/esm/utils/index.js +1 -1
  111. package/dist/esm/version-wrapper.js +1 -1
  112. package/dist/esm/version.json +1 -1
  113. package/dist/types/index.d.ts +1 -1
  114. package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  115. package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
  116. package/dist/types/plugins/list/commands/index.d.ts +2 -1
  117. package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  118. package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
  119. package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
  120. package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
  121. package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
  122. package/dist/types/plugins/list/utils/node.d.ts +2 -17
  123. package/dist/types/plugins/list/utils/selection.d.ts +1 -12
  124. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  125. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  126. package/dist/types/utils/commands.d.ts +3 -32
  127. package/dist/types/utils/document.d.ts +0 -4
  128. package/dist/types/utils/index.d.ts +1 -1
  129. package/dist/types-ts4.5/index.d.ts +1 -1
  130. package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  131. package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
  132. package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
  133. package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  134. package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
  135. package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
  136. package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
  137. package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
  138. package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
  139. package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
  140. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  141. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  142. package/dist/types-ts4.5/utils/commands.d.ts +3 -38
  143. package/dist/types-ts4.5/utils/document.d.ts +0 -4
  144. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  145. package/package.json +2 -2
  146. package/report.api.md +0 -3
  147. package/tmp/api-report-tmp.d.ts +0 -3
  148. package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
  149. package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
  150. package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
  151. package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
  152. package/dist/esm/plugins/list/utils/replace-content.js +0 -17
  153. package/dist/esm/utils/prosemirror/autojoin.js +0 -63
  154. package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
  155. package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
  156. package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
  157. package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
@@ -1,17 +1,2 @@
1
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
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,5 +1,6 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
4
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
5
  declare enum ValidAutoformatChars {
5
6
  STRONG = "__",
@@ -19,5 +20,5 @@ export declare const italicRegex1: ReverseRegexExp;
19
20
  export declare const italicRegex2: ReverseRegexExp;
20
21
  export declare const strikeRegex: ReverseRegexExp;
21
22
  export declare const codeRegex: ReverseRegexExp;
22
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
23
+ export declare function inputRulePlugin(schema: Schema, _featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
23
24
  export default inputRulePlugin;
@@ -1,3 +1,3 @@
1
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
- declare const _default: (featureFlags: FeatureFlags) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ declare const _default: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/safe-plugin").SafePlugin<any>;
3
3
  export default _default;
@@ -1,9 +1,7 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { ResolvedPos, Node as PMNode, Fragment } from '@atlaskit/editor-prosemirror/model';
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 { hasVisibleContent, isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount, } from './document';
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.7",
3
+ "version": "187.8.11",
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.30.0",
58
+ "@atlaskit/editor-common": "^74.32.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
 
@@ -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 {};
@@ -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;