Skip to content

Reflects two bugs about the delete operation #36

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

Closed
imhuntun opened this issue Oct 25, 2023 · 2 comments
Closed

Reflects two bugs about the delete operation #36

imhuntun opened this issue Oct 25, 2023 · 2 comments
Labels
acknowledged Acknowledged bug Something isn't working

Comments

@imhuntun
Copy link

Describe the bug
When I started editing a new document, I detected two bugs.

First bug. The last div tag in the document disappears when the delete key is continuously entered on an empty TAB. At this point, if I type in the text and enter, the content will not wrap.

The second bug, or in a blank document, if I hit the enter key continuously, it will produce multiple blank lines, at this time, if I use the delete key to delete these empty lines, the deletion operation will not take effect.

I analyzed your code and found a mistake in your logic when dealing with the delete key. Therefore, the above two bugs are generated. Hopefully it will be fixed soon.

Screenshots
image

@motla
Copy link
Owner

motla commented Oct 25, 2023

Hi @imhuntun

Thanks a lot for reporting. Ok I acknowledge both bugs.
This is what we end up with when we have to make dirty hacks like this for trying to manage the contenteditable behaviour 😣

Indeed you pointed out the right code which we have to rewrite. So we have to:

  • Prevent user action when the content[0] is empty (also <div></div> or <div><br></div> must be considered empty)
  • Not prevent user action when the content[0] is not empty (several <br> or spaces / tabs makes it non-empty)
  • Make sure the content is always contained in one or more <div> containers (some user actions manage to remove the root <div>), otherwise it prevents the user ENTER key input (or it breaks the page overflow management).

I'm not sure how to do this in the best way, and it needs lots of testing on different web browsers. But it must be feasible.
I must finish urgent ongoing projects right now, so I can't look at it before a month from now, I'm sorry.

In the meantime if you have time you are welcome to contribute and send a pull request, you will be marked as contributor 🙌

@motla motla added acknowledged Acknowledged bug Something isn't working labels Oct 25, 2023
@motla
Copy link
Owner

motla commented Dec 27, 2023

Hi @imhuntun your issue should now be fixed in v2.3.2 (Vue3) and v1.5.2 (Vue2). I had to rewrite code which finally led to remove the keydown function you pointed out entirely. Please let me know if you still have issues.

@motla motla closed this as completed Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Acknowledged bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants