@atlaskit/editor-plugin-indentation 3.1.5 → 3.1.6

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,12 @@
1
1
  # @atlaskit/editor-plugin-indentation
2
2
 
3
+ ## 3.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`417545848d2bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/417545848d2bf) -
8
+ [EDITOR-1153] Make sure that Tab works for range selections for `blockTaskItem`
9
+
3
10
  ## 3.1.5
4
11
 
5
12
  ### Patch Changes
@@ -18,10 +18,18 @@ function keymapPlugin(editorAnalyticsAPI) {
18
18
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
19
19
  (0, _keymaps.findShortcutByKeymap)(_keymaps.indent), function (state, dispatch) {
20
20
  var blockTaskItem = state.schema.nodes.blockTaskItem;
21
-
22
- // Let `editor-plugin-tasks-and-decisions` handle indentation inside blockTaskItems
23
- if ((0, _utils2.hasParentNodeOfType)([blockTaskItem])(state.selection)) {
24
- return false;
21
+ if (blockTaskItem) {
22
+ var hasBlockTaskItem = false;
23
+ // Check if the selection contains a blockTaskItem
24
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
25
+ if (node.type === blockTaskItem) {
26
+ hasBlockTaskItem = true;
27
+ return false; // stop iterating
28
+ }
29
+ });
30
+ if (hasBlockTaskItem) {
31
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
32
+ }
25
33
  }
26
34
  return (0, _editorCommands.getIndentCommand)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch);
27
35
  }, list);
@@ -13,10 +13,18 @@ export function keymapPlugin(editorAnalyticsAPI) {
13
13
  const {
14
14
  blockTaskItem
15
15
  } = state.schema.nodes;
16
-
17
- // Let `editor-plugin-tasks-and-decisions` handle indentation inside blockTaskItems
18
- if (hasParentNodeOfType([blockTaskItem])(state.selection)) {
19
- return false;
16
+ if (blockTaskItem) {
17
+ let hasBlockTaskItem = false;
18
+ // Check if the selection contains a blockTaskItem
19
+ state.doc.nodesBetween(state.selection.from, state.selection.to, node => {
20
+ if (node.type === blockTaskItem) {
21
+ hasBlockTaskItem = true;
22
+ return false; // stop iterating
23
+ }
24
+ });
25
+ if (hasBlockTaskItem) {
26
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
27
+ }
20
28
  }
21
29
  return getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch);
22
30
  }, list);
@@ -11,10 +11,18 @@ export function keymapPlugin(editorAnalyticsAPI) {
11
11
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12
12
  findShortcutByKeymap(indent), function (state, dispatch) {
13
13
  var blockTaskItem = state.schema.nodes.blockTaskItem;
14
-
15
- // Let `editor-plugin-tasks-and-decisions` handle indentation inside blockTaskItems
16
- if (hasParentNodeOfType([blockTaskItem])(state.selection)) {
17
- return false;
14
+ if (blockTaskItem) {
15
+ var hasBlockTaskItem = false;
16
+ // Check if the selection contains a blockTaskItem
17
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
18
+ if (node.type === blockTaskItem) {
19
+ hasBlockTaskItem = true;
20
+ return false; // stop iterating
21
+ }
22
+ });
23
+ if (hasBlockTaskItem) {
24
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
25
+ }
18
26
  }
19
27
  return getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch);
20
28
  }, list);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-indentation",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Indentation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  "@babel/runtime": "^7.0.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@atlaskit/editor-common": "^107.26.0",
39
+ "@atlaskit/editor-common": "^107.27.0",
40
40
  "react": "^18.2.0",
41
41
  "react-dom": "^18.2.0"
42
42
  },