quill
quill copied to clipboard
Invalid delta `Length` and also `Delta.slice()` breaks latin unicode char in two parts e.g. ő
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
Related https://github.com/quilljs/quill/issues/3138 https://github.com/quilljs/quill/issues/1230
I think the issue has been fixed. Can you try the playground link?
Hi @luin , First of all, thanks for taking the Repo and reviving it... :+1:
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?
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.
hmmmm... :thinking: ... 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....
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...
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..
Thanks for the details. However I'm not sure if I understand the issue here. The codepen gives the correct results:
It's expected that the length of emojis is larger than 1
This does look like an issue when Backspace converted ő to o. Is there a way that I can reproduce it?
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..
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 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 :pray: