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

Fix the case where embed is deleted with backspace on Chrome #3163

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

cmrd-senya
Copy link
Contributor

This fixes the bug similar to #2285 and #2187

Steps to reproduce:

  1. Open Quill editor in Chrome
  2. Apply user-select: all on .ql-formula class
  3. Add formula in Quill
  4. Click the formula
  5. Push Backspace
  6. Check the DOM

ER
Formula is not in the DOM

AR
Formula is in the DOM (but with no internal content part)

Bug illustration:
изображение

In this patch we detect the mutation when the embed is deleted and we remove the full node. We also set the range not to lose the selection. In case when the embed is replaced by pushing a visible key instead of backspace we also remove the node but I couldn't find the solution for setting selection as the node gets updated and replace in DOM.

Playground with the fix: https://codepen.io/senya1111/pen/ExKbOdW

@prz-szo
Copy link

prz-szo commented Feb 8, 2022

@jhchen Are we going to merge this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants