@atlaskit/editor-plugin-indentation 3.1.6 → 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,19 @@
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
+
3
17
  ## 3.1.6
4
18
 
5
19
  ### Patch Changes
@@ -17,17 +17,24 @@ 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;
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;
21
24
  if (blockTaskItem) {
22
25
  var hasBlockTaskItem = false;
26
+ var hasParagraphAtDocLevel = false;
23
27
  // Check if the selection contains a blockTaskItem
24
- state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
28
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
25
29
  if (node.type === blockTaskItem) {
26
30
  hasBlockTaskItem = true;
27
31
  return false; // stop iterating
28
32
  }
33
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
34
+ hasParagraphAtDocLevel = true;
35
+ }
29
36
  });
30
- if (hasBlockTaskItem) {
37
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
31
38
  return false; // let `editor-plugin-tasks-and-decisions` handle indentation
32
39
  }
33
40
  }
@@ -11,18 +11,24 @@ 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
18
  if (blockTaskItem) {
17
19
  let hasBlockTaskItem = false;
20
+ let hasParagraphAtDocLevel = false;
18
21
  // Check if the selection contains a blockTaskItem
19
- state.doc.nodesBetween(state.selection.from, state.selection.to, node => {
22
+ state.doc.nodesBetween(state.selection.from, state.selection.to, (node, _pos, parent) => {
20
23
  if (node.type === blockTaskItem) {
21
24
  hasBlockTaskItem = true;
22
25
  return false; // stop iterating
23
26
  }
27
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
28
+ hasParagraphAtDocLevel = true;
29
+ }
24
30
  });
25
- if (hasBlockTaskItem) {
31
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
26
32
  return false; // let `editor-plugin-tasks-and-decisions` handle indentation
27
33
  }
28
34
  }
@@ -10,17 +10,24 @@ 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;
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;
14
17
  if (blockTaskItem) {
15
18
  var hasBlockTaskItem = false;
19
+ var hasParagraphAtDocLevel = false;
16
20
  // Check if the selection contains a blockTaskItem
17
- state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
21
+ state.doc.nodesBetween(state.selection.from, state.selection.to, function (node, _pos, parent) {
18
22
  if (node.type === blockTaskItem) {
19
23
  hasBlockTaskItem = true;
20
24
  return false; // stop iterating
21
25
  }
26
+ if (node.type === paragraph && (parent === null || parent === void 0 ? void 0 : parent.type) === doc) {
27
+ hasParagraphAtDocLevel = true;
28
+ }
22
29
  });
23
- if (hasBlockTaskItem) {
30
+ if (hasBlockTaskItem && !hasParagraphAtDocLevel) {
24
31
  return false; // let `editor-plugin-tasks-and-decisions` handle indentation
25
32
  }
26
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-indentation",
3
- "version": "3.1.6",
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.27.0",
39
+ "@atlaskit/editor-common": "^107.28.0",
40
40
  "react": "^18.2.0",
41
41
  "react-dom": "^18.2.0"
42
42
  },