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

Selecting an Image from bottom to top throws exceptions #7892

Closed
ac-newcomp opened this issue Aug 21, 2020 · 5 comments · Fixed by #8466
Closed

Selecting an Image from bottom to top throws exceptions #7892

ac-newcomp opened this issue Aug 21, 2020 · 5 comments · Fixed by #8466
Assignees
Labels
browser:firefox domain:ui/ux This issue reports a problem related to UI or UX. package:widget squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior. type:regression This issue reports a bug that was not present in the previous releases.

Comments

@ac-newcomp
Copy link

📝 Provide detailed reproduction steps (if any)

  1. Navigate to https://ckeditor.com/docs/ckeditor5/latest/features/image.html
  2. Go to the sample with an image and add a newline below it
  3. Select the image, starting from bottom to top
  4. See GIF below for demonstration

bug

✔️ Expected result

No errors thrown

❌ Actual result

The following error is thrown: Uncaught CKEditorError: model-selection-range-intersects: Trying to add a range that intersects with another range in the selection. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/…port/error-codes.html#error-model-selection-range-intersects {"addedRange":{"start":{"root":"main","path":[4],"stickiness":"toNext"},"end":{"root":"main","path":[5,73],"stickiness":"toPrevious"}},"intersectingRange":{"start":{"root":"main","path":[4,0,0],"stickiness":"toNone"},"end":{"root":"main","path":[4,0,0],"stickiness":"toNone"}}}

📃 Other details

  • Browser: FF79.0
  • OS: Windows 10
  • CKEditor version: all version that I've tested, including whatever version is on the CKEditor document page
  • Installed CKEditor plugins: Image

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@ac-newcomp ac-newcomp added the type:bug This issue reports a buggy (incorrect) behavior. label Aug 21, 2020
@FilipTokarski
Copy link
Member

Hi, thanks for the report. I confirm this bug.
Apparently it was introduced in 20.0.0, bisection shows this commit 824d731

@mlewand mlewand added type:regression This issue reports a bug that was not present in the previous releases. package:widget squad:core Issue to be handled by the Core team. domain:ui/ux This issue reports a problem related to UI or UX. labels Aug 21, 2020
@Reinmar
Copy link
Member

Reinmar commented Aug 21, 2020

My guess:

  1. FF creates a multi-range selection in this case. At least, it did that in the past.
  2. Our post-fixer fixes one of these selections by e.g. extending it so it overlaps now with the other range.
  3. Error.

If I'm right, we could consider merging overlapping selections.

@psmyrek
Copy link
Contributor

psmyrek commented Nov 17, 2020

Firefox creates a multi-range selection containing three ranges, two of which are identical. The selection post-fixer tries to merge all of them together, but the rangeA.isIntersecting( rangeB ) returns false for identical ranges. As a result, the selection returned from post-fixer contains not properly merged, intersected ranges.

@LangQian
Copy link

In FF (Win & Mac), with similar steps, this issue also happens to Horizontal Line

@psmyrek
Copy link
Contributor

psmyrek commented Nov 18, 2020

Yes, the Horizontal Line is also affected. My PR #8466 is a general fix for all such cases.

niegowski added a commit that referenced this issue Nov 23, 2020
Fix (engine): Editor should not crash while selecting an Image from bottom to top. Closes #7892.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:firefox domain:ui/ux This issue reports a problem related to UI or UX. package:widget squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior. type:regression This issue reports a bug that was not present in the previous releases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants