@atlaskit/editor-plugin-selection 3.1.1 → 3.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`22c631389088c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22c631389088c) -
8
+ Add option to provide custom selection to get\* selection actions
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 3.1.1
4
15
 
5
16
  ### Patch Changes
@@ -14,18 +14,28 @@ export type SetSelectionRelativeToNode = (props: {
14
14
  selectionRelativeToNode?: RelativeSelectionPos;
15
15
  selection?: Selection | null;
16
16
  }) => (state: EditorState) => Transaction;
17
+ type SelectionUtilityOptions = {
18
+ /**
19
+ * Use a specific selection rather than the current which is the default
20
+ */
21
+ selection?: Selection;
22
+ };
17
23
  export type EditorSelectionAPI = {
18
24
  selectNearNode: SetSelectionRelativeToNode;
19
25
  /**
20
26
  * Gets the current selection fragment.
27
+ * @param props Options to customise the selection fragment
28
+ * @param props.selection Use a specific selection rather than the current
21
29
  * @returns The current selection fragment as an array of JSON nodes.
22
30
  */
23
- getSelectionFragment: () => JSONNode[] | null;
31
+ getSelectionFragment: (props?: SelectionUtilityOptions) => JSONNode[] | null;
24
32
  /**
25
33
  * Gets the current selection local IDs. This includes all local IDs
34
+ * @param props Options to customise the selection fragment
35
+ * @param props.selection Use a specific selection rather than the current
26
36
  * @returns The current selection local IDs as an array of strings.
27
37
  */
28
- getSelectionLocalIds: () => string[] | null;
38
+ getSelectionLocalIds: (props?: SelectionUtilityOptions) => string[] | null;
29
39
  };
30
40
  export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
31
41
  /**
@@ -14,18 +14,28 @@ export type SetSelectionRelativeToNode = (props: {
14
14
  selectionRelativeToNode?: RelativeSelectionPos;
15
15
  selection?: Selection | null;
16
16
  }) => (state: EditorState) => Transaction;
17
+ type SelectionUtilityOptions = {
18
+ /**
19
+ * Use a specific selection rather than the current which is the default
20
+ */
21
+ selection?: Selection;
22
+ };
17
23
  export type EditorSelectionAPI = {
18
24
  selectNearNode: SetSelectionRelativeToNode;
19
25
  /**
20
26
  * Gets the current selection fragment.
27
+ * @param props Options to customise the selection fragment
28
+ * @param props.selection Use a specific selection rather than the current
21
29
  * @returns The current selection fragment as an array of JSON nodes.
22
30
  */
23
- getSelectionFragment: () => JSONNode[] | null;
31
+ getSelectionFragment: (props?: SelectionUtilityOptions) => JSONNode[] | null;
24
32
  /**
25
33
  * Gets the current selection local IDs. This includes all local IDs
34
+ * @param props Options to customise the selection fragment
35
+ * @param props.selection Use a specific selection rather than the current
26
36
  * @returns The current selection local IDs as an array of strings.
27
37
  */
28
- getSelectionLocalIds: () => string[] | null;
38
+ getSelectionLocalIds: (props?: SelectionUtilityOptions) => string[] | null;
29
39
  };
30
40
  export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
31
41
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,12 +25,12 @@
25
25
  "@atlaskit/editor-shared-styles": "^3.6.0",
26
26
  "@atlaskit/editor-tables": "^2.9.0",
27
27
  "@atlaskit/platform-feature-flags": "^1.1.0",
28
- "@atlaskit/tmp-editor-statsig": "^11.3.0",
28
+ "@atlaskit/tmp-editor-statsig": "^11.5.0",
29
29
  "@atlaskit/tokens": "^6.0.0",
30
30
  "@babel/runtime": "^7.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@atlaskit/editor-common": "^107.27.0",
33
+ "@atlaskit/editor-common": "^107.28.0",
34
34
  "react": "^18.2.0"
35
35
  },
36
36
  "techstack": {