-
Notifications
You must be signed in to change notification settings - Fork 40
T/ckeditor5 table/99: Selection post-fixer improvements. #1608
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only slight changes required.
@@ -159,6 +159,7 @@ function tryFixingCollapsedRange( range, schema ) { | |||
// | |||
// @param {module:engine/model/range~Range} range Expanded range to fix. | |||
// @param {module:engine/model/schema~Schema} schema | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
@@ -197,13 +202,23 @@ function tryFixingNonCollapsedRage( range, schema ) { | |||
// At this point we eliminated valid positions on text nodes so if one of range positions is placed inside a limit element | |||
// then the range crossed limit element boundaries and needs to be fixed. | |||
if ( isStartInLimit || isEndInLimit ) { | |||
const bothInSameParent = ( !!start.nodeAfter && !!end.nodeBefore ) && start.nodeAfter === end.nodeBefore; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can omit !!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am not sure if the name is correct. It's more that the selection is on the same element, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is correct but the check is not. Updated to look for parent check.
let node = position.parent; | ||
let parent = node; | ||
// @returns {module:engine/model/node~Node} | ||
function findOuterMostIsLimitAncestor( startingNode, schema ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call it findOutermostLimitAncestor
. The is
part makes the name confusing. I know that we are looking for an object that passes isLimit()
in Schema
but still. Also AFAIR outermost is a one word.
} | ||
|
||
// Checks whether both range ends are placed around non-limit elements. | ||
// Checks whether one of range ends is placed around non-limit elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ends => boundaries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one => any
Suggested merge commit message (convention)
Add selection post-fixer improvements. Closes ckeditor/ckeditor5#4444.
Additional information