@atlaskit/editor-core 187.28.5 → 187.29.0

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 (220) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/index.js +0 -7
  3. package/dist/cjs/labs/next/presets/universal.js +2 -1
  4. package/dist/cjs/plugins/analytics/index.js +0 -6
  5. package/dist/cjs/plugins/analytics/types/index.js +0 -6
  6. package/dist/cjs/plugins/index.js +0 -7
  7. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/commands.js +1 -1
  8. package/dist/cjs/utils/commands.js +1 -33
  9. package/dist/cjs/utils/index.js +0 -13
  10. package/dist/cjs/utils/mark.js +2 -46
  11. package/dist/cjs/utils/selection.js +0 -5
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/es2019/index.js +0 -1
  14. package/dist/es2019/labs/next/presets/universal.js +2 -1
  15. package/dist/es2019/plugins/analytics/index.js +1 -1
  16. package/dist/es2019/plugins/analytics/types/index.js +1 -1
  17. package/dist/es2019/plugins/index.js +0 -1
  18. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/commands.js +1 -1
  19. package/dist/es2019/utils/commands.js +1 -33
  20. package/dist/es2019/utils/index.js +1 -2
  21. package/dist/es2019/utils/mark.js +0 -41
  22. package/dist/es2019/utils/selection.js +0 -6
  23. package/dist/es2019/version-wrapper.js +1 -1
  24. package/dist/esm/index.js +0 -1
  25. package/dist/esm/labs/next/presets/universal.js +2 -1
  26. package/dist/esm/plugins/analytics/index.js +1 -1
  27. package/dist/esm/plugins/analytics/types/index.js +1 -1
  28. package/dist/esm/plugins/index.js +0 -1
  29. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/commands.js +1 -1
  30. package/dist/esm/utils/commands.js +1 -31
  31. package/dist/esm/utils/index.js +1 -2
  32. package/dist/esm/utils/mark.js +0 -42
  33. package/dist/esm/utils/selection.js +0 -4
  34. package/dist/esm/version-wrapper.js +1 -1
  35. package/dist/types/index.d.ts +0 -3
  36. package/dist/types/plugins/analytics/index.d.ts +1 -1
  37. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  38. package/dist/types/plugins/index.d.ts +0 -1
  39. package/dist/types/plugins/paste/index.d.ts +1 -1
  40. package/dist/types/utils/commands.d.ts +1 -4
  41. package/dist/types/utils/index.d.ts +1 -2
  42. package/dist/types/utils/mark.d.ts +2 -12
  43. package/dist/types/utils/selection.d.ts +0 -2
  44. package/dist/types-ts4.5/index.d.ts +0 -3
  45. package/dist/types-ts4.5/plugins/analytics/index.d.ts +1 -1
  46. package/dist/types-ts4.5/plugins/analytics/types/index.d.ts +1 -1
  47. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  48. package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
  49. package/dist/types-ts4.5/utils/commands.d.ts +1 -4
  50. package/dist/types-ts4.5/utils/index.d.ts +1 -2
  51. package/dist/types-ts4.5/utils/mark.d.ts +2 -12
  52. package/dist/types-ts4.5/utils/selection.d.ts +0 -2
  53. package/package.json +3 -3
  54. package/report.api.md +0 -9
  55. package/tmp/api-report-tmp.d.ts +0 -9
  56. package/dist/cjs/plugins/list/actions/conversions.js +0 -153
  57. package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +0 -125
  58. package/dist/cjs/plugins/list/actions/indent-list.js +0 -49
  59. package/dist/cjs/plugins/list/actions/join-list-items-forward.js +0 -59
  60. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/index.js +0 -40
  61. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -88
  62. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -85
  63. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -79
  64. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -45
  65. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -56
  66. package/dist/cjs/plugins/list/actions/merge-lists.js +0 -27
  67. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +0 -291
  68. package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +0 -98
  69. package/dist/cjs/plugins/list/commands/indent-list.js +0 -71
  70. package/dist/cjs/plugins/list/commands/index.js +0 -348
  71. package/dist/cjs/plugins/list/commands/join-list-item-forward.js +0 -61
  72. package/dist/cjs/plugins/list/commands/listBackspace.js +0 -284
  73. package/dist/cjs/plugins/list/commands/outdent-list.js +0 -70
  74. package/dist/cjs/plugins/list/index.js +0 -133
  75. package/dist/cjs/plugins/list/messages.js +0 -37
  76. package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +0 -61
  77. package/dist/cjs/plugins/list/pm-plugins/input-rules/index.js +0 -36
  78. package/dist/cjs/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +0 -58
  79. package/dist/cjs/plugins/list/pm-plugins/keymap.js +0 -27
  80. package/dist/cjs/plugins/list/pm-plugins/main.js +0 -168
  81. package/dist/cjs/plugins/list/transforms.js +0 -100
  82. package/dist/cjs/plugins/list/types.js +0 -8
  83. package/dist/cjs/plugins/list/utils/analytics.js +0 -22
  84. package/dist/cjs/plugins/list/utils/find.js +0 -68
  85. package/dist/cjs/plugins/list/utils/indentation.js +0 -22
  86. package/dist/cjs/plugins/list/utils/node.js +0 -16
  87. package/dist/cjs/plugins/list/utils/selection.js +0 -95
  88. package/dist/cjs/utils/input-rules.js +0 -30
  89. package/dist/es2019/plugins/list/actions/conversions.js +0 -160
  90. package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +0 -124
  91. package/dist/es2019/plugins/list/actions/indent-list.js +0 -44
  92. package/dist/es2019/plugins/list/actions/join-list-items-forward.js +0 -54
  93. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/index.js +0 -5
  94. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -74
  95. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -78
  96. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -72
  97. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -37
  98. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -48
  99. package/dist/es2019/plugins/list/actions/merge-lists.js +0 -24
  100. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +0 -295
  101. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +0 -91
  102. package/dist/es2019/plugins/list/commands/indent-list.js +0 -62
  103. package/dist/es2019/plugins/list/commands/index.js +0 -322
  104. package/dist/es2019/plugins/list/commands/join-list-item-forward.js +0 -53
  105. package/dist/es2019/plugins/list/commands/listBackspace.js +0 -276
  106. package/dist/es2019/plugins/list/commands/outdent-list.js +0 -60
  107. package/dist/es2019/plugins/list/index.js +0 -120
  108. package/dist/es2019/plugins/list/messages.js +0 -29
  109. package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +0 -55
  110. package/dist/es2019/plugins/list/pm-plugins/input-rules/index.js +0 -33
  111. package/dist/es2019/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +0 -52
  112. package/dist/es2019/plugins/list/pm-plugins/keymap.js +0 -19
  113. package/dist/es2019/plugins/list/pm-plugins/main.js +0 -159
  114. package/dist/es2019/plugins/list/transforms.js +0 -102
  115. package/dist/es2019/plugins/list/types.js +0 -1
  116. package/dist/es2019/plugins/list/utils/analytics.js +0 -12
  117. package/dist/es2019/plugins/list/utils/find.js +0 -61
  118. package/dist/es2019/plugins/list/utils/indentation.js +0 -16
  119. package/dist/es2019/plugins/list/utils/node.js +0 -12
  120. package/dist/es2019/plugins/list/utils/selection.js +0 -96
  121. package/dist/es2019/utils/input-rules.js +0 -20
  122. package/dist/esm/plugins/list/actions/conversions.js +0 -147
  123. package/dist/esm/plugins/list/actions/indent-list-items-selected.js +0 -117
  124. package/dist/esm/plugins/list/actions/indent-list.js +0 -43
  125. package/dist/esm/plugins/list/actions/join-list-items-forward.js +0 -52
  126. package/dist/esm/plugins/list/actions/join-list-items-scenarios/index.js +0 -5
  127. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -81
  128. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -79
  129. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -73
  130. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -38
  131. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -49
  132. package/dist/esm/plugins/list/actions/merge-lists.js +0 -21
  133. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +0 -283
  134. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +0 -92
  135. package/dist/esm/plugins/list/commands/indent-list.js +0 -63
  136. package/dist/esm/plugins/list/commands/index.js +0 -320
  137. package/dist/esm/plugins/list/commands/join-list-item-forward.js +0 -53
  138. package/dist/esm/plugins/list/commands/listBackspace.js +0 -275
  139. package/dist/esm/plugins/list/commands/outdent-list.js +0 -62
  140. package/dist/esm/plugins/list/index.js +0 -127
  141. package/dist/esm/plugins/list/messages.js +0 -29
  142. package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +0 -56
  143. package/dist/esm/plugins/list/pm-plugins/input-rules/index.js +0 -30
  144. package/dist/esm/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +0 -51
  145. package/dist/esm/plugins/list/pm-plugins/keymap.js +0 -19
  146. package/dist/esm/plugins/list/pm-plugins/main.js +0 -159
  147. package/dist/esm/plugins/list/transforms.js +0 -92
  148. package/dist/esm/plugins/list/types.js +0 -1
  149. package/dist/esm/plugins/list/utils/analytics.js +0 -12
  150. package/dist/esm/plugins/list/utils/find.js +0 -59
  151. package/dist/esm/plugins/list/utils/indentation.js +0 -16
  152. package/dist/esm/plugins/list/utils/node.js +0 -10
  153. package/dist/esm/plugins/list/utils/selection.js +0 -81
  154. package/dist/esm/utils/input-rules.js +0 -22
  155. package/dist/types/plugins/list/actions/conversions.d.ts +0 -6
  156. package/dist/types/plugins/list/actions/indent-list-items-selected.d.ts +0 -2
  157. package/dist/types/plugins/list/actions/indent-list.d.ts +0 -2
  158. package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +0 -13
  159. package/dist/types/plugins/list/actions/join-list-items-scenarios/index.d.ts +0 -5
  160. package/dist/types/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +0 -9
  161. package/dist/types/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +0 -9
  162. package/dist/types/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +0 -9
  163. package/dist/types/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +0 -9
  164. package/dist/types/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +0 -9
  165. package/dist/types/plugins/list/actions/merge-lists.d.ts +0 -7
  166. package/dist/types/plugins/list/actions/outdent-list-items-selected.d.ts +0 -3
  167. package/dist/types/plugins/list/actions/wrap-and-join-lists.d.ts +0 -15
  168. package/dist/types/plugins/list/commands/indent-list.d.ts +0 -6
  169. package/dist/types/plugins/list/commands/index.d.ts +0 -17
  170. package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +0 -3
  171. package/dist/types/plugins/list/commands/listBackspace.d.ts +0 -10
  172. package/dist/types/plugins/list/commands/outdent-list.d.ts +0 -7
  173. package/dist/types/plugins/list/index.d.ts +0 -3
  174. package/dist/types/plugins/list/messages.d.ts +0 -27
  175. package/dist/types/plugins/list/pm-plugins/input-rules/create-list-input-rule.d.ts +0 -9
  176. package/dist/types/plugins/list/pm-plugins/input-rules/index.d.ts +0 -4
  177. package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +0 -12
  178. package/dist/types/plugins/list/pm-plugins/keymap.d.ts +0 -5
  179. package/dist/types/plugins/list/pm-plugins/main.d.ts +0 -11
  180. package/dist/types/plugins/list/transforms.d.ts +0 -4
  181. package/dist/types/plugins/list/types.d.ts +0 -4
  182. package/dist/types/plugins/list/utils/analytics.d.ts +0 -5
  183. package/dist/types/plugins/list/utils/find.d.ts +0 -10
  184. package/dist/types/plugins/list/utils/indentation.d.ts +0 -2
  185. package/dist/types/plugins/list/utils/node.d.ts +0 -2
  186. package/dist/types/plugins/list/utils/selection.d.ts +0 -14
  187. package/dist/types/utils/input-rules.d.ts +0 -10
  188. package/dist/types-ts4.5/plugins/list/actions/conversions.d.ts +0 -6
  189. package/dist/types-ts4.5/plugins/list/actions/indent-list-items-selected.d.ts +0 -2
  190. package/dist/types-ts4.5/plugins/list/actions/indent-list.d.ts +0 -2
  191. package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +0 -16
  192. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/index.d.ts +0 -5
  193. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +0 -9
  194. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +0 -9
  195. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +0 -9
  196. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +0 -9
  197. package/dist/types-ts4.5/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +0 -9
  198. package/dist/types-ts4.5/plugins/list/actions/merge-lists.d.ts +0 -7
  199. package/dist/types-ts4.5/plugins/list/actions/outdent-list-items-selected.d.ts +0 -3
  200. package/dist/types-ts4.5/plugins/list/actions/wrap-and-join-lists.d.ts +0 -15
  201. package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +0 -6
  202. package/dist/types-ts4.5/plugins/list/commands/index.d.ts +0 -17
  203. package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +0 -3
  204. package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +0 -13
  205. package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +0 -7
  206. package/dist/types-ts4.5/plugins/list/index.d.ts +0 -3
  207. package/dist/types-ts4.5/plugins/list/messages.d.ts +0 -27
  208. package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/create-list-input-rule.d.ts +0 -9
  209. package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/index.d.ts +0 -4
  210. package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +0 -12
  211. package/dist/types-ts4.5/plugins/list/pm-plugins/keymap.d.ts +0 -5
  212. package/dist/types-ts4.5/plugins/list/pm-plugins/main.d.ts +0 -11
  213. package/dist/types-ts4.5/plugins/list/transforms.d.ts +0 -4
  214. package/dist/types-ts4.5/plugins/list/types.d.ts +0 -4
  215. package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +0 -5
  216. package/dist/types-ts4.5/plugins/list/utils/find.d.ts +0 -10
  217. package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -2
  218. package/dist/types-ts4.5/plugins/list/utils/node.d.ts +0 -2
  219. package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +0 -14
  220. package/dist/types-ts4.5/utils/input-rules.d.ts +0 -10
@@ -8,10 +8,6 @@ export function setAllSelection(view) {
8
8
  var tr = state.tr.setSelection(new AllSelection(view.state.doc));
9
9
  dispatch(tr);
10
10
  }
11
- export function setGapCursorSelection(view, pos, side) {
12
- var state = view.state;
13
- view.dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(pos), side)));
14
- }
15
11
  export function setCellSelection(view, anchor, head) {
16
12
  var state = view.state,
17
13
  dispatch = view.dispatch;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.28.5";
2
+ export var version = "187.29.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -26,9 +26,6 @@ export { changeColor } from './plugins/text-color/commands/change-color';
26
26
  export { insertHorizontalRule } from './plugins/rule/commands';
27
27
  export { blockPluginStateKey } from './plugins';
28
28
  export type { BlockTypeState } from './plugins';
29
- export { pluginKey as listStateKey } from './plugins/list/pm-plugins/main';
30
- export type { ListState } from './plugins/list/types';
31
- export type { InputMethod as ListInputMethod } from './plugins/list/commands';
32
29
  export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates';
33
30
  export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
34
31
  export type { InputMethodToolbar as TextFormattingInputMethodToolbar, InputMethodBasic as TextFormattingInputMethodBasic, } from '@atlaskit/editor-common/types';
@@ -1,5 +1,5 @@
1
1
  import analyticsPlugin from './plugin';
2
- export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, LIST_TEXT_SCENARIOS, fireAnalyticsEvent, getAnalyticsEventsFromTransaction, } from '@atlaskit/editor-common/analytics';
2
+ export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, fireAnalyticsEvent, getAnalyticsEventsFromTransaction, } from '@atlaskit/editor-common/analytics';
3
3
  export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadWithChannel, CommonListAnalyticsAttributes, CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, ErrorEventPayload, ErrorEventAttributes, FormatEventPayload, GeneralEventPayload, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, SubstituteEventPayload, TableEventPayload, FireAnalyticsCallback, FireAnalyticsEvent, } from '@atlaskit/editor-common/analytics';
4
4
  export { withAnalytics, addAnalytics } from './utils';
5
5
  export declare const analyticsPluginKey: import("prosemirror-state").PluginKey<any>;
@@ -6,4 +6,4 @@ export type { MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, } from '.
6
6
  export type { DispatchAnalyticsEvent } from './dispatch-analytics-event';
7
7
  export type { CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, } from './link-tool-bar-events';
8
8
  export type { FormatEventPayload, CommonListAnalyticsAttributes, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, ListEventPayload, PasteContent, PasteEventPayload, PasteSource, PasteType, PasteContents, SubstituteEventPayload, TableEventPayload, PasteSources, PasteTypes, PASTE_ACTION_SUBJECT_ID, } from '@atlaskit/editor-common/analytics';
9
- export { USER_CONTEXT, DELETE_DIRECTION, INDENT_DIRECTION, PUNC, TABLE_ACTION, INDENT_TYPE, LIST_TEXT_SCENARIOS, SYMBOL, TABLE_BREAKOUT, } from '@atlaskit/editor-common/analytics';
9
+ export { USER_CONTEXT, DELETE_DIRECTION, INDENT_DIRECTION, PUNC, TABLE_ACTION, INDENT_TYPE, SYMBOL, TABLE_BREAKOUT, } from '@atlaskit/editor-common/analytics';
@@ -14,7 +14,6 @@ export { default as helpDialogPlugin } from './help-dialog';
14
14
  export { default as insertBlockPlugin } from './insert-block';
15
15
  export { default as jiraIssuePlugin } from './jira-issue';
16
16
  export { default as layoutPlugin } from './layout';
17
- export { default as listPlugin } from './list';
18
17
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
19
18
  export { default as macroPlugin } from './macro';
20
19
  export { default as maxContentSizePlugin } from './max-content-size';
@@ -3,7 +3,7 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
3
3
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
4
4
  import type { cardPlugin } from '@atlaskit/editor-plugin-card';
5
5
  import type betterTypeHistoryPlugin from '../better-type-history';
6
- import type listPlugin from '../list';
6
+ import type { listPlugin } from '@atlaskit/editor-plugin-list';
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  export type PastePluginOptions = {
9
9
  cardOptions?: CardOptions;
@@ -1,8 +1,6 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
5
- declare const isFirstChildOfParent: (state: EditorState) => boolean;
6
4
  /**
7
5
  * Creates a filter that checks if the node at a given number of parents above the current
8
6
  * selection is of the correct node type.
@@ -12,7 +10,6 @@ declare const isFirstChildOfParent: (state: EditorState) => boolean;
12
10
  * is usually inside the text content.
13
11
  */
14
12
  declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
15
- declare function findCutBefore($pos: ResolvedPos): ResolvedPos | null;
16
13
  declare const withScrollIntoView: HigherOrderCommand;
17
14
  /**
18
15
  * Insert content, delete a range and create a new selection
@@ -24,4 +21,4 @@ declare const withScrollIntoView: HigherOrderCommand;
24
21
  * @param deletions the ranges to delete
25
22
  */
26
23
  declare const selectNode: (pos: number) => Command;
27
- export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode, };
24
+ export { isNthParentOfType, withScrollIntoView, selectNode };
@@ -4,9 +4,8 @@ import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
4
4
  export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
5
5
  export { insideTable } from '@atlaskit/editor-common/core-utils';
6
6
  export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount, } from './document';
7
- export { sanitiseMarksInSelection } from './mark';
8
7
  export { isParagraph, isText, isLinkMark } from './nodes';
9
- export { setNodeSelection, setGapCursorSelection, setTextSelection, } from './selection';
8
+ export { setNodeSelection, setTextSelection } from './selection';
10
9
  export type { JSONDocNode };
11
10
  export { default as measurements } from './performance/measure-enum';
12
11
  export declare function getCursor(selection: Selection): ResolvedPos | undefined;
@@ -1,14 +1,4 @@
1
- import type { Node, Mark, MarkType, NodeType } from '@atlaskit/editor-prosemirror/model';
2
- import type { SelectionRange, EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { Node, Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { SelectionRange } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const isMarkAllowedInRange: (doc: Node, ranges: readonly SelectionRange[], type: MarkType) => boolean;
4
4
  export declare const isMarkExcluded: (type: MarkType, marks?: readonly Mark[] | null) => boolean;
5
- /**
6
- * Removes marks from nodes in the current selection that are not supported
7
- */
8
- export declare const sanitiseSelectionMarksForWrapping: (state: EditorState, newParentType?: NodeType) => Transaction | undefined;
9
- type NodesSanitized = Array<{
10
- node: Node;
11
- marksRemoved: Mark[];
12
- }>;
13
- export declare const sanitiseMarksInSelection: (tr: Transaction, newParentType?: NodeType) => NodesSanitized;
14
- export {};
@@ -1,10 +1,8 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
- import type { Side } from '@atlaskit/editor-common/selection';
5
4
  export { setNodeSelection, setTextSelection, } from '@atlaskit/editor-common/utils';
6
5
  export declare function setAllSelection(view: EditorView): void;
7
- export declare function setGapCursorSelection(view: EditorView, pos: number, side: Side): void;
8
6
  export declare function setCellSelection(view: EditorView, anchor: number, head?: number): void;
9
7
  export declare const isValidPosition: (pos: number, state: EditorState) => boolean;
10
8
  export declare const duplicateSelection: (selectionToDuplicate: Selection, doc: Node) => Selection | undefined;
@@ -26,9 +26,6 @@ export { changeColor } from './plugins/text-color/commands/change-color';
26
26
  export { insertHorizontalRule } from './plugins/rule/commands';
27
27
  export { blockPluginStateKey } from './plugins';
28
28
  export type { BlockTypeState } from './plugins';
29
- export { pluginKey as listStateKey } from './plugins/list/pm-plugins/main';
30
- export type { ListState } from './plugins/list/types';
31
- export type { InputMethod as ListInputMethod } from './plugins/list/commands';
32
29
  export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates';
33
30
  export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
34
31
  export type { InputMethodToolbar as TextFormattingInputMethodToolbar, InputMethodBasic as TextFormattingInputMethodBasic, } from '@atlaskit/editor-common/types';
@@ -1,5 +1,5 @@
1
1
  import analyticsPlugin from './plugin';
2
- export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, LIST_TEXT_SCENARIOS, fireAnalyticsEvent, getAnalyticsEventsFromTransaction, } from '@atlaskit/editor-common/analytics';
2
+ export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, fireAnalyticsEvent, getAnalyticsEventsFromTransaction, } from '@atlaskit/editor-common/analytics';
3
3
  export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadWithChannel, CommonListAnalyticsAttributes, CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, ErrorEventPayload, ErrorEventAttributes, FormatEventPayload, GeneralEventPayload, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, SubstituteEventPayload, TableEventPayload, FireAnalyticsCallback, FireAnalyticsEvent, } from '@atlaskit/editor-common/analytics';
4
4
  export { withAnalytics, addAnalytics } from './utils';
5
5
  export declare const analyticsPluginKey: import("prosemirror-state").PluginKey<any>;
@@ -6,4 +6,4 @@ export type { MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, } from '.
6
6
  export type { DispatchAnalyticsEvent } from './dispatch-analytics-event';
7
7
  export type { CreateLinkInlineDialogActionType, CreateLinkInlineDialogEventPayload, } from './link-tool-bar-events';
8
8
  export type { FormatEventPayload, CommonListAnalyticsAttributes, InputMethodInsertLink, InputMethodInsertMedia, InsertEventPayload, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, ListEventPayload, PasteContent, PasteEventPayload, PasteSource, PasteType, PasteContents, SubstituteEventPayload, TableEventPayload, PasteSources, PasteTypes, PASTE_ACTION_SUBJECT_ID, } from '@atlaskit/editor-common/analytics';
9
- export { USER_CONTEXT, DELETE_DIRECTION, INDENT_DIRECTION, PUNC, TABLE_ACTION, INDENT_TYPE, LIST_TEXT_SCENARIOS, SYMBOL, TABLE_BREAKOUT, } from '@atlaskit/editor-common/analytics';
9
+ export { USER_CONTEXT, DELETE_DIRECTION, INDENT_DIRECTION, PUNC, TABLE_ACTION, INDENT_TYPE, SYMBOL, TABLE_BREAKOUT, } from '@atlaskit/editor-common/analytics';
@@ -14,7 +14,6 @@ export { default as helpDialogPlugin } from './help-dialog';
14
14
  export { default as insertBlockPlugin } from './insert-block';
15
15
  export { default as jiraIssuePlugin } from './jira-issue';
16
16
  export { default as layoutPlugin } from './layout';
17
- export { default as listPlugin } from './list';
18
17
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
19
18
  export { default as macroPlugin } from './macro';
20
19
  export { default as maxContentSizePlugin } from './max-content-size';
@@ -3,7 +3,7 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
3
3
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
4
4
  import type { cardPlugin } from '@atlaskit/editor-plugin-card';
5
5
  import type betterTypeHistoryPlugin from '../better-type-history';
6
- import type listPlugin from '../list';
6
+ import type { listPlugin } from '@atlaskit/editor-plugin-list';
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  export type PastePluginOptions = {
9
9
  cardOptions?: CardOptions;
@@ -1,8 +1,6 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
5
- declare const isFirstChildOfParent: (state: EditorState) => boolean;
6
4
  /**
7
5
  * Creates a filter that checks if the node at a given number of parents above the current
8
6
  * selection is of the correct node type.
@@ -12,7 +10,6 @@ declare const isFirstChildOfParent: (state: EditorState) => boolean;
12
10
  * is usually inside the text content.
13
11
  */
14
12
  declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
15
- declare function findCutBefore($pos: ResolvedPos): ResolvedPos | null;
16
13
  declare const withScrollIntoView: HigherOrderCommand;
17
14
  /**
18
15
  * Insert content, delete a range and create a new selection
@@ -24,4 +21,4 @@ declare const withScrollIntoView: HigherOrderCommand;
24
21
  * @param deletions the ranges to delete
25
22
  */
26
23
  declare const selectNode: (pos: number) => Command;
27
- export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode, };
24
+ export { isNthParentOfType, withScrollIntoView, selectNode };
@@ -4,9 +4,8 @@ import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
4
4
  export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
5
5
  export { insideTable } from '@atlaskit/editor-common/core-utils';
6
6
  export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount, } from './document';
7
- export { sanitiseMarksInSelection } from './mark';
8
7
  export { isParagraph, isText, isLinkMark } from './nodes';
9
- export { setNodeSelection, setGapCursorSelection, setTextSelection, } from './selection';
8
+ export { setNodeSelection, setTextSelection } from './selection';
10
9
  export type { JSONDocNode };
11
10
  export { default as measurements } from './performance/measure-enum';
12
11
  export declare function getCursor(selection: Selection): ResolvedPos | undefined;
@@ -1,14 +1,4 @@
1
- import type { Node, Mark, MarkType, NodeType } from '@atlaskit/editor-prosemirror/model';
2
- import type { SelectionRange, EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { Node, Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { SelectionRange } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const isMarkAllowedInRange: (doc: Node, ranges: readonly SelectionRange[], type: MarkType) => boolean;
4
4
  export declare const isMarkExcluded: (type: MarkType, marks?: readonly Mark[] | null) => boolean;
5
- /**
6
- * Removes marks from nodes in the current selection that are not supported
7
- */
8
- export declare const sanitiseSelectionMarksForWrapping: (state: EditorState, newParentType?: NodeType) => Transaction | undefined;
9
- type NodesSanitized = Array<{
10
- node: Node;
11
- marksRemoved: Mark[];
12
- }>;
13
- export declare const sanitiseMarksInSelection: (tr: Transaction, newParentType?: NodeType) => NodesSanitized;
14
- export {};
@@ -1,10 +1,8 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
- import type { Side } from '@atlaskit/editor-common/selection';
5
4
  export { setNodeSelection, setTextSelection, } from '@atlaskit/editor-common/utils';
6
5
  export declare function setAllSelection(view: EditorView): void;
7
- export declare function setGapCursorSelection(view: EditorView, pos: number, side: Side): void;
8
6
  export declare function setCellSelection(view: EditorView, anchor: number, head?: number): void;
9
7
  export declare const isValidPosition: (pos: number, state: EditorState) => boolean;
10
8
  export declare const duplicateSelection: (selectionToDuplicate: Selection, doc: Node) => Selection | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.28.5",
3
+ "version": "187.29.0",
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.49.0",
58
+ "@atlaskit/editor-common": "^74.50.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",
@@ -73,7 +73,7 @@
73
73
  "@atlaskit/editor-plugin-guideline": "^0.3.4",
74
74
  "@atlaskit/editor-plugin-hyperlink": "^0.3.0",
75
75
  "@atlaskit/editor-plugin-image-upload": "^0.1.0",
76
- "@atlaskit/editor-plugin-list": "^0.2.0",
76
+ "@atlaskit/editor-plugin-list": "^1.0.0",
77
77
  "@atlaskit/editor-plugin-table": "^2.10.0",
78
78
  "@atlaskit/editor-plugin-text-formatting": "^0.2.0",
79
79
  "@atlaskit/editor-plugin-width": "^0.1.0",
package/report.api.md CHANGED
@@ -93,7 +93,6 @@ import { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
93
93
  import { jsx } from '@emotion/react';
94
94
  import { lightModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
95
95
  import type { LinkingOptions } from '@atlaskit/editor-common/types';
96
- import { ListState } from '@atlaskit/editor-plugin-list';
97
96
  import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
98
97
  import { MacroAttributes } from '@atlaskit/editor-common/provider-factory';
99
98
  import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
@@ -1185,14 +1184,6 @@ export { lightModeStatusColorPalette };
1185
1184
  // @public (undocumented)
1186
1185
  type Listener = (data: any) => void;
1187
1186
 
1188
- // @public (undocumented)
1189
- export type ListInputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
1190
-
1191
- export { ListState };
1192
-
1193
- // @public (undocumented)
1194
- export const listStateKey: PluginKey<ListState>;
1195
-
1196
1187
  export { MacroAttributes };
1197
1188
 
1198
1189
  export { MacroProvider };
@@ -82,7 +82,6 @@ import { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
82
82
  import { jsx } from '@emotion/react';
83
83
  import { lightModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
84
84
  import type { LinkingOptions } from '@atlaskit/editor-common/types';
85
- import { ListState } from '@atlaskit/editor-plugin-list';
86
85
  import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
87
86
  import { MacroAttributes } from '@atlaskit/editor-common/provider-factory';
88
87
  import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
@@ -1062,14 +1061,6 @@ export { lightModeStatusColorPalette }
1062
1061
  // @public (undocumented)
1063
1062
  type Listener = (data: any) => void;
1064
1063
 
1065
- // @public (undocumented)
1066
- export type ListInputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
1067
-
1068
- export { ListState }
1069
-
1070
- // @public (undocumented)
1071
- export const listStateKey: PluginKey<ListState>;
1072
-
1073
1064
  export { MacroAttributes }
1074
1065
 
1075
1066
  export { MacroProvider }
@@ -1,153 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertListType = convertListType;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _model = require("@atlaskit/editor-prosemirror/model");
9
- var _transform = require("@atlaskit/editor-prosemirror/transform");
10
- var _utils = require("@atlaskit/editor-prosemirror/utils");
11
- var _utils2 = require("@atlaskit/editor-common/utils");
12
- var _lists = require("@atlaskit/editor-common/lists");
13
- var _find = require("../utils/find");
14
- var _selection = require("@atlaskit/editor-common/selection");
15
- function convertListType(_ref) {
16
- var tr = _ref.tr,
17
- nextListNodeType = _ref.nextListNodeType;
18
- var doc = tr.doc,
19
- _tr$selection = tr.selection,
20
- $from = _tr$selection.$from,
21
- $to = _tr$selection.$to;
22
- var listRange;
23
- if (tr.selection instanceof _selection.GapCursorSelection) {
24
- var _$from$nodeAfter;
25
- var nodeSize = ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.nodeSize) || 1;
26
- listRange = $from.blockRange($from.doc.resolve($from.pos + nodeSize));
27
- } else {
28
- listRange = $from.blockRange($to, _utils2.isListNode);
29
- }
30
- if (listRange) {
31
- return convertSelectedList({
32
- tr: tr,
33
- nextListNodeType: nextListNodeType
34
- });
35
- }
36
- var nodeRangeAroundList = $from.blockRange($to);
37
- if (!nodeRangeAroundList) {
38
- return;
39
- }
40
- var parentNode = nodeRangeAroundList.parent;
41
- var startIndex = nodeRangeAroundList.startIndex,
42
- endIndex = nodeRangeAroundList.endIndex,
43
- depth = nodeRangeAroundList.depth;
44
-
45
- // Checking for invalid nodes to prevent conversion
46
- // eg. a panel cannot be wrapped in a list so return
47
- // It will skip this check if the selection begins within a list
48
- // This is to match the behaviour of the toolbar buttons being disabled
49
- if (!(0, _find.findFirstParentListNode)($from)) {
50
- for (var i = startIndex; i < endIndex; i++) {
51
- var position = nodeRangeAroundList.$from.posAtIndex(i, depth);
52
- var resolvedPosition = doc.resolve(position);
53
- var currentChild = parentNode.child(i);
54
- var currentNodeRange = resolvedPosition.blockRange(tr.doc.resolve(position + currentChild.nodeSize));
55
- if (currentNodeRange && !(0, _utils2.isListNode)(currentChild) && !(0, _transform.findWrapping)(currentNodeRange, nextListNodeType)) {
56
- return;
57
- }
58
- }
59
- }
60
-
61
- // Checking for any non list nodes and wrapping them in a list
62
- // so they can be converted
63
- tr.doc.nodesBetween(nodeRangeAroundList.start, nodeRangeAroundList.end, function (node, pos) {
64
- // Skip over any nodes that are part of a list
65
- if ((0, _find.findFirstParentListNode)(tr.doc.resolve(tr.mapping.map(pos)))) {
66
- return false;
67
- }
68
-
69
- // The following applies to suitable nodes that are not within a list
70
- var currentNodeNotWrappedInList = node;
71
- var isNotAnEmptyParagraphAndIsParagraphOrLeafNode = !(0, _utils2.isEmptyParagraph)(currentNodeNotWrappedInList) && (!node.type.isBlock || node.type.name === 'paragraph');
72
- if (isNotAnEmptyParagraphAndIsParagraphOrLeafNode && nodeRangeAroundList) {
73
- var remainingNodeRange = new _model.NodeRange(tr.doc.resolve(tr.mapping.map(pos)), tr.doc.resolve(tr.mapping.map(pos) + currentNodeNotWrappedInList.nodeSize), nodeRangeAroundList.depth);
74
- convertAroundList({
75
- tr: tr,
76
- nextListNodeType: nextListNodeType,
77
- nodeRange: remainingNodeRange
78
- });
79
- return false;
80
- }
81
- });
82
- convertSelectedList({
83
- tr: tr,
84
- nextListNodeType: nextListNodeType
85
- });
86
- if (tr.docChanged) {
87
- (0, _lists.joinSiblingLists)({
88
- tr: tr,
89
- forceListType: nextListNodeType
90
- });
91
- }
92
- }
93
- var convertSelectedList = function convertSelectedList(_ref2) {
94
- var tr = _ref2.tr,
95
- nextListNodeType = _ref2.nextListNodeType;
96
- var selection = tr.selection,
97
- _tr$selection2 = tr.selection,
98
- from = _tr$selection2.from,
99
- to = _tr$selection2.to;
100
- var codeBlock = tr.doc.type.schema.nodes.codeBlock;
101
- // get the positions of all the leaf nodes within the selection
102
- var nodePositions = [];
103
- if (selection instanceof _state.TextSelection && selection.$cursor || selection instanceof _selection.GapCursorSelection) {
104
- nodePositions.push(from);
105
- } else {
106
- // nodesBetween doesn't return leaf nodes that are outside of from and to
107
- tr.doc.nodesBetween(from, to, function (node, pos) {
108
- // isLeaf is false for empty codeBlock so adding additional check for childCount
109
- if (!node.isLeaf && !(node.type === codeBlock && node.childCount === 0)) {
110
- return true;
111
- }
112
- nodePositions.push(pos);
113
- });
114
- }
115
-
116
- // use those positions to get the closest parent list nodes
117
- nodePositions.reduce(function (acc, pos) {
118
- var closestParentListNode = (0, _utils.findParentNodeClosestToPos)(tr.doc.resolve(pos), _utils2.isListNode);
119
- if (!closestParentListNode) {
120
- return acc;
121
- }
122
-
123
- // don't add duplicates if the parent has already been added into the array
124
- var existingParent = acc.find(function (node) {
125
- return node.pos === closestParentListNode.pos && node.start === closestParentListNode.start && node.depth === closestParentListNode.depth;
126
- });
127
- if (!existingParent) {
128
- acc.push(closestParentListNode);
129
- }
130
- return acc;
131
- }, []).forEach(function (item) {
132
- tr.setNodeMarkup(item.pos, nextListNodeType);
133
- });
134
- };
135
- var convertAroundList = function convertAroundList(_ref3) {
136
- var tr = _ref3.tr,
137
- nextListNodeType = _ref3.nextListNodeType,
138
- nodeRange = _ref3.nodeRange;
139
- for (var i = nodeRange.endIndex - 1; i >= nodeRange.startIndex; i--) {
140
- // @ts-ignore posAtIndex is a public API but has no type yet
141
- var position = nodeRange.$from.posAtIndex(i, nodeRange.depth);
142
- var resolvedPos = tr.doc.resolve(position + 1);
143
- var range = resolvedPos.blockRange(resolvedPos);
144
- if (!range) {
145
- return;
146
- }
147
- var wrappings = (0, _transform.findWrapping)(range, nextListNodeType);
148
- if (!range || !wrappings) {
149
- return;
150
- }
151
- tr.wrap(range, wrappings);
152
- }
153
- };
@@ -1,125 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.indentListItemsSelected = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _state = require("@atlaskit/editor-prosemirror/state");
10
- var _model = require("@atlaskit/editor-prosemirror/model");
11
- var _lists = require("@atlaskit/editor-common/lists");
12
- var _find = require("../utils/find");
13
- var _utils = require("@atlaskit/editor-common/utils");
14
- var _selection = require("@atlaskit/editor-common/selection");
15
- var indentListItemsSelected = function indentListItemsSelected(tr) {
16
- var originalSelection = tr.selection;
17
- var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
18
- selection: originalSelection,
19
- doc: tr.doc
20
- });
21
- var $from = normalizedSelection.$from,
22
- $to = normalizedSelection.$to;
23
- var range = calculateRange({
24
- selection: normalizedSelection
25
- });
26
- if (!range) {
27
- return false;
28
- }
29
- var listItemsSelected = {
30
- from: (0, _find.findFirstParentListItemNode)($from),
31
- to: (0, _find.findFirstParentListItemNode)($to)
32
- };
33
- if (listItemsSelected.from === null || listItemsSelected.to === null) {
34
- return null;
35
- }
36
- var resolvedPos = tr.doc.resolve(listItemsSelected.from.pos);
37
- var listItemIndex = resolvedPos.index();
38
- // @ts-ignore
39
- var positionListItemPosition = resolvedPos.posAtIndex(listItemIndex - 1);
40
- var previousListItem = tr.doc.nodeAt(positionListItemPosition);
41
- if (!previousListItem || !(0, _utils.isListItemNode)(previousListItem)) {
42
- return null;
43
- }
44
- if ((0, _utils.isListItemNode)(previousListItem) && listItemIndex === 0) {
45
- return null;
46
- }
47
- var listItemSelectedCommonParent = range.parent;
48
- var previousNestedList = (0, _utils.isListNode)(previousListItem.lastChild) ? previousListItem.lastChild : null;
49
- var listNodeType = previousNestedList ? previousNestedList.type : listItemSelectedCommonParent.type;
50
- var nestedList = listItemsSelected.to.node.lastChild;
51
- var nestedItemsOffset = nestedList && (0, _utils.isListNode)(nestedList) ? nestedList.nodeSize : 0;
52
- var from = listItemsSelected.from.pos;
53
- var to = listItemsSelected.to.pos + listItemsSelected.to.node.nodeSize - nestedItemsOffset;
54
- var _createIndentedListIt = createIndentedListItemsSlice({
55
- tr: tr,
56
- listNodeType: listNodeType,
57
- range: range,
58
- from: from,
59
- to: to
60
- }),
61
- _createIndentedListIt2 = (0, _slicedToArray2.default)(_createIndentedListIt, 2),
62
- sliceSelected = _createIndentedListIt2[0],
63
- nestedListItemsLeftover = _createIndentedListIt2[1];
64
- var hasPreviousNestedList = Boolean(previousNestedList);
65
- var start = from - 1;
66
- tr.replaceRange(hasPreviousNestedList ? start - 1 : start, range.end, sliceSelected);
67
- var leftoverContentPosition = tr.mapping.map(to) - 2;
68
- if (nestedListItemsLeftover.openStart === 0) {
69
- tr.insert(leftoverContentPosition, nestedListItemsLeftover.content);
70
- } else {
71
- tr.replace(leftoverContentPosition - nestedListItemsLeftover.openStart, leftoverContentPosition - nestedListItemsLeftover.openStart, nestedListItemsLeftover);
72
- }
73
- var nextSelection = calculateNewSelection({
74
- originalSelection: originalSelection,
75
- normalizedSelection: normalizedSelection,
76
- tr: tr,
77
- hasPreviousNestedList: hasPreviousNestedList
78
- });
79
- tr.setSelection(nextSelection);
80
- };
81
- exports.indentListItemsSelected = indentListItemsSelected;
82
- var calculateRange = function calculateRange(_ref) {
83
- var selection = _ref.selection;
84
- var $from = selection.$from,
85
- $to = selection.$to;
86
- var range = $from.blockRange($to, _utils.isListNode);
87
- if (!range) {
88
- return null;
89
- }
90
- return range;
91
- };
92
- var calculateNewSelection = function calculateNewSelection(_ref2) {
93
- var tr = _ref2.tr,
94
- normalizedSelection = _ref2.normalizedSelection,
95
- originalSelection = _ref2.originalSelection,
96
- hasPreviousNestedList = _ref2.hasPreviousNestedList;
97
- var offset = hasPreviousNestedList ? 2 : 0;
98
- var $from = normalizedSelection.$from,
99
- $to = normalizedSelection.$to;
100
- if (normalizedSelection instanceof _selection.GapCursorSelection) {
101
- var _nextSelectionFrom = tr.doc.resolve($from.pos - offset);
102
- return new _selection.GapCursorSelection(_nextSelectionFrom, normalizedSelection.side);
103
- }
104
- if (originalSelection instanceof _state.NodeSelection) {
105
- return _state.NodeSelection.create(tr.doc, $from.pos - offset);
106
- }
107
- var _Selection$near = _state.Selection.near(tr.doc.resolve($from.pos - offset)),
108
- nextSelectionFrom = _Selection$near.$from;
109
- var _Selection$near2 = _state.Selection.near(tr.doc.resolve($to.pos - offset), -1),
110
- nextSelectionTo = _Selection$near2.$to;
111
- return new _state.TextSelection(nextSelectionFrom, nextSelectionTo);
112
- };
113
- var createIndentedListItemsSlice = function createIndentedListItemsSlice(_ref3) {
114
- var tr = _ref3.tr,
115
- from = _ref3.from,
116
- to = _ref3.to,
117
- listNodeType = _ref3.listNodeType,
118
- range = _ref3.range;
119
- var listItemsSlice = tr.doc.slice(from, to - 2);
120
- var listFragment = _model.Fragment.from(listNodeType.create(null, listItemsSlice.content));
121
- var nonSelectedListItemsSlice = tr.doc.slice(to, range.end - 2);
122
- var openStart = tr.doc.slice(from - 1, range.end).openStart;
123
- var slice = new _model.Slice(listFragment, openStart, 0);
124
- return [slice, nonSelectedListItemsSlice];
125
- };