@atlaskit/editor-plugin-selection 2.1.3 → 2.1.4

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,14 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#132086](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132086)
8
+ [`0c61b5cc7a789`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c61b5cc7a789) -
9
+ [ux] ED-27255 Fix bug which prevented the gap cursor from appearing sometimes when a table is
10
+ nested in another table, layout or expand
11
+
3
12
  ## 2.1.3
4
13
 
5
14
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.toDOM = void 0;
8
8
  var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
9
9
  var _selection = require("@atlaskit/editor-common/selection");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _utils = require("../utils");
11
12
  /**
12
13
  * We have a couple of nodes that require us to compute style
@@ -90,7 +91,10 @@ var toDOM = exports.toDOM = function toDOM(view, getPos) {
90
91
  if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
91
92
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
92
93
  }
93
- if (layoutMode) {
94
+
95
+ // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
96
+ var isNestedTable = (0, _platformFeatureFlags.fg)('platform_editor_nested_tables_gap_cursor') ? (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0 : false;
97
+ if (layoutMode && !isNestedTable) {
94
98
  gapCursor.setAttribute('layout', layoutMode);
95
99
  var breakoutModeStyle = (0, _utils.getComputedStyleForLayoutMode)(dom, node, style);
96
100
  gapCursor.style.width = "".concat(measureWidth(breakoutModeStyle), "px");
@@ -1,4 +1,5 @@
1
1
  import { Side } from '@atlaskit/editor-common/selection';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { getComputedStyleForLayoutMode, getLayoutModeFromTargetNode, isLeftCursor } from '../utils';
3
4
 
4
5
  /**
@@ -81,7 +82,10 @@ export const toDOM = (view, getPos) => {
81
82
  if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
82
83
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
83
84
  }
84
- if (layoutMode) {
85
+
86
+ // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
87
+ const isNestedTable = fg('platform_editor_nested_tables_gap_cursor') ? (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0 : false;
88
+ if (layoutMode && !isNestedTable) {
85
89
  gapCursor.setAttribute('layout', layoutMode);
86
90
  const breakoutModeStyle = getComputedStyleForLayoutMode(dom, node, style);
87
91
  gapCursor.style.width = `${measureWidth(breakoutModeStyle)}px`;
@@ -1,5 +1,6 @@
1
1
  import _toArray from "@babel/runtime/helpers/toArray";
2
2
  import { Side } from '@atlaskit/editor-common/selection';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { getComputedStyleForLayoutMode, getLayoutModeFromTargetNode, isLeftCursor } from '../utils';
4
5
 
5
6
  /**
@@ -84,7 +85,10 @@ export var toDOM = function toDOM(view, getPos) {
84
85
  if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
85
86
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
86
87
  }
87
- if (layoutMode) {
88
+
89
+ // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
90
+ var isNestedTable = fg('platform_editor_nested_tables_gap_cursor') ? (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0 : false;
91
+ if (layoutMode && !isNestedTable) {
88
92
  gapCursor.setAttribute('layout', layoutMode);
89
93
  var breakoutModeStyle = getComputedStyleForLayoutMode(dom, node, style);
90
94
  gapCursor.style.width = "".concat(measureWidth(breakoutModeStyle), "px");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -92,6 +92,9 @@
92
92
  },
93
93
  "platform_editor_lcm_inline_node_selection_fix": {
94
94
  "type": "boolean"
95
+ },
96
+ "platform_editor_nested_tables_gap_cursor": {
97
+ "type": "boolean"
95
98
  }
96
99
  }
97
100
  }