react-native-rich-editor
react-native-rich-editor copied to clipboard
Inconsistent Editor HTML Formatting and Cursor Behavior
Currently experiencing formatting issue with the editor in my React Native project. I've been trying to update the editor's HTML content dynamically without the cursor restarting from the content start.
Initially, I tried the following implementation:
ref.current.sendAction('content', 'setHtml', removeTag(text));
The action successfully updates the content, it also causes the cursor to reset to the beginning of the content, which is not the desired behavior.
Steps to Reproduce:
- Use React Native version 0.70.6, React version 18.1.0, and react-native-pell-rich-editor version 1.9.0.
- Set up the react-native-pell-rich-editor library in a project.
- Implement a feature to dynamically update the editor's HTML content using ref.current.sendAction('content', 'setHtml', removeTag(text)).
- Observe that the content updates successfully but the cursor resets to the beginning of the content.
Expected Behavior:
When updating the HTML content of the editor, the cursor should remain at its current position without resetting to the beginning of the content.
Actual Behavior:
After updating the editor's content, the cursor resets to the start of the content, which is not the desired behavior.
Environment:
React Native version: 0.70.6
React version: 18.1.0
react-native-pell-rich-editor version: 1.9.0
Additional Information:
I have attempted to find an alternative solution or workaround, but haven't been successful so far. Any assistance or guidance on how to update the content without the cursor resetting would be greatly appreciated.
@stulip
I'm facing the same problem, any update on this?
@psalishol were you able to find a workaround?
I found this issue too
when I am change the color before start input
richText.current?.setForeColor(color);
the cursor will back to start point.