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 #6936: Editor get focus on init and on every value change #6937

Merged
merged 1 commit into from
Jul 27, 2024

Conversation

avasuro
Copy link
Contributor

@avasuro avasuro commented Jul 27, 2024

Fix: #6936

Changes is this PR is based on the fact, that native dangerouslyPasteHTML function of Quill under the hood consists of 2 instructions:

  1. Set editor value
  2. Set selection (which leads to the focus change)

So, here I used only first part of dangerouslyPasteHTML that sets input value without affecting focus (quill.setContents + quill.clipboard.convert).

WARNING: this change is not backwards-compatible with Quill v1, as quill.clipboard.convert function in v1 has different signature (it expects html markup in first argument, rather than in html property of an object). I don't have any good ideas about how to make this backwards-compatible.

Copy link

vercel bot commented Jul 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Jul 27, 2024 4:47pm
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Jul 27, 2024 4:47pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor: get focus immediately after first render + get focus after every change of its value
2 participants