@atlaskit/editor-plugin-list 1.0.0 → 1.1.2

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 (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/actions/outdent-list-items-selected.js +1 -3
  3. package/dist/cjs/commands/indent-list.js +12 -14
  4. package/dist/cjs/commands/index.js +26 -27
  5. package/dist/cjs/commands/outdent-list.js +13 -14
  6. package/dist/cjs/plugin.js +8 -4
  7. package/dist/cjs/pm-plugins/keymap.js +4 -4
  8. package/dist/cjs/utils/selection.js +14 -14
  9. package/dist/es2019/actions/outdent-list-items-selected.js +1 -3
  10. package/dist/es2019/commands/indent-list.js +13 -14
  11. package/dist/es2019/commands/index.js +19 -23
  12. package/dist/es2019/commands/outdent-list.js +14 -14
  13. package/dist/es2019/plugin.js +6 -4
  14. package/dist/es2019/pm-plugins/keymap.js +5 -5
  15. package/dist/es2019/utils/selection.js +12 -12
  16. package/dist/esm/actions/outdent-list-items-selected.js +1 -3
  17. package/dist/esm/commands/indent-list.js +12 -14
  18. package/dist/esm/commands/index.js +26 -27
  19. package/dist/esm/commands/outdent-list.js +13 -14
  20. package/dist/esm/plugin.js +9 -5
  21. package/dist/esm/pm-plugins/keymap.js +5 -5
  22. package/dist/esm/utils/selection.js +14 -14
  23. package/dist/types/actions/outdent-list-items-selected.d.ts +2 -2
  24. package/dist/types/commands/indent-list.d.ts +2 -2
  25. package/dist/types/commands/index.d.ts +4 -5
  26. package/dist/types/commands/outdent-list.d.ts +2 -2
  27. package/dist/types/types.d.ts +15 -16
  28. package/dist/types/utils/selection.d.ts +4 -4
  29. package/dist/types-ts4.5/actions/outdent-list-items-selected.d.ts +2 -2
  30. package/dist/types-ts4.5/commands/indent-list.d.ts +2 -2
  31. package/dist/types-ts4.5/commands/index.d.ts +4 -5
  32. package/dist/types-ts4.5/commands/outdent-list.d.ts +2 -2
  33. package/dist/types-ts4.5/types.d.ts +16 -14
  34. package/dist/types-ts4.5/utils/selection.d.ts +4 -4
  35. package/package.json +3 -4
  36. package/report.api.md +14 -22
  37. package/tmp/api-report-tmp.d.ts +0 -80
@@ -1,11 +1,11 @@
1
1
  import type { NodeRange, NodeType, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const isPosInsideParagraph: ($pos: ResolvedPos) => boolean;
4
4
  export declare const isPosInsideList: ($pos: ResolvedPos) => boolean;
5
5
  export declare const isWrappingPossible: (nodeType: NodeType, selection: Selection) => boolean;
6
- export declare const isInsideListItem: (state: EditorState) => boolean;
7
- export declare const isInsideTableCell: (state: EditorState) => boolean;
8
- export declare const canJoinToPreviousListItem: (state: EditorState) => boolean;
6
+ export declare const isInsideListItem: (tr: Transaction) => boolean;
7
+ export declare const isInsideTableCell: (tr: Transaction) => boolean;
8
+ export declare const canJoinToPreviousListItem: (tr: Transaction) => boolean;
9
9
  export declare const selectionContainsList: (tr: Transaction) => PMNode | null;
10
10
  type CreateNodeRange = (props: {
11
11
  selection: Selection;
@@ -1,3 +1,3 @@
1
1
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- export declare const outdentListItemsSelected: (tr: Transaction, state: EditorState, featureFlags: FeatureFlags) => void;
2
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ export declare const outdentListItemsSelected: (tr: Transaction, featureFlags: FeatureFlags) => void;
@@ -1,6 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { Command } from '@atlaskit/editor-common/types';
3
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
4
4
  type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
5
- export declare const indentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => Command;
5
+ export declare const indentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => EditorCommand;
6
6
  export {};
@@ -1,8 +1,7 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { Command, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { Command, EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { NodeType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
5
  import { indentList } from './indent-list';
7
6
  import { outdentList } from './outdent-list';
8
7
  export { outdentList, indentList };
@@ -11,6 +10,6 @@ export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI |
11
10
  export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (featureFlags: FeatureFlags) => Command;
12
11
  export declare const deleteKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
13
12
  export declare const rootListDepth: (pos: ResolvedPos, nodes: Record<string, NodeType>) => number | undefined;
14
- export declare const toggleList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod, listType: 'bulletList' | 'orderedList') => Command;
15
- export declare const toggleBulletList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, inputMethod?: InputMethod) => boolean;
16
- export declare const toggleOrderedList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, inputMethod?: InputMethod) => boolean;
13
+ export declare const toggleList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod, listType: 'bulletList' | 'orderedList') => EditorCommand;
14
+ export declare const toggleBulletList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => EditorCommand;
15
+ export declare const toggleOrderedList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: InputMethod) => EditorCommand;
@@ -1,6 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { Command, FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { EditorCommand, FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
5
- export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => Command;
5
+ export declare const outdentList: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: InputMethod | undefined, featureFlags: FeatureFlags) => EditorCommand;
6
6
  export {};
@@ -1,18 +1,18 @@
1
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command, FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
2
+ import type { EditorCommand, FeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
5
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
6
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
7
- import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
6
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
7
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
9
9
  export declare const MAX_NESTED_LIST_INDENTATION = 6;
10
10
  export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
11
- export type IndentList = (inputMethod: InputMethod) => Command;
12
- export type OutdentList = (inputMethod: InputMethod, featureFlags: FeatureFlags) => Command;
13
- export type ToggleOrderedList = (view: EditorView, inputMethod: InputMethod) => boolean;
14
- export type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
15
- export type IsInsideListItem = (state: EditorState) => boolean;
11
+ export type IndentList = (inputMethod: InputMethod) => EditorCommand;
12
+ export type OutdentList = (inputMethod: InputMethod) => EditorCommand;
13
+ export type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
14
+ export type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
15
+ export type IsInsideListItem = (tr: Transaction) => boolean;
16
16
  export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
17
17
  export interface ListState {
18
18
  bulletListActive: boolean;
@@ -24,16 +24,18 @@ export interface ListState {
24
24
  export type ListPlugin = NextEditorPlugin<'list', {
25
25
  pluginConfiguration: ListPluginOptions | undefined;
26
26
  dependencies: [
27
- typeof featureFlagsPlugin,
28
- OptionalPlugin<typeof analyticsPlugin>
27
+ FeatureFlagsPlugin,
28
+ OptionalPlugin<AnalyticsPlugin>
29
29
  ];
30
30
  actions: {
31
+ isInsideListItem: IsInsideListItem;
32
+ findRootParentListNode: FindRootParentListNode;
33
+ };
34
+ commands: {
31
35
  indentList: IndentList;
32
36
  outdentList: OutdentList;
33
37
  toggleOrderedList: ToggleOrderedList;
34
38
  toggleBulletList: ToggleBulletList;
35
- isInsideListItem: IsInsideListItem;
36
- findRootParentListNode: FindRootParentListNode;
37
39
  };
38
40
  sharedState: ListState | undefined;
39
41
  }>;
@@ -1,11 +1,11 @@
1
1
  import type { NodeRange, NodeType, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare const isPosInsideParagraph: ($pos: ResolvedPos) => boolean;
4
4
  export declare const isPosInsideList: ($pos: ResolvedPos) => boolean;
5
5
  export declare const isWrappingPossible: (nodeType: NodeType, selection: Selection) => boolean;
6
- export declare const isInsideListItem: (state: EditorState) => boolean;
7
- export declare const isInsideTableCell: (state: EditorState) => boolean;
8
- export declare const canJoinToPreviousListItem: (state: EditorState) => boolean;
6
+ export declare const isInsideListItem: (tr: Transaction) => boolean;
7
+ export declare const isInsideTableCell: (tr: Transaction) => boolean;
8
+ export declare const canJoinToPreviousListItem: (tr: Transaction) => boolean;
9
9
  export declare const selectionContainsList: (tr: Transaction) => PMNode | null;
10
10
  type CreateNodeRange = (props: {
11
11
  selection: Selection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "1.0.0",
3
+ "version": "1.1.2",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,8 +31,8 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^28.1.0",
35
- "@atlaskit/editor-common": "^74.50.0",
34
+ "@atlaskit/adf-schema": "28.1.2",
35
+ "@atlaskit/editor-common": "^74.52.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
37
37
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",
@@ -45,7 +45,6 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@af/visual-regression": "*",
48
- "@atlaskit/editor-test-helpers": "^18.11.0",
49
48
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
50
49
  "@testing-library/react": "^12.1.5",
51
50
  "react-dom": "^16.8.0",
package/report.api.md CHANGED
@@ -15,46 +15,44 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
- import type { Command } from '@atlaskit/editor-common/types';
18
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
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
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
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
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<
44
43
  'list',
45
44
  {
46
45
  pluginConfiguration: ListPluginOptions | undefined;
47
- dependencies: [
48
- typeof featureFlagsPlugin,
49
- OptionalPlugin<typeof analyticsPlugin>,
50
- ];
46
+ dependencies: [FeatureFlagsPlugin, OptionalPlugin<AnalyticsPlugin>];
51
47
  actions: {
48
+ isInsideListItem: IsInsideListItem;
49
+ findRootParentListNode: FindRootParentListNode;
50
+ };
51
+ commands: {
52
52
  indentList: IndentList;
53
53
  outdentList: OutdentList;
54
54
  toggleOrderedList: ToggleOrderedList;
55
55
  toggleBulletList: ToggleBulletList;
56
- isInsideListItem: IsInsideListItem;
57
- findRootParentListNode: FindRootParentListNode;
58
56
  };
59
57
  sharedState: ListState | undefined;
60
58
  }
@@ -81,19 +79,13 @@ export interface ListState {
81
79
  }
82
80
 
83
81
  // @public (undocumented)
84
- type OutdentList = (
85
- inputMethod: InputMethod,
86
- featureFlags: FeatureFlags,
87
- ) => Command;
82
+ type OutdentList = (inputMethod: InputMethod) => EditorCommand;
88
83
 
89
84
  // @public (undocumented)
90
- type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
85
+ type ToggleBulletList = (inputMethod: InputMethod) => EditorCommand;
91
86
 
92
87
  // @public (undocumented)
93
- type ToggleOrderedList = (
94
- view: EditorView,
95
- inputMethod: InputMethod,
96
- ) => boolean;
88
+ type ToggleOrderedList = (inputMethod: InputMethod) => EditorCommand;
97
89
 
98
90
  // (No @packageDocumentation comment for this package)
99
91
  ```
@@ -1,80 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-list"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
- import type { Command } from '@atlaskit/editor-common/types';
9
- 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';
12
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
13
- import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
14
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
15
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
16
- import type { OptionalPlugin } from '@atlaskit/editor-common/types';
17
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
18
-
19
- // @public (undocumented)
20
- export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
21
-
22
- // @public (undocumented)
23
- type IndentList = (inputMethod: InputMethod) => Command;
24
-
25
- // @public (undocumented)
26
- export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
27
-
28
- // @public (undocumented)
29
- type IsInsideListItem = (state: EditorState) => boolean;
30
-
31
- // @public (undocumented)
32
- export type ListPlugin = NextEditorPlugin<'list', {
33
- pluginConfiguration: ListPluginOptions | undefined;
34
- dependencies: [
35
- typeof featureFlagsPlugin,
36
- OptionalPlugin<typeof analyticsPlugin>
37
- ];
38
- actions: {
39
- indentList: IndentList;
40
- outdentList: OutdentList;
41
- toggleOrderedList: ToggleOrderedList;
42
- toggleBulletList: ToggleBulletList;
43
- isInsideListItem: IsInsideListItem;
44
- findRootParentListNode: FindRootParentListNode;
45
- };
46
- sharedState: ListState | undefined;
47
- }>;
48
-
49
- // @public (undocumented)
50
- export const listPlugin: ListPlugin;
51
-
52
- // @public (undocumented)
53
- export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
54
-
55
- // @public (undocumented)
56
- export interface ListState {
57
- // (undocumented)
58
- bulletListActive: boolean;
59
- // (undocumented)
60
- bulletListDisabled: boolean;
61
- // (undocumented)
62
- decorationSet: DecorationSet;
63
- // (undocumented)
64
- orderedListActive: boolean;
65
- // (undocumented)
66
- orderedListDisabled: boolean;
67
- }
68
-
69
- // @public (undocumented)
70
- type OutdentList = (inputMethod: InputMethod, featureFlags: FeatureFlags) => Command;
71
-
72
- // @public (undocumented)
73
- type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
74
-
75
- // @public (undocumented)
76
- type ToggleOrderedList = (view: EditorView, inputMethod: InputMethod) => boolean;
77
-
78
- // (No @packageDocumentation comment for this package)
79
-
80
- ```