@atlaskit/editor-plugin-list 0.2.0 → 1.1.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 (181) hide show
  1. package/.eslintrc.js +14 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +1 -1
  4. package/dist/cjs/actions/conversions.js +153 -0
  5. package/dist/cjs/actions/indent-list-items-selected.js +125 -0
  6. package/dist/cjs/actions/indent-list.js +49 -0
  7. package/dist/cjs/actions/join-list-items-forward.js +59 -0
  8. package/dist/cjs/actions/join-list-items-scenarios/index.js +40 -0
  9. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +88 -0
  10. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +85 -0
  11. package/dist/cjs/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +79 -0
  12. package/dist/cjs/actions/join-list-items-scenarios/join-paragraph-with-list.js +45 -0
  13. package/dist/cjs/actions/join-list-items-scenarios/join-sibling-list-items.js +56 -0
  14. package/dist/cjs/actions/merge-lists.js +27 -0
  15. package/dist/cjs/actions/outdent-list-items-selected.js +289 -0
  16. package/dist/cjs/actions/wrap-and-join-lists.js +100 -0
  17. package/dist/cjs/commands/indent-list.js +69 -0
  18. package/dist/cjs/commands/index.js +349 -0
  19. package/dist/cjs/commands/isFirstChildOfParent.js +12 -0
  20. package/dist/cjs/commands/join-list-item-forward.js +61 -0
  21. package/dist/cjs/commands/listBackspace.js +284 -0
  22. package/dist/cjs/commands/outdent-list.js +69 -0
  23. package/dist/cjs/index.js +8 -1
  24. package/dist/cjs/messages.js +37 -0
  25. package/dist/cjs/plugin.js +137 -0
  26. package/dist/cjs/pm-plugins/input-rules/create-list-input-rule.js +63 -0
  27. package/dist/cjs/pm-plugins/input-rules/index.js +38 -0
  28. package/dist/cjs/pm-plugins/input-rules/wrapping-join-rule.js +60 -0
  29. package/dist/cjs/pm-plugins/keymap.js +27 -0
  30. package/dist/cjs/pm-plugins/main.js +166 -0
  31. package/dist/cjs/transforms.js +99 -0
  32. package/dist/cjs/types.js +4 -1
  33. package/dist/cjs/utils/analytics.js +22 -0
  34. package/dist/cjs/utils/find.js +68 -0
  35. package/dist/cjs/utils/indentation.js +22 -0
  36. package/dist/cjs/utils/mark.js +40 -0
  37. package/dist/cjs/utils/node.js +16 -0
  38. package/dist/cjs/utils/selection.js +95 -0
  39. package/dist/es2019/actions/conversions.js +160 -0
  40. package/dist/es2019/actions/indent-list-items-selected.js +124 -0
  41. package/dist/es2019/actions/indent-list.js +44 -0
  42. package/dist/es2019/actions/join-list-items-forward.js +54 -0
  43. package/dist/es2019/actions/join-list-items-scenarios/index.js +5 -0
  44. package/dist/es2019/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +74 -0
  45. package/dist/es2019/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +77 -0
  46. package/dist/es2019/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +71 -0
  47. package/dist/es2019/actions/join-list-items-scenarios/join-paragraph-with-list.js +37 -0
  48. package/dist/es2019/actions/join-list-items-scenarios/join-sibling-list-items.js +48 -0
  49. package/dist/es2019/actions/merge-lists.js +24 -0
  50. package/dist/es2019/actions/outdent-list-items-selected.js +293 -0
  51. package/dist/es2019/actions/wrap-and-join-lists.js +93 -0
  52. package/dist/es2019/commands/indent-list.js +61 -0
  53. package/dist/es2019/commands/index.js +322 -0
  54. package/dist/es2019/commands/isFirstChildOfParent.js +7 -0
  55. package/dist/es2019/commands/join-list-item-forward.js +53 -0
  56. package/dist/es2019/commands/listBackspace.js +276 -0
  57. package/dist/es2019/commands/outdent-list.js +60 -0
  58. package/dist/es2019/index.js +1 -1
  59. package/dist/es2019/messages.js +29 -0
  60. package/dist/es2019/plugin.js +123 -0
  61. package/dist/es2019/pm-plugins/input-rules/create-list-input-rule.js +56 -0
  62. package/dist/es2019/pm-plugins/input-rules/index.js +35 -0
  63. package/dist/es2019/pm-plugins/input-rules/wrapping-join-rule.js +55 -0
  64. package/dist/es2019/pm-plugins/keymap.js +19 -0
  65. package/dist/es2019/pm-plugins/main.js +156 -0
  66. package/dist/es2019/transforms.js +101 -0
  67. package/dist/es2019/types.js +1 -1
  68. package/dist/es2019/utils/analytics.js +12 -0
  69. package/dist/es2019/utils/find.js +61 -0
  70. package/dist/es2019/utils/indentation.js +15 -0
  71. package/dist/es2019/utils/mark.js +30 -0
  72. package/dist/es2019/utils/node.js +12 -0
  73. package/dist/es2019/utils/selection.js +96 -0
  74. package/dist/esm/actions/conversions.js +147 -0
  75. package/dist/esm/actions/indent-list-items-selected.js +117 -0
  76. package/dist/esm/actions/indent-list.js +43 -0
  77. package/dist/esm/actions/join-list-items-forward.js +52 -0
  78. package/dist/esm/actions/join-list-items-scenarios/index.js +5 -0
  79. package/dist/esm/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +81 -0
  80. package/dist/esm/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +78 -0
  81. package/dist/esm/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +72 -0
  82. package/dist/esm/actions/join-list-items-scenarios/join-paragraph-with-list.js +38 -0
  83. package/dist/esm/actions/join-list-items-scenarios/join-sibling-list-items.js +49 -0
  84. package/dist/esm/actions/merge-lists.js +21 -0
  85. package/dist/esm/actions/outdent-list-items-selected.js +281 -0
  86. package/dist/esm/actions/wrap-and-join-lists.js +94 -0
  87. package/dist/esm/commands/indent-list.js +61 -0
  88. package/dist/esm/commands/index.js +323 -0
  89. package/dist/esm/commands/isFirstChildOfParent.js +5 -0
  90. package/dist/esm/commands/join-list-item-forward.js +53 -0
  91. package/dist/esm/commands/listBackspace.js +275 -0
  92. package/dist/esm/commands/outdent-list.js +61 -0
  93. package/dist/esm/index.js +1 -1
  94. package/dist/esm/messages.js +29 -0
  95. package/dist/esm/plugin.js +130 -0
  96. package/dist/esm/pm-plugins/input-rules/create-list-input-rule.js +57 -0
  97. package/dist/esm/pm-plugins/input-rules/index.js +32 -0
  98. package/dist/esm/pm-plugins/input-rules/wrapping-join-rule.js +54 -0
  99. package/dist/esm/pm-plugins/keymap.js +19 -0
  100. package/dist/esm/pm-plugins/main.js +156 -0
  101. package/dist/esm/transforms.js +91 -0
  102. package/dist/esm/types.js +1 -1
  103. package/dist/esm/utils/analytics.js +12 -0
  104. package/dist/esm/utils/find.js +59 -0
  105. package/dist/esm/utils/indentation.js +15 -0
  106. package/dist/esm/utils/mark.js +33 -0
  107. package/dist/esm/utils/node.js +10 -0
  108. package/dist/esm/utils/selection.js +81 -0
  109. package/dist/types/actions/conversions.d.ts +6 -0
  110. package/dist/types/actions/indent-list-items-selected.d.ts +2 -0
  111. package/dist/types/actions/indent-list.d.ts +2 -0
  112. package/dist/types/actions/join-list-items-forward.d.ts +13 -0
  113. package/dist/types/actions/join-list-items-scenarios/index.d.ts +5 -0
  114. package/dist/types/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +9 -0
  115. package/dist/types/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +9 -0
  116. package/dist/types/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +9 -0
  117. package/dist/types/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +9 -0
  118. package/dist/types/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +9 -0
  119. package/dist/types/actions/merge-lists.d.ts +7 -0
  120. package/dist/types/actions/outdent-list-items-selected.d.ts +3 -0
  121. package/dist/types/actions/wrap-and-join-lists.d.ts +17 -0
  122. package/dist/types/commands/indent-list.d.ts +6 -0
  123. package/dist/types/commands/index.d.ts +15 -0
  124. package/dist/types/commands/isFirstChildOfParent.d.ts +2 -0
  125. package/dist/types/commands/join-list-item-forward.d.ts +3 -0
  126. package/dist/types/commands/listBackspace.d.ts +10 -0
  127. package/dist/types/commands/outdent-list.d.ts +6 -0
  128. package/dist/types/index.d.ts +2 -1
  129. package/dist/types/messages.d.ts +27 -0
  130. package/dist/types/plugin.d.ts +2 -0
  131. package/dist/types/pm-plugins/input-rules/create-list-input-rule.d.ts +11 -0
  132. package/dist/types/pm-plugins/input-rules/index.d.ts +5 -0
  133. package/dist/types/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
  134. package/dist/types/pm-plugins/keymap.d.ts +5 -0
  135. package/dist/types/pm-plugins/main.d.ts +11 -0
  136. package/dist/types/transforms.d.ts +4 -0
  137. package/dist/types/types.d.ts +13 -13
  138. package/dist/types/utils/analytics.d.ts +5 -0
  139. package/dist/types/utils/find.d.ts +10 -0
  140. package/dist/types/utils/indentation.d.ts +2 -0
  141. package/dist/types/utils/mark.d.ts +8 -0
  142. package/dist/types/utils/node.d.ts +2 -0
  143. package/dist/types/utils/selection.d.ts +14 -0
  144. package/dist/types-ts4.5/actions/conversions.d.ts +6 -0
  145. package/dist/types-ts4.5/actions/indent-list-items-selected.d.ts +2 -0
  146. package/dist/types-ts4.5/actions/indent-list.d.ts +2 -0
  147. package/dist/types-ts4.5/actions/join-list-items-forward.d.ts +16 -0
  148. package/dist/types-ts4.5/actions/join-list-items-scenarios/index.d.ts +5 -0
  149. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +9 -0
  150. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +9 -0
  151. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +9 -0
  152. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +9 -0
  153. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +9 -0
  154. package/dist/types-ts4.5/actions/merge-lists.d.ts +7 -0
  155. package/dist/types-ts4.5/actions/outdent-list-items-selected.d.ts +3 -0
  156. package/dist/types-ts4.5/actions/wrap-and-join-lists.d.ts +17 -0
  157. package/dist/types-ts4.5/commands/indent-list.d.ts +6 -0
  158. package/dist/types-ts4.5/commands/index.d.ts +15 -0
  159. package/dist/types-ts4.5/commands/isFirstChildOfParent.d.ts +2 -0
  160. package/dist/types-ts4.5/commands/join-list-item-forward.d.ts +3 -0
  161. package/dist/types-ts4.5/commands/listBackspace.d.ts +13 -0
  162. package/dist/types-ts4.5/commands/outdent-list.d.ts +6 -0
  163. package/dist/types-ts4.5/index.d.ts +2 -1
  164. package/dist/types-ts4.5/messages.d.ts +27 -0
  165. package/dist/types-ts4.5/plugin.d.ts +2 -0
  166. package/dist/types-ts4.5/pm-plugins/input-rules/create-list-input-rule.d.ts +11 -0
  167. package/dist/types-ts4.5/pm-plugins/input-rules/index.d.ts +5 -0
  168. package/dist/types-ts4.5/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
  169. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +5 -0
  170. package/dist/types-ts4.5/pm-plugins/main.d.ts +11 -0
  171. package/dist/types-ts4.5/transforms.d.ts +4 -0
  172. package/dist/types-ts4.5/types.d.ts +13 -13
  173. package/dist/types-ts4.5/utils/analytics.d.ts +5 -0
  174. package/dist/types-ts4.5/utils/find.d.ts +10 -0
  175. package/dist/types-ts4.5/utils/indentation.d.ts +2 -0
  176. package/dist/types-ts4.5/utils/mark.d.ts +8 -0
  177. package/dist/types-ts4.5/utils/node.d.ts +2 -0
  178. package/dist/types-ts4.5/utils/selection.d.ts +14 -0
  179. package/package.json +8 -5
  180. package/report.api.md +17 -18
  181. package/tmp/api-report-tmp.d.ts +15 -11
package/report.api.md CHANGED
@@ -16,28 +16,27 @@
16
16
 
17
17
  ```ts
18
18
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
- import type { Command } from '@atlaskit/editor-common/types';
20
19
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
21
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
22
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
20
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
23
21
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
24
22
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
25
23
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
26
24
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
27
25
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
28
26
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
27
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
29
28
 
30
29
  // @public (undocumented)
31
30
  export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
32
31
 
33
32
  // @public (undocumented)
34
- type IndentList = (inputMethod: InputMethod) => Command;
33
+ type IndentList = (inputMethod: InputMethod) => EditorCommand;
35
34
 
36
35
  // @public (undocumented)
37
- type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
36
+ export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
38
37
 
39
38
  // @public (undocumented)
40
- type IsInsideListItem = (state: EditorState) => boolean;
39
+ type IsInsideListItem = (tr: Transaction) => boolean;
41
40
 
42
41
  // @public (undocumented)
43
42
  export type ListPlugin = NextEditorPlugin<
@@ -49,17 +48,22 @@ export type ListPlugin = NextEditorPlugin<
49
48
  OptionalPlugin<typeof analyticsPlugin>,
50
49
  ];
51
50
  actions: {
51
+ isInsideListItem: IsInsideListItem;
52
+ findRootParentListNode: FindRootParentListNode;
53
+ };
54
+ commands: {
52
55
  indentList: IndentList;
53
56
  outdentList: OutdentList;
54
57
  toggleOrderedList: ToggleOrderedList;
55
58
  toggleBulletList: ToggleBulletList;
56
- isInsideListItem: IsInsideListItem;
57
- findRootParentListNode: FindRootParentListNode;
58
59
  };
59
60
  sharedState: ListState | undefined;
60
61
  }
61
62
  >;
62
63
 
64
+ // @public (undocumented)
65
+ export const listPlugin: ListPlugin;
66
+
63
67
  // @public (undocumented)
64
68
  export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
65
69
 
@@ -78,19 +82,13 @@ export interface ListState {
78
82
  }
79
83
 
80
84
  // @public (undocumented)
81
- type OutdentList = (
82
- inputMethod: InputMethod,
83
- featureFlags: FeatureFlags,
84
- ) => Command;
85
+ type OutdentList = (inputMethod: InputMethod) => EditorCommand;
85
86
 
86
87
  // @public (undocumented)
87
- type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
88
+ type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
88
89
 
89
90
  // @public (undocumented)
90
- type ToggleOrderedList = (
91
- view: EditorView,
92
- inputMethod: InputMethod,
93
- ) => boolean;
91
+ type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
94
92
 
95
93
  // (No @packageDocumentation comment for this package)
96
94
  ```
@@ -103,7 +101,8 @@ type ToggleOrderedList = (
103
101
 
104
102
  ```json
105
103
  {
106
- "react": "^16.8.0"
104
+ "react": "^16.8.0",
105
+ "react-intl-next": "npm:react-intl@^5.18.1"
107
106
  }
108
107
  ```
109
108
 
@@ -5,28 +5,27 @@
5
5
  ```ts
6
6
 
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
- import type { Command } from '@atlaskit/editor-common/types';
9
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
12
10
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
13
11
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
14
12
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
15
13
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
16
14
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
17
15
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
16
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
18
17
 
19
18
  // @public (undocumented)
20
19
  export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
21
20
 
22
21
  // @public (undocumented)
23
- type IndentList = (inputMethod: InputMethod) => Command;
22
+ type IndentList = (inputMethod: InputMethod) => EditorCommand;
24
23
 
25
24
  // @public (undocumented)
26
- type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
25
+ export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
27
26
 
28
27
  // @public (undocumented)
29
- type IsInsideListItem = (state: EditorState) => boolean;
28
+ type IsInsideListItem = (tr: Transaction) => boolean;
30
29
 
31
30
  // @public (undocumented)
32
31
  export type ListPlugin = NextEditorPlugin<'list', {
@@ -36,16 +35,21 @@ export type ListPlugin = NextEditorPlugin<'list', {
36
35
  OptionalPlugin<typeof analyticsPlugin>
37
36
  ];
38
37
  actions: {
38
+ isInsideListItem: IsInsideListItem;
39
+ findRootParentListNode: FindRootParentListNode;
40
+ };
41
+ commands: {
39
42
  indentList: IndentList;
40
43
  outdentList: OutdentList;
41
44
  toggleOrderedList: ToggleOrderedList;
42
45
  toggleBulletList: ToggleBulletList;
43
- isInsideListItem: IsInsideListItem;
44
- findRootParentListNode: FindRootParentListNode;
45
46
  };
46
47
  sharedState: ListState | undefined;
47
48
  }>;
48
49
 
50
+ // @public (undocumented)
51
+ export const listPlugin: ListPlugin;
52
+
49
53
  // @public (undocumented)
50
54
  export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
51
55
 
@@ -64,13 +68,13 @@ export interface ListState {
64
68
  }
65
69
 
66
70
  // @public (undocumented)
67
- type OutdentList = (inputMethod: InputMethod, featureFlags: FeatureFlags) => Command;
71
+ type OutdentList = (inputMethod: InputMethod) => EditorCommand;
68
72
 
69
73
  // @public (undocumented)
70
- type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
74
+ type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
71
75
 
72
76
  // @public (undocumented)
73
- type ToggleOrderedList = (view: EditorView, inputMethod: InputMethod) => boolean;
77
+ type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
74
78
 
75
79
  // (No @packageDocumentation comment for this package)
76
80