@atlaskit/editor-plugin-list 1.2.4 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`39ff0b0788c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/39ff0b0788c) - [ux] [ED-19466] Solve bug where toggling off a bullet list when the list item contained text and a wrap (left or right) media node left the media node behind in the list and then joining the paragraph back to the list caused a position error.
14
+
15
+ Also export toggleList function so it can be used in external tests.
16
+
3
17
  ## 1.2.4
4
18
 
5
19
  ### Patch Changes
@@ -300,7 +300,7 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
300
300
  if ($cut.nodeAfter && ($cut.nodeAfter.type === paragraph || $cut.nodeAfter.type === codeBlock)) {
301
301
  // find the nearest paragraph that precedes this node
302
302
  var $lastNode = $cut.doc.resolve($cut.pos - 1);
303
- while ($lastNode.parent.type !== paragraph) {
303
+ while ($lastNode.parent.type !== paragraph && $lastNode.pos > 1) {
304
304
  $lastNode = state.doc.resolve($lastNode.pos - 1);
305
305
  }
306
306
  var tr = state.tr;
package/dist/cjs/index.js CHANGED
@@ -9,4 +9,11 @@ Object.defineProperty(exports, "listPlugin", {
9
9
  return _plugin.listPlugin;
10
10
  }
11
11
  });
12
- var _plugin = require("./plugin");
12
+ Object.defineProperty(exports, "toggleList", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _commands.toggleList;
16
+ }
17
+ });
18
+ var _plugin = require("./plugin");
19
+ var _commands = require("./commands");
@@ -271,7 +271,7 @@ const joinToPreviousListItem = (state, dispatch) => {
271
271
  if ($cut.nodeAfter && ($cut.nodeAfter.type === paragraph || $cut.nodeAfter.type === codeBlock)) {
272
272
  // find the nearest paragraph that precedes this node
273
273
  let $lastNode = $cut.doc.resolve($cut.pos - 1);
274
- while ($lastNode.parent.type !== paragraph) {
274
+ while ($lastNode.parent.type !== paragraph && $lastNode.pos > 1) {
275
275
  $lastNode = state.doc.resolve($lastNode.pos - 1);
276
276
  }
277
277
  let {
@@ -1 +1,2 @@
1
- export { listPlugin } from './plugin';
1
+ export { listPlugin } from './plugin';
2
+ export { toggleList } from './commands';
@@ -274,7 +274,7 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
274
274
  if ($cut.nodeAfter && ($cut.nodeAfter.type === paragraph || $cut.nodeAfter.type === codeBlock)) {
275
275
  // find the nearest paragraph that precedes this node
276
276
  var $lastNode = $cut.doc.resolve($cut.pos - 1);
277
- while ($lastNode.parent.type !== paragraph) {
277
+ while ($lastNode.parent.type !== paragraph && $lastNode.pos > 1) {
278
278
  $lastNode = state.doc.resolve($lastNode.pos - 1);
279
279
  }
280
280
  var tr = state.tr;
package/dist/esm/index.js CHANGED
@@ -1 +1,2 @@
1
- export { listPlugin } from './plugin';
1
+ export { listPlugin } from './plugin';
2
+ export { toggleList } from './commands';
@@ -1,2 +1,3 @@
1
1
  export type { ListPlugin, ListPluginOptions, FindRootParentListNode, ListState, InputMethod, } from './types';
2
2
  export { listPlugin } from './plugin';
3
+ export { toggleList } from './commands';
@@ -1,2 +1,3 @@
1
1
  export type { ListPlugin, ListPluginOptions, FindRootParentListNode, ListState, InputMethod, } from './types';
2
2
  export { listPlugin } from './plugin';
3
+ export { toggleList } from './commands';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "1.2.4",
3
+ "version": "1.3.1",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^29.1.0",
35
- "@atlaskit/editor-common": "^75.0.0",
35
+ "@atlaskit/editor-common": "^76.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^0.2.0",
37
37
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",
package/report.api.md CHANGED
@@ -17,10 +17,11 @@
17
17
  ```ts
18
18
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
19
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
20
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
20
21
  import type { EditorCommand } from '@atlaskit/editor-common/types';
21
22
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
22
23
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
23
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
24
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
24
25
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
25
26
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
26
27
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
@@ -35,6 +36,9 @@ type IndentList = (inputMethod: InputMethod) => EditorCommand;
35
36
  // @public (undocumented)
36
37
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
37
38
 
39
+ // @public (undocumented)
40
+ type InputMethod_2 = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
41
+
38
42
  // @public (undocumented)
39
43
  type IsInsideListItem = (tr: Transaction) => boolean;
40
44
 
@@ -84,6 +88,14 @@ type OutdentList = (inputMethod: InputMethod) => EditorCommand;
84
88
  // @public (undocumented)
85
89
  type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
86
90
 
91
+ // @public (undocumented)
92
+ export const toggleList: (
93
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
94
+ ) => (
95
+ inputMethod: InputMethod_2,
96
+ listType: 'bulletList' | 'orderedList',
97
+ ) => EditorCommand;
98
+
87
99
  // @public (undocumented)
88
100
  type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
89
101
 
@@ -6,10 +6,11 @@
6
6
 
7
7
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
9
10
  import type { EditorCommand } from '@atlaskit/editor-common/types';
10
11
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
11
12
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
12
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
13
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
13
14
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
14
15
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
15
16
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
@@ -24,6 +25,9 @@ type IndentList = (inputMethod: InputMethod) => EditorCommand;
24
25
  // @public (undocumented)
25
26
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
26
27
 
28
+ // @public (undocumented)
29
+ type InputMethod_2 = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
30
+
27
31
  // @public (undocumented)
28
32
  type IsInsideListItem = (tr: Transaction) => boolean;
29
33
 
@@ -70,6 +74,9 @@ type OutdentList = (inputMethod: InputMethod) => EditorCommand;
70
74
  // @public (undocumented)
71
75
  type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
72
76
 
77
+ // @public (undocumented)
78
+ export const toggleList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod_2, listType: 'bulletList' | 'orderedList') => EditorCommand;
79
+
73
80
  // @public (undocumented)
74
81
  type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
75
82