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

Invalid delta Length and also Delta.slice() breaks latin unicode char in two parts e.g. ő #3074

Closed
khaled4vokalz opened this issue Jun 24, 2020 · 10 comments

Comments

@khaled4vokalz
Copy link

khaled4vokalz commented Jun 24, 2020

Steps for Reproduction

  • Enter latin character ő in Quill
  • delta.length() returns 2
  • selection range returns 1 as index if the cursor is after the latin character ő
  • delta.slice(0, range.index) returns 'o' only not the whole character
  • when you press backspace from the front of this character ő becomes O, whereas the whole character should've been removed

Expected behavior:

  • IMO, if the selection range returns 1 then delta.slice() should also behave accordingly. Now I'm not sure how to correctly split the delta when this type of unicode characters are used as delta
  • when you press backspace from the front of character ő, the whole character should be removed

Actual behavior:

  • delta.slice(0, 1) returns 'o' only not the whole character

Platforms:
Ubutnu, Chrome

Version:
1.3.7

@benbro
Copy link
Contributor

benbro commented Feb 3, 2024

Related
#3138
#1230

@luin
Copy link
Member

luin commented Feb 4, 2024

I think the issue has been fixed. Can you try the playground link?

@khaled4vokalz
Copy link
Author

Hi @luin ,
First of all, thanks for taking the Repo and reviving it... 👍

RE: This issue
It seems like it's working now, from what I can see from the playground link... Can you give me the link of the PR that solves the problem?

@luin
Copy link
Member

luin commented Feb 4, 2024

I tried v1.3.7 on https://quilljs.com/standalone/full and seems it also works.

delta.length() returns 2

This is expected as there is a trailing \n char.

@khaled4vokalz
Copy link
Author

hmmmm... 🤔 ... that's odd... It's been a while I've created this issue, as this repo was dying I lost hope of some answers from the maintainers.... Not sure why it happened on my case...
I'll see if I can reproduce it somewhere....

@khaled4vokalz
Copy link
Author

okay, I tried to reproduce the problem a bit... It seems like it can be a copy pasting issue which doesn't work when I work the character from outside of quill.... here's a screencast...

quill-issue.webm

I also tried to find out the length issues in quill for this character... see this codepen... https://codepen.io/khaled4vokalz/pen/YzqWjgv?editors=0012

As you can see there's a discrepancy how emoji lengths are treated and how this character gets treated in regards to length..

image

@luin
Copy link
Member

luin commented Feb 4, 2024

Thanks for the details. However I'm not sure if I understand the issue here. The codepen gives the correct results:

CleanShot 2024-02-04 at 12 42 53@2x

It's expected that the length of emojis is larger than 1

CleanShot 2024-02-04 at 12 44 49@2x

This does look like an issue when Backspace converted ő to o. Is there a way that I can reproduce it?

@khaled4vokalz
Copy link
Author

Hi @luin ,
Sorry for the late reply.... As you can see from my video I copy pasted the character from browser console.... which made the backspace to fail.... like you can copy the character from the CodePen's browser console and then paste it into the editor in the quill playground..

@luin
Copy link
Member

luin commented Feb 19, 2024

Thanks @khaled4vokalz ! I can reproduce it but looks like the native contenteditable also has the similar behavior (you can reproduce in codepen's code editor) so don't feel strongly that it's a Quill bug. Feel free to lmk if I missed anything.

@quill-bot
Copy link

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏

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

No branches or pull requests

4 participants