-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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(extension-suggestion): get client rect by anchor. #5395
base: develop
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Just to clarify a little bit more - which decoration node are we talking about here? |
The decoration node discussed here is the HTML tag that wraps the "@" character (like this If it work properly, the html in the editor will look like this <p>What do you all think about the new <span class="mention" data-type="mention" data-id="Winona Ryder" contenteditable="false">@Winona Ryder</span> movie? <span data-decoration-id="id_3457874414" class="suggestion">@</span></p> When using Chinese input method, it is often impossible to obtain the decoration node by view.dom.querySelector(`[data-decoration-id="${decorationId}"]`) |
I have same problem, hope this can fix |
Changes Overview
Previously, clientRect was only obtained through decorationNode. If decorationNode could not be obtained, the value of clientRect was assigned to null. This commit adds a new method to obtain clientRect.
Implementation Approach
If decorationNode cannot be obtained, the coordinates are obtained according to the editor's cursor position, and the cursor position is used to generate a DOMRect.
Testing Done
In scenarios where Chinese IME is used, the value of clientRect is almost always null, which causes the "suggestion" to not render. This commit fixes this issue.
Verification Steps
Just type @ when using the Chinese input method and the result will be verified.
Additional Notes
Checklist
Related Issues