RichText not updating properly based on state
See original GitHub issueCategory
[ ] Enhancement
[X] Bug
[ ] Question
Version
Please specify what version of the library you are using: [1.20.0]
Expected / Desired Behavior / Question
I expect the text to update properly whenever the onChange handler is called. Also, why do you need it to return a string, instead of just accepting the updated state as a prop?
Observed Behavior
The webpart is only updating the first keystroke. All subsequent strokes seems to be disregarded, and will not be recorded unless I click outside the webpart and then refocus by clicking inside.
Steps to Reproduce
Please try the following code snippet:
import * as React from "react";
import { RichText } from "@pnp/spfx-controls-react/lib/RichText";
const RichTextExample: React.FC = (props) => {
const [text, setText] = React.useState("Default text");
const onChange = (newText: string) => {
setText(newText);
return newText;
};
return <RichText value={text} onChange={onChange} />;
};
export default RichTextExample;
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Flutter setState not updating RichText widget - Stack Overflow
The widget is not updating because you're not changing the actual List object but just adding more items to the existing List object....
Read more >Enable or disable full rich-text formatting in a rich text box
If you enable rich-text formatting for a rich text box, users can use a variety of options to format the text that they...
Read more >Bug: Rich Text Editor HTML state not updated - Zeroqode Forum
Hi, I'm using the ZQ RTE plugin. When I set the initial content or when I use the action to set content. i.e....
Read more >Not able to update Rich text field with XML data
Yes it is working fine now... I have just changed the field type from Rich Text to Text Area(Long)..
Read more >lightning-input-rich-text - documentation - Salesforce Developers
A lightning-input-rich-text component creates a rich text editor based on the ... using the missing formats are not rendered correctly in the text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi all,
I’ve made the fix. Please, check beta version.
@nbelyh @Abderahman88 @vaderj @michelsmit @nwinger
@nbelyh The controlled mode is not working. (Tested with your example)
This needs to be fixed 👍