@atlaskit/editor-plugin-selection 6.1.8 → 6.1.10

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,20 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 6.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b2d4f27035ac9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2d4f27035ac9) -
8
+ [ux] [EDITOR-3095] Follow up bug fix to cleanup platform_editor_fix_list_item_nav_bug_in_layout fg
9
+
10
+ ## 6.1.9
11
+
12
+ ### Patch Changes
13
+
14
+ - [`f1f7fc05afab1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f1f7fc05afab1) -
15
+ [ux] EDITOR-2461 Set selection in expand title when using arrow key to navigate into expand
16
+ - Updated dependencies
17
+
3
18
  ## 6.1.8
4
19
 
5
20
  ### Patch Changes
@@ -7,6 +7,7 @@ exports.createOnKeydown = createOnKeydown;
7
7
  var _expand = require("@atlaskit/editor-common/expand");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
10
11
  /*
11
12
  * The way expand was built, no browser recognize selection on it.
12
13
  * For instance, when a selection going to a "collapsed" expand
@@ -123,6 +124,9 @@ var isNavigatingVerticallyWhenCursorIsInsideInlineNode = function isNavigatingVe
123
124
  return false;
124
125
  }
125
126
  var isNavigatingInlineNodeDownward = event.key === 'ArrowDown' && Boolean((_selection$$cursor$no3 = selection.$cursor.nodeBefore) === null || _selection$$cursor$no3 === void 0 ? void 0 : _selection$$cursor$no3.isInline) && Boolean((_selection$$cursor$no4 = selection.$cursor.nodeAfter) === null || _selection$$cursor$no4 === void 0 ? void 0 : _selection$$cursor$no4.isInline);
127
+ if (isNavigatingInlineNodeDownward && (0, _expand.getNextNodeExpandPos)(view, selection) !== undefined && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
128
+ return false;
129
+ }
126
130
  return isNavigatingInlineNodeDownward;
127
131
  };
128
132
  function createOnKeydown(_ref4) {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectionAtEndOfLayoutColumn = exports.isSelectableContainerNode = exports.isSelectableChildNode = exports.isListItemWithinContainerNotAtEnd = exports.isLayoutColumnNode = exports.isContainerNode = exports.getNodesToDecorateFromSelection = exports.getDecorations = exports.findTopLevelList = exports.findSelectableContainerParent = exports.findSelectableContainerBefore = exports.findSelectableContainerAfter = exports.findLastChildNodeToSelect = exports.findFirstChildNodeToSelect = void 0;
7
+ exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectionAtEndOfLayoutColumn = exports.isSelectableContainerNode = exports.isSelectableChildNode = exports.isPanelOrExpandNode = exports.isListItemWithinContainerNotAtEnd = exports.isLayoutColumnNode = exports.isContainerNode = exports.getNodesToDecorateFromSelection = exports.getDecorations = exports.findTopLevelList = exports.findSelectableContainerParent = exports.findSelectableContainerBefore = exports.findSelectableContainerAfter = exports.findLastChildNodeToSelect = exports.findFirstChildNodeToSelect = void 0;
8
8
  exports.shouldRecalcDecorations = shouldRecalcDecorations;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _selection = require("@atlaskit/editor-common/selection");
@@ -362,6 +362,10 @@ var isSelectionAtEndOfLayoutColumn = exports.isSelectionAtEndOfLayoutColumn = fu
362
362
  if (!layoutColumnParent) {
363
363
  return false;
364
364
  }
365
+ var panelOrExpandParent = (0, _utils2.findParentNodeClosestToPos)($pos, isPanelOrExpandNode);
366
+ if (panelOrExpandParent && panelOrExpandParent.pos > layoutColumnParent.pos && (0, _platformFeatureFlags.fg)('platform_editor_fix_list_item_nav_bug_in_layout')) {
367
+ return false;
368
+ }
365
369
  var grandParentDepth = $pos.depth - 1;
366
370
  if (grandParentDepth < 0) {
367
371
  return false;
@@ -384,4 +388,11 @@ var isLayoutColumnNode = exports.isLayoutColumnNode = function isLayoutColumnNod
384
388
  var _ref4 = (node === null || node === void 0 || (_node$type2 = node.type) === null || _node$type2 === void 0 || (_node$type2 = _node$type2.schema) === null || _node$type2 === void 0 ? void 0 : _node$type2.nodes) || {},
385
389
  layoutColumn = _ref4.layoutColumn;
386
390
  return Boolean(node && node.type && node.type === layoutColumn);
391
+ };
392
+ var isPanelOrExpandNode = exports.isPanelOrExpandNode = function isPanelOrExpandNode(node) {
393
+ var _node$type3;
394
+ var _ref5 = (node === null || node === void 0 || (_node$type3 = node.type) === null || _node$type3 === void 0 || (_node$type3 = _node$type3.schema) === null || _node$type3 === void 0 ? void 0 : _node$type3.nodes) || {},
395
+ panel = _ref5.panel,
396
+ expand = _ref5.expand;
397
+ return Boolean(node && node.type && (node.type === panel || node.type === expand));
387
398
  };
@@ -1,6 +1,7 @@
1
- import { expandedState } from '@atlaskit/editor-common/expand';
1
+ import { expandedState, getNextNodeExpandPos } from '@atlaskit/editor-common/expand';
2
2
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
5
 
5
6
  /*
6
7
  * The way expand was built, no browser recognize selection on it.
@@ -121,6 +122,9 @@ const isNavigatingVerticallyWhenCursorIsInsideInlineNode = (view, event) => {
121
122
  return false;
122
123
  }
123
124
  const isNavigatingInlineNodeDownward = event.key === 'ArrowDown' && Boolean((_selection$$cursor$no3 = selection.$cursor.nodeBefore) === null || _selection$$cursor$no3 === void 0 ? void 0 : _selection$$cursor$no3.isInline) && Boolean((_selection$$cursor$no4 = selection.$cursor.nodeAfter) === null || _selection$$cursor$no4 === void 0 ? void 0 : _selection$$cursor$no4.isInline);
125
+ if (isNavigatingInlineNodeDownward && getNextNodeExpandPos(view, selection) !== undefined && expValEqualsNoExposure('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
126
+ return false;
127
+ }
124
128
  return isNavigatingInlineNodeDownward;
125
129
  };
126
130
  export function createOnKeydown({
@@ -351,6 +351,10 @@ export const isSelectionAtEndOfLayoutColumn = $pos => {
351
351
  if (!layoutColumnParent) {
352
352
  return false;
353
353
  }
354
+ const panelOrExpandParent = findParentNodeClosestToPos($pos, isPanelOrExpandNode);
355
+ if (panelOrExpandParent && panelOrExpandParent.pos > layoutColumnParent.pos && fg('platform_editor_fix_list_item_nav_bug_in_layout')) {
356
+ return false;
357
+ }
354
358
  const grandParentDepth = $pos.depth - 1;
355
359
  if (grandParentDepth < 0) {
356
360
  return false;
@@ -376,4 +380,12 @@ export const isLayoutColumnNode = node => {
376
380
  layoutColumn
377
381
  } = (node === null || node === void 0 ? void 0 : (_node$type2 = node.type) === null || _node$type2 === void 0 ? void 0 : (_node$type2$schema = _node$type2.schema) === null || _node$type2$schema === void 0 ? void 0 : _node$type2$schema.nodes) || {};
378
382
  return Boolean(node && node.type && node.type === layoutColumn);
383
+ };
384
+ export const isPanelOrExpandNode = node => {
385
+ var _node$type3, _node$type3$schema;
386
+ const {
387
+ panel,
388
+ expand
389
+ } = (node === null || node === void 0 ? void 0 : (_node$type3 = node.type) === null || _node$type3 === void 0 ? void 0 : (_node$type3$schema = _node$type3.schema) === null || _node$type3$schema === void 0 ? void 0 : _node$type3$schema.nodes) || {};
390
+ return Boolean(node && node.type && (node.type === panel || node.type === expand));
379
391
  };
@@ -1,6 +1,7 @@
1
- import { expandedState } from '@atlaskit/editor-common/expand';
1
+ import { expandedState, getNextNodeExpandPos } from '@atlaskit/editor-common/expand';
2
2
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
5
 
5
6
  /*
6
7
  * The way expand was built, no browser recognize selection on it.
@@ -118,6 +119,9 @@ var isNavigatingVerticallyWhenCursorIsInsideInlineNode = function isNavigatingVe
118
119
  return false;
119
120
  }
120
121
  var isNavigatingInlineNodeDownward = event.key === 'ArrowDown' && Boolean((_selection$$cursor$no3 = selection.$cursor.nodeBefore) === null || _selection$$cursor$no3 === void 0 ? void 0 : _selection$$cursor$no3.isInline) && Boolean((_selection$$cursor$no4 = selection.$cursor.nodeAfter) === null || _selection$$cursor$no4 === void 0 ? void 0 : _selection$$cursor$no4.isInline);
122
+ if (isNavigatingInlineNodeDownward && getNextNodeExpandPos(view, selection) !== undefined && expValEqualsNoExposure('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
123
+ return false;
124
+ }
121
125
  return isNavigatingInlineNodeDownward;
122
126
  };
123
127
  export function createOnKeydown(_ref4) {
@@ -354,6 +354,10 @@ export var isSelectionAtEndOfLayoutColumn = function isSelectionAtEndOfLayoutCol
354
354
  if (!layoutColumnParent) {
355
355
  return false;
356
356
  }
357
+ var panelOrExpandParent = findParentNodeClosestToPos($pos, isPanelOrExpandNode);
358
+ if (panelOrExpandParent && panelOrExpandParent.pos > layoutColumnParent.pos && fg('platform_editor_fix_list_item_nav_bug_in_layout')) {
359
+ return false;
360
+ }
357
361
  var grandParentDepth = $pos.depth - 1;
358
362
  if (grandParentDepth < 0) {
359
363
  return false;
@@ -376,4 +380,11 @@ export var isLayoutColumnNode = function isLayoutColumnNode(node) {
376
380
  var _ref4 = (node === null || node === void 0 || (_node$type2 = node.type) === null || _node$type2 === void 0 || (_node$type2 = _node$type2.schema) === null || _node$type2 === void 0 ? void 0 : _node$type2.nodes) || {},
377
381
  layoutColumn = _ref4.layoutColumn;
378
382
  return Boolean(node && node.type && node.type === layoutColumn);
383
+ };
384
+ export var isPanelOrExpandNode = function isPanelOrExpandNode(node) {
385
+ var _node$type3;
386
+ var _ref5 = (node === null || node === void 0 || (_node$type3 = node.type) === null || _node$type3 === void 0 || (_node$type3 = _node$type3.schema) === null || _node$type3 === void 0 ? void 0 : _node$type3.nodes) || {},
387
+ panel = _ref5.panel,
388
+ expand = _ref5.expand;
389
+ return Boolean(node && node.type && (node.type === panel || node.type === expand));
379
390
  };
@@ -84,3 +84,4 @@ export declare const isSelectionAtEndOfLayoutColumn: ($pos: ResolvedPos) => bool
84
84
  * Determines if the given node is a LayoutColumn node.
85
85
  */
86
86
  export declare const isLayoutColumnNode: (node: PmNode | null | undefined) => boolean;
87
+ export declare const isPanelOrExpandNode: (node: PmNode | null | undefined) => boolean;
@@ -84,3 +84,4 @@ export declare const isSelectionAtEndOfLayoutColumn: ($pos: ResolvedPos) => bool
84
84
  * Determines if the given node is a LayoutColumn node.
85
85
  */
86
86
  export declare const isLayoutColumnNode: (node: PmNode | null | undefined) => boolean;
87
+ export declare const isPanelOrExpandNode: (node: PmNode | null | undefined) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "6.1.8",
3
+ "version": "6.1.10",
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.10.0",
26
26
  "@atlaskit/editor-tables": "^2.9.0",
27
27
  "@atlaskit/platform-feature-flags": "^1.1.0",
28
- "@atlaskit/tmp-editor-statsig": "^14.6.0",
28
+ "@atlaskit/tmp-editor-statsig": "^14.7.0",
29
29
  "@atlaskit/tokens": "^8.4.0",
30
30
  "@babel/runtime": "^7.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@atlaskit/editor-common": "^110.38.0",
33
+ "@atlaskit/editor-common": "^110.39.0",
34
34
  "react": "^18.2.0"
35
35
  },
36
36
  "techstack": {