@atlaskit/editor-plugin-indentation 3.1.5 → 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,26 @@
1
1
  # @atlaskit/editor-plugin-indentation
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d2a535bed291e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2a535bed291e) -
8
+ [EDITOR-1153] Let the `editor-plugin-indentation` handle `paragraphs` when they are selected in a
9
+ range with `blockTaskItem`, but don't indent the `paragraphs` inside `blockTaskItem`s
10
+
11
+ ### Patch Changes
12
+
13
+ - [`d2a535bed291e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2a535bed291e) -
14
+ [EDITOR-1153] Make sure that Tab works for range selections for `blockTaskItem`
15
+ - Updated dependencies
16
+
17
+ ## 3.1.6
18
+
19
+ ### Patch Changes
20
+
21
+ - [`417545848d2bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/417545848d2bf) -
22
+ [EDITOR-1153] Make sure that Tab works for range selections for `blockTaskItem`
23
+
3
24
  ## 3.1.5
4
25
 
5
26
  ### Patch Changes
@@ -17,11 +17,26 @@ function keymapPlugin(editorAnalyticsAPI) {
17
17
  // Ignored via go/ees005
18
18
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
19
19
  (0, _keymaps.findShortcutByKeymap)(_keymaps.indent), function (state, dispatch) {
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;
20
+ var _state$schema$nodes = state.schema.nodes,
21
+ blockTaskItem = _state$schema$nodes.blockTaskItem,
22
+ paragraph = _state$schema$nodes.paragraph,
23
+ doc = _state$schema$nodes.doc;
24
+ if (blockTaskItem) {
25
+ var hasBlockTaskItem = false;
26
+ var hasParagraphAtDocLevel = false;
27
+ // Check if the selection contains a blockTaskItem
28
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
29
+ if (node.type === blockTaskItem) {
30
+ hasBlockTaskItem = true;
31
+ return false; // stop iterating
32
+ }
33
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
34
+ hasParagraphAtDocLevel = true;
35
+ }
36
+ });
37
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
38
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
39
+ }
25
40
  }
26
41
  return (0, _editorCommands.getIndentCommand)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch);
27
42
  }, list);
@@ -11,12 +11,26 @@ export function keymapPlugin(editorAnalyticsAPI) {
11
11
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12
12
  findShortcutByKeymap(indent), (state, dispatch) => {
13
13
  const {
14
- blockTaskItem
14
+ blockTaskItem,
15
+ paragraph,
16
+ doc
15
17
  } = state.schema.nodes;
16
-
17
- // Let `editor-plugin-tasks-and-decisions` handle indentation inside blockTaskItems
18
- if (hasParentNodeOfType([blockTaskItem])(state.selection)) {
19
- return false;
18
+ if (blockTaskItem) {
19
+ let hasBlockTaskItem = false;
20
+ let hasParagraphAtDocLevel = false;
21
+ // Check if the selection contains a blockTaskItem
22
+ state.doc.nodesBetween(state.selection.from, state.selection.to, (node, _pos, parent) => {
23
+ if (node.type === blockTaskItem) {
24
+ hasBlockTaskItem = true;
25
+ return false; // stop iterating
26
+ }
27
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
28
+ hasParagraphAtDocLevel = true;
29
+ }
30
+ });
31
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
32
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
33
+ }
20
34
  }
21
35
  return getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch);
22
36
  }, list);
@@ -10,11 +10,26 @@ export function keymapPlugin(editorAnalyticsAPI) {
10
10
  // Ignored via go/ees005
11
11
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12
12
  findShortcutByKeymap(indent), function (state, dispatch) {
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;
13
+ var _state$schema$nodes = state.schema.nodes,
14
+ blockTaskItem = _state$schema$nodes.blockTaskItem,
15
+ paragraph = _state$schema$nodes.paragraph,
16
+ doc = _state$schema$nodes.doc;
17
+ if (blockTaskItem) {
18
+ var hasBlockTaskItem = false;
19
+ var hasParagraphAtDocLevel = false;
20
+ // Check if the selection contains a blockTaskItem
21
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
22
+ if (node.type === blockTaskItem) {
23
+ hasBlockTaskItem = true;
24
+ return false; // stop iterating
25
+ }
26
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
27
+ hasParagraphAtDocLevel = true;
28
+ }
29
+ });
30
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
31
+ return false; // let `editor-plugin-tasks-and-decisions` handle indentation
32
+ }
18
33
  }
19
34
  return getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch);
20
35
  }, 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.2.0",
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.28.0",
40
40
  "react": "^18.2.0",
41
41
  "react-dom": "^18.2.0"
42
42
  },