-
Notifications
You must be signed in to change notification settings - Fork 900
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
Proper Approach to Using an Image Handler #961
Comments
any advice on hooking into the editor in order to react to the image in the editor pallet? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Using
document.createElement
to implement an image handler in React-Quill can lead to unexpected bugs.A significant issue is that the upload function fails to update with dynamically changing props or states. Once created, the function does not adapt to reflect updates in the component's props or state.
Example
Solution
To address these issues, it's recommended to use React's useRef to reference the file input tag. This approach allows for managing DOM elements within React, thereby preventing synchronization issues between React's virtual DOM and the actual DOM. Here's a simplified example of how this can be implemented.
The text was updated successfully, but these errors were encountered: