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

Correct moving selection during invalid copy-paste #1742

Merged
merged 3 commits into from
Jun 10, 2019
Merged

Conversation

msamsel
Copy link
Contributor

@msamsel msamsel commented May 30, 2019

Suggested merge commit message (convention)

Fix: Moving selection during forbidden copy-paste operation (pasting table into empty table cell). Closes ckeditor/ckeditor5#1380.

@jodator jodator self-requested a review June 5, 2019 08:22
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

LGTM - few minor changes would be nice.

@@ -562,7 +562,7 @@ class Insertion {

// Special case – parent is empty (<p>^</p>).
// We can remove the element after moving insertion position out of it.
if ( parent.isEmpty ) {
if ( parent.isEmpty && parent.parent === allowedIn ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an explanation about parent.parent == allowedIn

@@ -1254,6 +1254,43 @@ describe( 'DataController utils', () => {
expect( getData( model ) ).to.equal( '<limit>ab[]foo</limit>' );
expect( stringify( root, affectedRange ) ).to.equal( '<limit>[ab]foo</limit>' );
} );

describe( 'when allowed elements is somewhere above limit', () => {
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 go with: 'when allowed element is above limit element in document tree'.

@msamsel msamsel force-pushed the t/ckeditor5/1380 branch from a614363 to d7ec424 Compare June 6, 2019 10:16
@msamsel msamsel requested a review from jodator June 6, 2019 10:20
@jodator jodator merged commit ab15b17 into master Jun 10, 2019
@jodator jodator deleted the t/ckeditor5/1380 branch June 10, 2019 09:54
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.

Pasting an element that cannot be inserted into table moves the selection
2 participants