Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow basic d&d element/image in tables when tableselection is on #4951

Merged
merged 7 commits into from
Nov 23, 2021

Conversation

KarolDawidziuk
Copy link
Contributor

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

* [#547](https://github.com/ckeditor/ckeditor4/issues/547): Fixed: Element/Image drag to move within the table is no longer available.

What changes did you make?

D&D in tables was unavailable because the drag event handler cancel this event.
To allow it I just removed the part of the code responsible for the interrupting of the event and in the same handler updated the fakeSelection.active flag to stop table selection.

This fix only allows moving only selected text and images. Trying to select an entire cell with tableselection and moving it fails.

PS. This branch has this name because there is already one frozen PR for this issue.

Which issues does your PR resolve?

Closes #547.

@sculpt0r sculpt0r self-assigned this Nov 12, 2021
@sculpt0r sculpt0r self-requested a review November 12, 2021 08:45
Copy link
Contributor

@sculpt0r sculpt0r left a comment

Choose a reason for hiding this comment

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

Nice and clean solution 👍 I hope that disabling selection do not break anything ;) However all tests on chrome all green 🤞

I left a few inline comments. The most important is the one with d&d issue on chrome.

I think we could also add a mixed test, so d&d for mixed images with text content.

Also, please use the 4.17.1 tag as @jacekbogdanski suggested.

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
<tbody>
<tr>
<td><img alt="" src="https://via.placeholder.com/100" />&nbsp;</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this &nbsp? Because without it - when I d&d image - it is pasted with additional borders 🤔

If you leave it, then it is possible to d&d image inside the same cell, but after &nbsp. Then when you d&d image to another cell it is copied with additional borders. It looks like it is copied with the entire table construction inside the td element.

Copy link
Contributor

Choose a reason for hiding this comment

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

However, it occurs only in chrome... 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you said, without &nbsp; d&d is breaking. I created a separate issue for this case. This problem occurs when tableselection and clipboard plugins are enabled.

tests/plugins/tableselection/manual/draganddropimage.html Outdated Show resolved Hide resolved
tests/plugins/tableselection/manual/draganddropimage.html Outdated Show resolved Hide resolved
tests/plugins/tableselection/manual/draganddropimage.md Outdated Show resolved Hide resolved
tests/plugins/tableselection/manual/draganddropimage.md Outdated Show resolved Hide resolved
tests/plugins/tableselection/manual/draganddroptext.html Outdated Show resolved Hide resolved
plugins/tableselection/plugin.js Show resolved Hide resolved
@sculpt0r
Copy link
Contributor

Rebased on newest next branch.

@sculpt0r
Copy link
Contributor

Rebased on newest next branch to enable travis.

@KarolDawidziuk
Copy link
Contributor Author

Thanks, @sculpt0r for the review!
It's ready for another one :)

Changes:

  • New manual test for mixed content ( text + image )
  • Indentation fix
  • Ignore test fix
  • Using proper bender tags

@jacekbogdanski jacekbogdanski changed the base branch from next to master November 18, 2021 07:21
@sculpt0r
Copy link
Contributor

Rebased on newest mater.

@sculpt0r sculpt0r self-assigned this Nov 23, 2021
Copy link
Contributor

@sculpt0r sculpt0r left a comment

Choose a reason for hiding this comment

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

Thank you for the latest corrections and extracting the issue 👍 Besides it: the solution looks good 🎉 We just earned a feature 👏

I only changed the tags to 4.17.2 since the latest release already is 4.17.1

@sculpt0r sculpt0r merged commit fb492b3 into master Nov 23, 2021
@sculpt0r sculpt0r deleted the t/547-2 branch November 23, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Element/Image drag to move within table is no longer available
2 participants