@atlaskit/editor-plugin-selection 3.0.0 → 3.0.2
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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#184967](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/184967)
|
|
8
|
+
[`c868ad3f120c0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c868ad3f120c0) -
|
|
9
|
+
[ux] Fix bug: pressing right arrow from listItem in layout/extended/panel skips next listItem and
|
|
10
|
+
selects container instead
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 3.0.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 3.0.0
|
|
4
20
|
|
|
5
21
|
### Major 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.getNodesToDecorateFromSelection = exports.getDecorations = exports.findSelectableContainerParent = exports.findSelectableContainerBefore = exports.findSelectableContainerAfter = exports.findLastChildNodeToSelect = exports.findFirstChildNodeToSelect = void 0;
|
|
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;
|
|
7
7
|
exports.shouldRecalcDecorations = shouldRecalcDecorations;
|
|
8
8
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -11,6 +11,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _types = require("../types");
|
|
15
16
|
var getDecorations = exports.getDecorations = function getDecorations(tr, manualSelection) {
|
|
16
17
|
var selection = tr.selection;
|
|
@@ -248,13 +249,93 @@ var isSelectionAtStartOfParentNode = exports.isSelectionAtStartOfParentNode = fu
|
|
|
248
249
|
return (0, _selection.isSelectionAtStartOfNode)($pos, (_findSelectableContai = findSelectableContainerParent(selection)) === null || _findSelectableContai === void 0 ? void 0 : _findSelectableContai.node);
|
|
249
250
|
};
|
|
250
251
|
var isSelectionAtEndOfParentNode = exports.isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
|
|
252
|
+
// If the current position is at the end of its parent node's content.
|
|
251
253
|
var isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
|
|
252
254
|
if (!isAtTheEndOfCurrentLevel) {
|
|
253
255
|
return false;
|
|
254
256
|
}
|
|
257
|
+
|
|
258
|
+
// If at the root or parent is selectable, we're at the end
|
|
255
259
|
if ($pos.depth === 0 || _state.NodeSelection.isSelectable($pos.parent)) {
|
|
256
260
|
return isAtTheEndOfCurrentLevel;
|
|
257
261
|
}
|
|
262
|
+
|
|
263
|
+
// Handle lists: if in a list inside container and not at the end, return false
|
|
264
|
+
if ((0, _utils2.hasParentNode)(_utils.isListItemNode)(selection) && isListItemWithinContainerNotAtEnd($pos, selection) && (0, _platformFeatureFlags.fg)('platform_editor_fix_right_arrow_bug_list_in_layout')) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Default: if at end of parent's parent
|
|
258
269
|
var $after = $pos.doc.resolve($pos.after());
|
|
259
270
|
return $after.parent.content.size === $after.parentOffset;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Determines if the current selection is inside a list item within a container and not at the end of the parent list.
|
|
275
|
+
*
|
|
276
|
+
* This is useful for handling edge cases where the selection is within a list inside a container structure,
|
|
277
|
+
* and we need to know if the selection is not at the logical end of the parent list node.
|
|
278
|
+
*/
|
|
279
|
+
var isListItemWithinContainerNotAtEnd = exports.isListItemWithinContainerNotAtEnd = function isListItemWithinContainerNotAtEnd($pos, selection) {
|
|
280
|
+
var isInContainerNode = (0, _utils2.hasParentNode)(isContainerNode)(selection);
|
|
281
|
+
if (!isInContainerNode) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
var parentList = (0, _utils2.findParentNodeClosestToPos)($pos, _utils.isListItemNode);
|
|
285
|
+
if (!parentList) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
var $parentListPos = $pos.doc.resolve(parentList.pos);
|
|
289
|
+
var topLevelList = findTopLevelList($pos);
|
|
290
|
+
if (!topLevelList) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
var $afterTopLevelList = $pos.doc.resolve(topLevelList.pos + topLevelList.node.nodeSize);
|
|
294
|
+
var nodeAfterTopLevelList = $afterTopLevelList.nodeAfter;
|
|
295
|
+
var grandParentList = (0, _utils2.findParentNodeClosestToPos)($pos.doc.resolve($parentListPos.before()), _utils.isListItemNode);
|
|
296
|
+
var grandParentListPos = grandParentList ? $pos.doc.resolve(grandParentList.pos) : undefined;
|
|
297
|
+
var isLastListItemInParent =
|
|
298
|
+
// Check if the current list item is the last child in its parent list
|
|
299
|
+
$parentListPos.index() === $parentListPos.parent.childCount - 1 && (
|
|
300
|
+
// Check if there is no grandparent list, or if the grandparent list item is also the last child in its parent
|
|
301
|
+
!grandParentList || grandParentListPos && grandParentListPos.index() === grandParentListPos.parent.childCount - 1);
|
|
302
|
+
if (!isLastListItemInParent || nodeAfterTopLevelList) {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
return false;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Determines if the given node is a Container (layoutColumn, panel, expand) node.
|
|
310
|
+
*/
|
|
311
|
+
var isContainerNode = exports.isContainerNode = function isContainerNode(node) {
|
|
312
|
+
var _node$type;
|
|
313
|
+
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) || {},
|
|
314
|
+
layoutColumn = _ref3.layoutColumn,
|
|
315
|
+
panel = _ref3.panel,
|
|
316
|
+
expand = _ref3.expand;
|
|
317
|
+
return Boolean(node && node.type && [panel, expand, layoutColumn].includes(node.type));
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Finds the top-level List ancestor of the given position.
|
|
322
|
+
* Returns the node and its position if found, otherwise returns undefined.
|
|
323
|
+
*/
|
|
324
|
+
var findTopLevelList = exports.findTopLevelList = function findTopLevelList(pos) {
|
|
325
|
+
var _pos$doc$type$schema$ = pos.doc.type.schema.nodes,
|
|
326
|
+
bulletList = _pos$doc$type$schema$.bulletList,
|
|
327
|
+
orderedList = _pos$doc$type$schema$.orderedList;
|
|
328
|
+
var currentDepth = pos.depth;
|
|
329
|
+
var topLevelList;
|
|
330
|
+
while (currentDepth > 0) {
|
|
331
|
+
var node = pos.node(currentDepth);
|
|
332
|
+
if ([bulletList, orderedList].includes(node.type)) {
|
|
333
|
+
topLevelList = {
|
|
334
|
+
node: node,
|
|
335
|
+
pos: pos.before(currentDepth)
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
currentDepth--;
|
|
339
|
+
}
|
|
340
|
+
return topLevelList;
|
|
260
341
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
2
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { findParentNode, flatten } from '@atlaskit/editor-prosemirror/utils';
|
|
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 { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { selectionPluginKey } from '../types';
|
|
8
9
|
export const getDecorations = (tr, manualSelection) => {
|
|
9
10
|
let selection = tr.selection;
|
|
@@ -237,13 +238,95 @@ export const isSelectionAtStartOfParentNode = ($pos, selection) => {
|
|
|
237
238
|
return isSelectionAtStartOfNode($pos, (_findSelectableContai = findSelectableContainerParent(selection)) === null || _findSelectableContai === void 0 ? void 0 : _findSelectableContai.node);
|
|
238
239
|
};
|
|
239
240
|
export const isSelectionAtEndOfParentNode = ($pos, selection) => {
|
|
241
|
+
// If the current position is at the end of its parent node's content.
|
|
240
242
|
const isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
|
|
241
243
|
if (!isAtTheEndOfCurrentLevel) {
|
|
242
244
|
return false;
|
|
243
245
|
}
|
|
246
|
+
|
|
247
|
+
// If at the root or parent is selectable, we're at the end
|
|
244
248
|
if ($pos.depth === 0 || NodeSelection.isSelectable($pos.parent)) {
|
|
245
249
|
return isAtTheEndOfCurrentLevel;
|
|
246
250
|
}
|
|
251
|
+
|
|
252
|
+
// Handle lists: if in a list inside container and not at the end, return false
|
|
253
|
+
if (hasParentNode(isListItemNode)(selection) && isListItemWithinContainerNotAtEnd($pos, selection) && fg('platform_editor_fix_right_arrow_bug_list_in_layout')) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Default: if at end of parent's parent
|
|
247
258
|
const $after = $pos.doc.resolve($pos.after());
|
|
248
259
|
return $after.parent.content.size === $after.parentOffset;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Determines if the current selection is inside a list item within a container and not at the end of the parent list.
|
|
264
|
+
*
|
|
265
|
+
* This is useful for handling edge cases where the selection is within a list inside a container structure,
|
|
266
|
+
* and we need to know if the selection is not at the logical end of the parent list node.
|
|
267
|
+
*/
|
|
268
|
+
export const isListItemWithinContainerNotAtEnd = ($pos, selection) => {
|
|
269
|
+
const isInContainerNode = hasParentNode(isContainerNode)(selection);
|
|
270
|
+
if (!isInContainerNode) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
const parentList = findParentNodeClosestToPos($pos, isListItemNode);
|
|
274
|
+
if (!parentList) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
const $parentListPos = $pos.doc.resolve(parentList.pos);
|
|
278
|
+
const topLevelList = findTopLevelList($pos);
|
|
279
|
+
if (!topLevelList) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
const $afterTopLevelList = $pos.doc.resolve(topLevelList.pos + topLevelList.node.nodeSize);
|
|
283
|
+
const nodeAfterTopLevelList = $afterTopLevelList.nodeAfter;
|
|
284
|
+
const grandParentList = findParentNodeClosestToPos($pos.doc.resolve($parentListPos.before()), isListItemNode);
|
|
285
|
+
const grandParentListPos = grandParentList ? $pos.doc.resolve(grandParentList.pos) : undefined;
|
|
286
|
+
const isLastListItemInParent =
|
|
287
|
+
// Check if the current list item is the last child in its parent list
|
|
288
|
+
$parentListPos.index() === $parentListPos.parent.childCount - 1 && (
|
|
289
|
+
// Check if there is no grandparent list, or if the grandparent list item is also the last child in its parent
|
|
290
|
+
!grandParentList || grandParentListPos && grandParentListPos.index() === grandParentListPos.parent.childCount - 1);
|
|
291
|
+
if (!isLastListItemInParent || nodeAfterTopLevelList) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Determines if the given node is a Container (layoutColumn, panel, expand) node.
|
|
299
|
+
*/
|
|
300
|
+
export const isContainerNode = node => {
|
|
301
|
+
var _node$type, _node$type$schema;
|
|
302
|
+
const {
|
|
303
|
+
layoutColumn,
|
|
304
|
+
panel,
|
|
305
|
+
expand
|
|
306
|
+
} = (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) || {};
|
|
307
|
+
return Boolean(node && node.type && [panel, expand, layoutColumn].includes(node.type));
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Finds the top-level List ancestor of the given position.
|
|
312
|
+
* Returns the node and its position if found, otherwise returns undefined.
|
|
313
|
+
*/
|
|
314
|
+
export const findTopLevelList = pos => {
|
|
315
|
+
const {
|
|
316
|
+
bulletList,
|
|
317
|
+
orderedList
|
|
318
|
+
} = pos.doc.type.schema.nodes;
|
|
319
|
+
let currentDepth = pos.depth;
|
|
320
|
+
let topLevelList;
|
|
321
|
+
while (currentDepth > 0) {
|
|
322
|
+
const node = pos.node(currentDepth);
|
|
323
|
+
if ([bulletList, orderedList].includes(node.type)) {
|
|
324
|
+
topLevelList = {
|
|
325
|
+
node,
|
|
326
|
+
pos: pos.before(currentDepth)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
currentDepth--;
|
|
330
|
+
}
|
|
331
|
+
return topLevelList;
|
|
249
332
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isIgnored as isIgnoredByGapCursor, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
2
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isEmptyParagraph, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { findParentNode, flatten } from '@atlaskit/editor-prosemirror/utils';
|
|
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 { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { selectionPluginKey } from '../types';
|
|
8
9
|
export var getDecorations = function getDecorations(tr, manualSelection) {
|
|
9
10
|
var selection = tr.selection;
|
|
@@ -241,13 +242,93 @@ export var isSelectionAtStartOfParentNode = function isSelectionAtStartOfParentN
|
|
|
241
242
|
return isSelectionAtStartOfNode($pos, (_findSelectableContai = findSelectableContainerParent(selection)) === null || _findSelectableContai === void 0 ? void 0 : _findSelectableContai.node);
|
|
242
243
|
};
|
|
243
244
|
export var isSelectionAtEndOfParentNode = function isSelectionAtEndOfParentNode($pos, selection) {
|
|
245
|
+
// If the current position is at the end of its parent node's content.
|
|
244
246
|
var isAtTheEndOfCurrentLevel = $pos.parent.content.size === $pos.parentOffset;
|
|
245
247
|
if (!isAtTheEndOfCurrentLevel) {
|
|
246
248
|
return false;
|
|
247
249
|
}
|
|
250
|
+
|
|
251
|
+
// If at the root or parent is selectable, we're at the end
|
|
248
252
|
if ($pos.depth === 0 || NodeSelection.isSelectable($pos.parent)) {
|
|
249
253
|
return isAtTheEndOfCurrentLevel;
|
|
250
254
|
}
|
|
255
|
+
|
|
256
|
+
// Handle lists: if in a list inside container and not at the end, return false
|
|
257
|
+
if (hasParentNode(isListItemNode)(selection) && isListItemWithinContainerNotAtEnd($pos, selection) && fg('platform_editor_fix_right_arrow_bug_list_in_layout')) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Default: if at end of parent's parent
|
|
251
262
|
var $after = $pos.doc.resolve($pos.after());
|
|
252
263
|
return $after.parent.content.size === $after.parentOffset;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Determines if the current selection is inside a list item within a container and not at the end of the parent list.
|
|
268
|
+
*
|
|
269
|
+
* This is useful for handling edge cases where the selection is within a list inside a container structure,
|
|
270
|
+
* and we need to know if the selection is not at the logical end of the parent list node.
|
|
271
|
+
*/
|
|
272
|
+
export var isListItemWithinContainerNotAtEnd = function isListItemWithinContainerNotAtEnd($pos, selection) {
|
|
273
|
+
var isInContainerNode = hasParentNode(isContainerNode)(selection);
|
|
274
|
+
if (!isInContainerNode) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
var parentList = findParentNodeClosestToPos($pos, isListItemNode);
|
|
278
|
+
if (!parentList) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
var $parentListPos = $pos.doc.resolve(parentList.pos);
|
|
282
|
+
var topLevelList = findTopLevelList($pos);
|
|
283
|
+
if (!topLevelList) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
var $afterTopLevelList = $pos.doc.resolve(topLevelList.pos + topLevelList.node.nodeSize);
|
|
287
|
+
var nodeAfterTopLevelList = $afterTopLevelList.nodeAfter;
|
|
288
|
+
var grandParentList = findParentNodeClosestToPos($pos.doc.resolve($parentListPos.before()), isListItemNode);
|
|
289
|
+
var grandParentListPos = grandParentList ? $pos.doc.resolve(grandParentList.pos) : undefined;
|
|
290
|
+
var isLastListItemInParent =
|
|
291
|
+
// Check if the current list item is the last child in its parent list
|
|
292
|
+
$parentListPos.index() === $parentListPos.parent.childCount - 1 && (
|
|
293
|
+
// Check if there is no grandparent list, or if the grandparent list item is also the last child in its parent
|
|
294
|
+
!grandParentList || grandParentListPos && grandParentListPos.index() === grandParentListPos.parent.childCount - 1);
|
|
295
|
+
if (!isLastListItemInParent || nodeAfterTopLevelList) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Determines if the given node is a Container (layoutColumn, panel, expand) node.
|
|
303
|
+
*/
|
|
304
|
+
export var isContainerNode = function isContainerNode(node) {
|
|
305
|
+
var _node$type;
|
|
306
|
+
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) || {},
|
|
307
|
+
layoutColumn = _ref3.layoutColumn,
|
|
308
|
+
panel = _ref3.panel,
|
|
309
|
+
expand = _ref3.expand;
|
|
310
|
+
return Boolean(node && node.type && [panel, expand, layoutColumn].includes(node.type));
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Finds the top-level List ancestor of the given position.
|
|
315
|
+
* Returns the node and its position if found, otherwise returns undefined.
|
|
316
|
+
*/
|
|
317
|
+
export var findTopLevelList = function findTopLevelList(pos) {
|
|
318
|
+
var _pos$doc$type$schema$ = pos.doc.type.schema.nodes,
|
|
319
|
+
bulletList = _pos$doc$type$schema$.bulletList,
|
|
320
|
+
orderedList = _pos$doc$type$schema$.orderedList;
|
|
321
|
+
var currentDepth = pos.depth;
|
|
322
|
+
var topLevelList;
|
|
323
|
+
while (currentDepth > 0) {
|
|
324
|
+
var node = pos.node(currentDepth);
|
|
325
|
+
if ([bulletList, orderedList].includes(node.type)) {
|
|
326
|
+
topLevelList = {
|
|
327
|
+
node: node,
|
|
328
|
+
pos: pos.before(currentDepth)
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
currentDepth--;
|
|
332
|
+
}
|
|
333
|
+
return topLevelList;
|
|
253
334
|
};
|
|
@@ -57,3 +57,22 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
57
57
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
58
58
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
59
59
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Determines if the current selection is inside a list item within a container and not at the end of the parent list.
|
|
62
|
+
*
|
|
63
|
+
* This is useful for handling edge cases where the selection is within a list inside a container structure,
|
|
64
|
+
* and we need to know if the selection is not at the logical end of the parent list node.
|
|
65
|
+
*/
|
|
66
|
+
export declare const isListItemWithinContainerNotAtEnd: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the given node is a Container (layoutColumn, panel, expand) node.
|
|
69
|
+
*/
|
|
70
|
+
export declare const isContainerNode: (node: PmNode | null | undefined) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Finds the top-level List ancestor of the given position.
|
|
73
|
+
* Returns the node and its position if found, otherwise returns undefined.
|
|
74
|
+
*/
|
|
75
|
+
export declare const findTopLevelList: (pos: ResolvedPos) => {
|
|
76
|
+
node: PmNode;
|
|
77
|
+
pos: number;
|
|
78
|
+
} | undefined;
|
|
@@ -57,3 +57,22 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
57
57
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
58
58
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
59
59
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Determines if the current selection is inside a list item within a container and not at the end of the parent list.
|
|
62
|
+
*
|
|
63
|
+
* This is useful for handling edge cases where the selection is within a list inside a container structure,
|
|
64
|
+
* and we need to know if the selection is not at the logical end of the parent list node.
|
|
65
|
+
*/
|
|
66
|
+
export declare const isListItemWithinContainerNotAtEnd: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the given node is a Container (layoutColumn, panel, expand) node.
|
|
69
|
+
*/
|
|
70
|
+
export declare const isContainerNode: (node: PmNode | null | undefined) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Finds the top-level List ancestor of the given position.
|
|
73
|
+
* Returns the node and its position if found, otherwise returns undefined.
|
|
74
|
+
*/
|
|
75
|
+
export declare const findTopLevelList: (pos: ResolvedPos) => {
|
|
76
|
+
node: PmNode;
|
|
77
|
+
pos: number;
|
|
78
|
+
} | undefined;
|
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.2",
|
|
4
4
|
"description": "Selection plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
25
25
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
26
26
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
27
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
28
|
-
"@atlaskit/tokens": "^5.
|
|
27
|
+
"@atlaskit/tmp-editor-statsig": "^9.5.0",
|
|
28
|
+
"@atlaskit/tokens": "^5.5.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@atlaskit/editor-common": "^107.
|
|
32
|
+
"@atlaskit/editor-common": "^107.7.0",
|
|
33
33
|
"react": "^18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -86,6 +86,9 @@
|
|
|
86
86
|
},
|
|
87
87
|
"platform_editor_nested_tables_gap_cursor": {
|
|
88
88
|
"type": "boolean"
|
|
89
|
+
},
|
|
90
|
+
"platform_editor_fix_right_arrow_bug_list_in_layout": {
|
|
91
|
+
"type": "boolean"
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
}
|