@atlaskit/editor-plugin-selection 10.1.4 → 10.1.5
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 +8 -0
- package/dist/cjs/pm-plugins/gap-cursor/utils/place-gap-cursor.js +2 -1
- package/dist/cjs/pm-plugins/utils.js +8 -3
- package/dist/es2019/pm-plugins/utils.js +9 -4
- package/dist/esm/pm-plugins/gap-cursor/utils/place-gap-cursor.js +2 -1
- package/dist/esm/pm-plugins/utils.js +9 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 10.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cd85cdec5ae7e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd85cdec5ae7e) -
|
|
8
|
+
EDITOR-7170 add transform for panel -> panel_c1
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 10.1.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -8,6 +8,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
10
|
var _utils = require("../utils");
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
12
|
/**
|
|
12
13
|
* We have a couple of nodes that require us to compute style
|
|
13
14
|
* on different elements, ideally all nodes should be able to
|
|
@@ -42,7 +43,7 @@ var measureWidth = function measureWidth(style) {
|
|
|
42
43
|
var measureValue = function measureValue(style, measureValues) {
|
|
43
44
|
var _measureValues = (0, _toArray2.default)(measureValues),
|
|
44
45
|
base = _measureValues[0],
|
|
45
|
-
contentBoxValues = _measureValues.slice(1);
|
|
46
|
+
contentBoxValues = _arrayLikeToArray(_measureValues).slice(1);
|
|
46
47
|
var measures = [style.getPropertyValue(base)];
|
|
47
48
|
var boxSizing = style.getPropertyValue('box-sizing');
|
|
48
49
|
if (boxSizing === 'content-box') {
|
|
@@ -13,6 +13,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
13
13
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
18
|
var _types = require("../types");
|
|
18
19
|
var _hideCursorDecoration = require("./cursor/ui/hide-cursor-decoration");
|
|
@@ -80,7 +81,8 @@ var getNodesToDecorateFromSelection = exports.getNodesToDecorateFromSelection =
|
|
|
80
81
|
// selection styles. I couldn’t see a clear way to differentiate
|
|
81
82
|
// without explicitly stating which nodes should be traversed
|
|
82
83
|
// and which shouldn’t.
|
|
83
|
-
var
|
|
84
|
+
var nodeTypeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils.getBaseNodeTypeName)(node.type) : node.type.name;
|
|
85
|
+
var isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(nodeTypeName);
|
|
84
86
|
// If the node is a top-level block node and completely sits within
|
|
85
87
|
// the selection, we do not recurse it's children to prevent selection
|
|
86
88
|
// styles being added to its child nodes. The expected behaviour
|
|
@@ -334,8 +336,10 @@ var isContainerNode = exports.isContainerNode = function isContainerNode(node) {
|
|
|
334
336
|
var _ref3 = (node === null || node === void 0 || (_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.schema) === null || _node$type === void 0 ? void 0 : _node$type.nodes) || {},
|
|
335
337
|
layoutColumn = _ref3.layoutColumn,
|
|
336
338
|
panel = _ref3.panel,
|
|
339
|
+
panel_c1 = _ref3.panel_c1,
|
|
337
340
|
expand = _ref3.expand;
|
|
338
|
-
|
|
341
|
+
var containerNodes = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? [panel, panel_c1, expand, layoutColumn] : [panel, expand, layoutColumn];
|
|
342
|
+
return Boolean(node && node.type && containerNodes.includes(node.type));
|
|
339
343
|
};
|
|
340
344
|
|
|
341
345
|
/**
|
|
@@ -391,6 +395,7 @@ var isPanelOrExpandNode = exports.isPanelOrExpandNode = function isPanelOrExpand
|
|
|
391
395
|
var _node$type3;
|
|
392
396
|
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) || {},
|
|
393
397
|
panel = _ref5.panel,
|
|
398
|
+
panel_c1 = _ref5.panel_c1,
|
|
394
399
|
expand = _ref5.expand;
|
|
395
|
-
return Boolean(node && node.type && (node.type === panel || node.type === expand));
|
|
400
|
+
return Boolean(node && node.type && (node.type === panel || (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) && node.type === panel_c1 || node.type === expand));
|
|
396
401
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
2
|
-
import { isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { getBaseNodeTypeName, isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNode, findParentNodeClosestToPos, flatten, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import { selectionPluginKey } from '../types';
|
|
9
10
|
import { createHideCursorDecoration } from './cursor/ui/hide-cursor-decoration';
|
|
@@ -74,7 +75,8 @@ export const getNodesToDecorateFromSelection = (selection, doc) => {
|
|
|
74
75
|
// selection styles. I couldn’t see a clear way to differentiate
|
|
75
76
|
// without explicitly stating which nodes should be traversed
|
|
76
77
|
// and which shouldn’t.
|
|
77
|
-
const
|
|
78
|
+
const nodeTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(node.type) : node.type.name;
|
|
79
|
+
const isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(nodeTypeName);
|
|
78
80
|
// If the node is a top-level block node and completely sits within
|
|
79
81
|
// the selection, we do not recurse it's children to prevent selection
|
|
80
82
|
// styles being added to its child nodes. The expected behaviour
|
|
@@ -321,9 +323,11 @@ export const isContainerNode = node => {
|
|
|
321
323
|
const {
|
|
322
324
|
layoutColumn,
|
|
323
325
|
panel,
|
|
326
|
+
panel_c1,
|
|
324
327
|
expand
|
|
325
328
|
} = (node === null || node === void 0 ? void 0 : (_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$schema = _node$type.schema) === null || _node$type$schema === void 0 ? void 0 : _node$type$schema.nodes) || {};
|
|
326
|
-
|
|
329
|
+
const containerNodes = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? [panel, panel_c1, expand, layoutColumn] : [panel, expand, layoutColumn];
|
|
330
|
+
return Boolean(node && node.type && containerNodes.includes(node.type));
|
|
327
331
|
};
|
|
328
332
|
|
|
329
333
|
/**
|
|
@@ -381,7 +385,8 @@ export const isPanelOrExpandNode = node => {
|
|
|
381
385
|
var _node$type3, _node$type3$schema;
|
|
382
386
|
const {
|
|
383
387
|
panel,
|
|
388
|
+
panel_c1,
|
|
384
389
|
expand
|
|
385
390
|
} = (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) || {};
|
|
386
|
-
return Boolean(node && node.type && (node.type === panel || node.type === expand));
|
|
391
|
+
return Boolean(node && node.type && (node.type === panel || expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) && node.type === panel_c1 || node.type === expand));
|
|
387
392
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toArray from "@babel/runtime/helpers/toArray";
|
|
2
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2
3
|
import { Side } from '@atlaskit/editor-common/selection';
|
|
3
4
|
import { getComputedStyleForLayoutMode, getLayoutModeFromTargetNode, isLeftCursor } from '../utils';
|
|
4
5
|
|
|
@@ -36,7 +37,7 @@ var measureWidth = function measureWidth(style) {
|
|
|
36
37
|
var measureValue = function measureValue(style, measureValues) {
|
|
37
38
|
var _measureValues = _toArray(measureValues),
|
|
38
39
|
base = _measureValues[0],
|
|
39
|
-
contentBoxValues = _measureValues.slice(1);
|
|
40
|
+
contentBoxValues = _arrayLikeToArray(_measureValues).slice(1);
|
|
40
41
|
var measures = [style.getPropertyValue(base)];
|
|
41
42
|
var boxSizing = style.getPropertyValue('box-sizing');
|
|
42
43
|
if (boxSizing === 'content-box') {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import { isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { getBaseNodeTypeName, isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { findParentNode, findParentNodeClosestToPos, flatten, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { selectionPluginKey } from '../types';
|
|
10
11
|
import { createHideCursorDecoration } from './cursor/ui/hide-cursor-decoration';
|
|
@@ -72,7 +73,8 @@ export var getNodesToDecorateFromSelection = function getNodesToDecorateFromSele
|
|
|
72
73
|
// selection styles. I couldn’t see a clear way to differentiate
|
|
73
74
|
// without explicitly stating which nodes should be traversed
|
|
74
75
|
// and which shouldn’t.
|
|
75
|
-
var
|
|
76
|
+
var nodeTypeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(node.type) : node.type.name;
|
|
77
|
+
var isTopLevelNodeThatHasSelectionStyles = topLevelBlockNodesThatHaveSelectionStyles.includes(nodeTypeName);
|
|
76
78
|
// If the node is a top-level block node and completely sits within
|
|
77
79
|
// the selection, we do not recurse it's children to prevent selection
|
|
78
80
|
// styles being added to its child nodes. The expected behaviour
|
|
@@ -326,8 +328,10 @@ export var isContainerNode = function isContainerNode(node) {
|
|
|
326
328
|
var _ref3 = (node === null || node === void 0 || (_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.schema) === null || _node$type === void 0 ? void 0 : _node$type.nodes) || {},
|
|
327
329
|
layoutColumn = _ref3.layoutColumn,
|
|
328
330
|
panel = _ref3.panel,
|
|
331
|
+
panel_c1 = _ref3.panel_c1,
|
|
329
332
|
expand = _ref3.expand;
|
|
330
|
-
|
|
333
|
+
var containerNodes = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? [panel, panel_c1, expand, layoutColumn] : [panel, expand, layoutColumn];
|
|
334
|
+
return Boolean(node && node.type && containerNodes.includes(node.type));
|
|
331
335
|
};
|
|
332
336
|
|
|
333
337
|
/**
|
|
@@ -383,6 +387,7 @@ export var isPanelOrExpandNode = function isPanelOrExpandNode(node) {
|
|
|
383
387
|
var _node$type3;
|
|
384
388
|
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) || {},
|
|
385
389
|
panel = _ref5.panel,
|
|
390
|
+
panel_c1 = _ref5.panel_c1,
|
|
386
391
|
expand = _ref5.expand;
|
|
387
|
-
return Boolean(node && node.type && (node.type === panel || node.type === expand));
|
|
392
|
+
return Boolean(node && node.type && (node.type === panel || expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) && node.type === panel_c1 || node.type === expand));
|
|
388
393
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.5",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"singleton": true
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/editor-json-transformer": "^8.
|
|
22
|
+
"@atlaskit/editor-json-transformer": "^8.33.0",
|
|
23
23
|
"@atlaskit/editor-plugin-interaction": "^19.1.0",
|
|
24
24
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
25
25
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
26
26
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
27
27
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
28
|
-
"@atlaskit/tmp-editor-statsig": "^84.
|
|
28
|
+
"@atlaskit/tmp-editor-statsig": "^84.3.0",
|
|
29
29
|
"@atlaskit/tokens": "^13.0.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@atlaskit/editor-common": "^114.
|
|
33
|
+
"@atlaskit/editor-common": "^114.49.0",
|
|
34
34
|
"react": "^18.2.0"
|
|
35
35
|
},
|
|
36
36
|
"techstack": {
|