@atlaskit/editor-plugin-block-controls 2.3.0 → 2.3.1

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,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#149764](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149764)
8
+ [`f6226757e21b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f6226757e21b9) -
9
+ Change move left/right shortcut for nested nodes
10
+
3
11
  ## 2.3.0
4
12
 
5
13
  ### Minor Changes
@@ -105,7 +105,9 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
105
105
  moveToPos = $pos.after($pos.depth) + 1;
106
106
  } else if (direction === _consts.DIRECTION.UP) {
107
107
  var nodeBefore = $pos.depth > 1 && nodeIndex === 0 && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_a11y') ? $pos.node($pos.depth) : $pos.nodeBefore;
108
- moveToPos = $pos.depth > 1 && nodeIndex === 0 && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_a11y') ? $pos.before($pos.depth) - 1 : nodeBefore ? currentNodePos - nodeBefore.nodeSize : moveToPos;
108
+ if (nodeBefore) {
109
+ moveToPos = currentNodePos - nodeBefore.nodeSize;
110
+ }
109
111
  } else {
110
112
  var endOfDoc = $pos.end();
111
113
  var nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
@@ -15,10 +15,10 @@ var getNestedNodePosition = exports.getNestedNodePosition = function getNestedNo
15
15
  if ($pos.depth < 1) {
16
16
  return nestedNodePos;
17
17
  }
18
- var parentNodeOfSpecificTypes = (0, _utils.findParentNodeOfType)([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList])(state.selection);
18
+ var parentNodeOfSpecificTypes = (0, _utils.findParentNodeOfType)([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList, state.schema.nodes.decisionList])(state.selection);
19
19
  if (parentNodeOfSpecificTypes) {
20
20
  var parentNodeType = parentNodeOfSpecificTypes.node.type.name;
21
- nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
21
+ nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList', 'decisionList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
22
22
  }
23
23
  } else {
24
24
  nestedNodePos = selection.$from.pos;
@@ -100,7 +100,9 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
100
100
  moveToPos = $pos.after($pos.depth) + 1;
101
101
  } else if (direction === DIRECTION.UP) {
102
102
  const nodeBefore = $pos.depth > 1 && nodeIndex === 0 && fg('platform_editor_element_dnd_nested_a11y') ? $pos.node($pos.depth) : $pos.nodeBefore;
103
- moveToPos = $pos.depth > 1 && nodeIndex === 0 && fg('platform_editor_element_dnd_nested_a11y') ? $pos.before($pos.depth) - 1 : nodeBefore ? currentNodePos - nodeBefore.nodeSize : moveToPos;
103
+ if (nodeBefore) {
104
+ moveToPos = currentNodePos - nodeBefore.nodeSize;
105
+ }
104
106
  } else {
105
107
  const endOfDoc = $pos.end();
106
108
  const nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
@@ -11,10 +11,10 @@ export const getNestedNodePosition = state => {
11
11
  if ($pos.depth < 1) {
12
12
  return nestedNodePos;
13
13
  }
14
- const parentNodeOfSpecificTypes = findParentNodeOfType([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList])(state.selection);
14
+ const parentNodeOfSpecificTypes = findParentNodeOfType([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList, state.schema.nodes.decisionList])(state.selection);
15
15
  if (parentNodeOfSpecificTypes) {
16
16
  const parentNodeType = parentNodeOfSpecificTypes.node.type.name;
17
- nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
17
+ nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList', 'decisionList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
18
18
  }
19
19
  } else {
20
20
  nestedNodePos = selection.$from.pos;
@@ -99,7 +99,9 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
99
99
  moveToPos = $pos.after($pos.depth) + 1;
100
100
  } else if (direction === DIRECTION.UP) {
101
101
  var nodeBefore = $pos.depth > 1 && nodeIndex === 0 && fg('platform_editor_element_dnd_nested_a11y') ? $pos.node($pos.depth) : $pos.nodeBefore;
102
- moveToPos = $pos.depth > 1 && nodeIndex === 0 && fg('platform_editor_element_dnd_nested_a11y') ? $pos.before($pos.depth) - 1 : nodeBefore ? currentNodePos - nodeBefore.nodeSize : moveToPos;
102
+ if (nodeBefore) {
103
+ moveToPos = currentNodePos - nodeBefore.nodeSize;
104
+ }
103
105
  } else {
104
106
  var endOfDoc = $pos.end();
105
107
  var nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
@@ -9,10 +9,10 @@ export var getNestedNodePosition = function getNestedNodePosition(state) {
9
9
  if ($pos.depth < 1) {
10
10
  return nestedNodePos;
11
11
  }
12
- var parentNodeOfSpecificTypes = findParentNodeOfType([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList])(state.selection);
12
+ var parentNodeOfSpecificTypes = findParentNodeOfType([state.schema.nodes.bulletList, state.schema.nodes.orderedList, state.schema.nodes.blockquote, state.schema.nodes.taskList, state.schema.nodes.decisionList])(state.selection);
13
13
  if (parentNodeOfSpecificTypes) {
14
14
  var parentNodeType = parentNodeOfSpecificTypes.node.type.name;
15
- nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
15
+ nestedNodePos = ['bulletList', 'orderedList'].includes(parentNodeType) ? $pos.before($pos.depth - 1) : ['blockquote', 'taskList', 'decisionList'].includes(parentNodeType) ? $pos.before() : nestedNodePos;
16
16
  }
17
17
  } else {
18
18
  nestedNodePos = selection.$from.pos;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",