Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

T/ckeditor5 table/99: Selection post-fixer improvements. #1608

Merged
merged 20 commits into from
Dec 20, 2018

Conversation

jodator
Copy link
Contributor

@jodator jodator commented Dec 7, 2018

Suggested merge commit message (convention)

Add selection post-fixer improvements. Closes ckeditor/ckeditor5#4444.


Additional information

@coveralls
Copy link

coveralls commented Dec 19, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 3398e5d on t/ckeditor5-table/99 into fd7734e on master.

Copy link
Contributor

@scofalik scofalik left a 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

src/model/utils/selection-post-fixer.js Show resolved Hide resolved
src/model/utils/selection-post-fixer.js Show resolved Hide resolved
src/model/utils/selection-post-fixer.js Outdated Show resolved Hide resolved
@@ -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;
Copy link
Contributor

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 !!.

Copy link
Contributor

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?

Copy link
Contributor Author

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 ) {
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ends => boundaries

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one => any

@scofalik scofalik merged commit 7f40831 into master Dec 20, 2018
@oleq oleq deleted the t/ckeditor5-table/99 branch December 20, 2018 10:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to select an object element in some cases
3 participants