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

Apply Formatting to Cursor Immediately After Link #3259

Closed
jbean-ss opened this issue Dec 18, 2020 · 3 comments
Closed

Apply Formatting to Cursor Immediately After Link #3259

jbean-ss opened this issue Dec 18, 2020 · 3 comments

Comments

@jbean-ss
Copy link

jbean-ss commented Dec 18, 2020

After creating a link, if we try to change the font size of the cursor immediately after the link (without any space) the text appears to be placed into the span.ql-cursor element and the formatting is not applied as desired. Additionally back spacing that text now will delete the last character of the link (even when the cursor is placed after the newly entered text) and move the cursor to the end of the link.

Steps for Reproduction

  1. Visit https://quilljs.com/docs/formats/
  2. Enter some text on a single line
  3. Highlight that text up to the last character entered (it's important that the last typed character is in your range).
  4. Add a link to the selected text.
  5. After the link is added, without making any other keystrokes click to the spot immediately after the newly created link so that you are no longer highlighting the text
  6. Apply a new font size (i.e. the default on quilljs.com/docs/formats is "Normal", "Huge" makes this problem very obvious).
  7. Type a few characters (observe the text size is still Normal and not Huge).
  8. Now "backspace" (observe that the last character typed is not deleted, instead the last character of the link is deleted, also the cursor has moved to immediately after the link).
  9. Open dev tools to the "Elements" tab.
  10. Use the clicker to click your text content
  11. Observe that the HTML has actually applied these styles to the element with ql-cursor as a class and that the special unicode character &#65279 is inside of the ql-cursor span with your content

Expected behavior:

  1. The text is Huge
  2. Deleting deletes the character prior to the cursor
  3. The formatted element is not inside the span.ql-cursor element

Actual behavior:

  1. Text size remains Normal
  2. Deleting deletes the last character of the link and moves the cursor to the end of the link
  3. We are not typing inside of the span.ql-cursor element

Platforms:

Chrome (87.0.4280.88), Windows 10 (10.0.17763)

Version:

1.3.6

@jbean-ss
Copy link
Author

Along this similar vein. There is an additional bug.

If after step 6 and before step 7, you click the link text such that your cursor is somewhere within the tag, there will be a console error like the following:

quill.min.js:7 Uncaught TypeError: l.position is not a function at t.value (quill.min.js:7) at t.value (quill.min.js:7) at e.<anonymous> (quill.min.js:7) at e.o.emit (quill.min.js:7) at e.value (quill.min.js:7) at t.value (quill.min.js:7) at quill.min.js:7 at quill.min.js:7 at Array.forEach (<anonymous>) at e.value (quill.min.js:7)

@jbean-ss
Copy link
Author

Oh and one more. If you take the route of the second bug (listed in the comment immediately above), after you get that error, all formatting changes made from clicking the toolbar cause the editor to lose focus.

@luin
Copy link
Member

luin commented Feb 18, 2022

Closing via #3534

@luin luin closed this as completed Feb 18, 2022
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

2 participants