@atlaskit/editor-plugin-selection 3.0.2 → 3.0.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,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 3.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#184963](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/184963)
|
|
14
|
+
[`f6b81506eb05b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f6b81506eb05b) -
|
|
15
|
+
[ux][ED-25230] Bug fix: inability to navigate between layout columns using arrow keys
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.0.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectableContainerNode = exports.isSelectableChildNode = exports.isListItemWithinContainerNotAtEnd = exports.isContainerNode = exports.getNodesToDecorateFromSelection = exports.getDecorations = exports.findTopLevelList = exports.findSelectableContainerParent = exports.findSelectableContainerBefore = exports.findSelectableContainerAfter = exports.findLastChildNodeToSelect = exports.findFirstChildNodeToSelect = void 0;
|
|
6
|
+
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
7
|
exports.shouldRecalcDecorations = shouldRecalcDecorations;
|
|
8
8
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -265,6 +265,11 @@ var isSelectionAtEndOfParentNode = exports.isSelectionAtEndOfParentNode = functi
|
|
|
265
265
|
return false;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
// Handle layout columns: if another node follows, not at end
|
|
269
|
+
if (isSelectionAtEndOfLayoutColumn($pos) && (0, _platformFeatureFlags.fg)('platform_editor_fix_right_arrow_nav_bug_in_layout')) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
268
273
|
// Default: if at end of parent's parent
|
|
269
274
|
var $after = $pos.doc.resolve($pos.after());
|
|
270
275
|
return $after.parent.content.size === $after.parentOffset;
|
|
@@ -338,4 +343,33 @@ var findTopLevelList = exports.findTopLevelList = function findTopLevelList(pos)
|
|
|
338
343
|
currentDepth--;
|
|
339
344
|
}
|
|
340
345
|
return topLevelList;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Determines whether the current selection position is at the end of a layout column node.
|
|
350
|
+
*/
|
|
351
|
+
var isSelectionAtEndOfLayoutColumn = exports.isSelectionAtEndOfLayoutColumn = function isSelectionAtEndOfLayoutColumn($pos) {
|
|
352
|
+
var layoutColumnParent = (0, _utils2.findParentNodeClosestToPos)($pos, isLayoutColumnNode);
|
|
353
|
+
if (!layoutColumnParent) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
var grandParentDepth = $pos.depth - 1;
|
|
357
|
+
if (grandParentDepth < 0) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
var layoutColumn = $pos.doc.type.schema.nodes.layoutColumn;
|
|
361
|
+
var grandParent = $pos.node(grandParentDepth);
|
|
362
|
+
var afterPos = layoutColumnParent.pos + layoutColumnParent.node.nodeSize;
|
|
363
|
+
var $after = $pos.doc.resolve(afterPos);
|
|
364
|
+
return Boolean($after.nodeAfter) && grandParent.type === layoutColumn;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Determines if the given node is a LayoutColumn node.
|
|
369
|
+
*/
|
|
370
|
+
var isLayoutColumnNode = exports.isLayoutColumnNode = function isLayoutColumnNode(node) {
|
|
371
|
+
var _node$type2;
|
|
372
|
+
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) || {},
|
|
373
|
+
layoutColumn = _ref4.layoutColumn;
|
|
374
|
+
return Boolean(node && node.type && node.type === layoutColumn);
|
|
341
375
|
};
|
|
@@ -254,6 +254,11 @@ export const isSelectionAtEndOfParentNode = ($pos, selection) => {
|
|
|
254
254
|
return false;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
// Handle layout columns: if another node follows, not at end
|
|
258
|
+
if (isSelectionAtEndOfLayoutColumn($pos) && fg('platform_editor_fix_right_arrow_nav_bug_in_layout')) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
257
262
|
// Default: if at end of parent's parent
|
|
258
263
|
const $after = $pos.doc.resolve($pos.after());
|
|
259
264
|
return $after.parent.content.size === $after.parentOffset;
|
|
@@ -329,4 +334,36 @@ export const findTopLevelList = pos => {
|
|
|
329
334
|
currentDepth--;
|
|
330
335
|
}
|
|
331
336
|
return topLevelList;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Determines whether the current selection position is at the end of a layout column node.
|
|
341
|
+
*/
|
|
342
|
+
export const isSelectionAtEndOfLayoutColumn = $pos => {
|
|
343
|
+
const layoutColumnParent = findParentNodeClosestToPos($pos, isLayoutColumnNode);
|
|
344
|
+
if (!layoutColumnParent) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
const grandParentDepth = $pos.depth - 1;
|
|
348
|
+
if (grandParentDepth < 0) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
const {
|
|
352
|
+
layoutColumn
|
|
353
|
+
} = $pos.doc.type.schema.nodes;
|
|
354
|
+
const grandParent = $pos.node(grandParentDepth);
|
|
355
|
+
const afterPos = layoutColumnParent.pos + layoutColumnParent.node.nodeSize;
|
|
356
|
+
const $after = $pos.doc.resolve(afterPos);
|
|
357
|
+
return Boolean($after.nodeAfter) && grandParent.type === layoutColumn;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Determines if the given node is a LayoutColumn node.
|
|
362
|
+
*/
|
|
363
|
+
export const isLayoutColumnNode = node => {
|
|
364
|
+
var _node$type2, _node$type2$schema;
|
|
365
|
+
const {
|
|
366
|
+
layoutColumn
|
|
367
|
+
} = (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) || {};
|
|
368
|
+
return Boolean(node && node.type && node.type === layoutColumn);
|
|
332
369
|
};
|
|
@@ -258,6 +258,11 @@ export var isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode(
|
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
// Handle layout columns: if another node follows, not at end
|
|
262
|
+
if (isSelectionAtEndOfLayoutColumn($pos) && fg('platform_editor_fix_right_arrow_nav_bug_in_layout')) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
|
|
261
266
|
// Default: if at end of parent's parent
|
|
262
267
|
var $after = $pos.doc.resolve($pos.after());
|
|
263
268
|
return $after.parent.content.size === $after.parentOffset;
|
|
@@ -331,4 +336,33 @@ export var findTopLevelList = function findTopLevelList(pos) {
|
|
|
331
336
|
currentDepth--;
|
|
332
337
|
}
|
|
333
338
|
return topLevelList;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Determines whether the current selection position is at the end of a layout column node.
|
|
343
|
+
*/
|
|
344
|
+
export var isSelectionAtEndOfLayoutColumn = function isSelectionAtEndOfLayoutColumn($pos) {
|
|
345
|
+
var layoutColumnParent = findParentNodeClosestToPos($pos, isLayoutColumnNode);
|
|
346
|
+
if (!layoutColumnParent) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
var grandParentDepth = $pos.depth - 1;
|
|
350
|
+
if (grandParentDepth < 0) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
var layoutColumn = $pos.doc.type.schema.nodes.layoutColumn;
|
|
354
|
+
var grandParent = $pos.node(grandParentDepth);
|
|
355
|
+
var afterPos = layoutColumnParent.pos + layoutColumnParent.node.nodeSize;
|
|
356
|
+
var $after = $pos.doc.resolve(afterPos);
|
|
357
|
+
return Boolean($after.nodeAfter) && grandParent.type === layoutColumn;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Determines if the given node is a LayoutColumn node.
|
|
362
|
+
*/
|
|
363
|
+
export var isLayoutColumnNode = function isLayoutColumnNode(node) {
|
|
364
|
+
var _node$type2;
|
|
365
|
+
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) || {},
|
|
366
|
+
layoutColumn = _ref4.layoutColumn;
|
|
367
|
+
return Boolean(node && node.type && node.type === layoutColumn);
|
|
334
368
|
};
|
|
@@ -76,3 +76,11 @@ export declare const findTopLevelList: (pos: ResolvedPos) => {
|
|
|
76
76
|
node: PmNode;
|
|
77
77
|
pos: number;
|
|
78
78
|
} | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether the current selection position is at the end of a layout column node.
|
|
81
|
+
*/
|
|
82
|
+
export declare const isSelectionAtEndOfLayoutColumn: ($pos: ResolvedPos) => boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines if the given node is a LayoutColumn node.
|
|
85
|
+
*/
|
|
86
|
+
export declare const isLayoutColumnNode: (node: PmNode | null | undefined) => boolean;
|
|
@@ -76,3 +76,11 @@ export declare const findTopLevelList: (pos: ResolvedPos) => {
|
|
|
76
76
|
node: PmNode;
|
|
77
77
|
pos: number;
|
|
78
78
|
} | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether the current selection position is at the end of a layout column node.
|
|
81
|
+
*/
|
|
82
|
+
export declare const isSelectionAtEndOfLayoutColumn: ($pos: ResolvedPos) => boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines if the given node is a LayoutColumn node.
|
|
85
|
+
*/
|
|
86
|
+
export declare const isLayoutColumnNode: (node: PmNode | null | undefined) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"singleton": true
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
22
|
+
"@atlaskit/editor-plugin-interaction": "^5.0.0",
|
|
23
23
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
24
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
24
|
+
"@atlaskit/editor-shared-styles": "^3.5.0",
|
|
25
25
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
26
26
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
27
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
28
|
-
"@atlaskit/tokens": "^
|
|
27
|
+
"@atlaskit/tmp-editor-statsig": "^9.22.0",
|
|
28
|
+
"@atlaskit/tokens": "^6.0.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@atlaskit/editor-common": "^107.
|
|
32
|
+
"@atlaskit/editor-common": "^107.16.0",
|
|
33
33
|
"react": "^18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -89,6 +89,9 @@
|
|
|
89
89
|
},
|
|
90
90
|
"platform_editor_fix_right_arrow_bug_list_in_layout": {
|
|
91
91
|
"type": "boolean"
|
|
92
|
+
},
|
|
93
|
+
"platform_editor_fix_right_arrow_nav_bug_in_layout": {
|
|
94
|
+
"type": "boolean"
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
}
|