jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.41k stars 1.16k forks source link

Click link when cursor is inside Editor - only second click fires #1318

Open george-of-314 opened 1 year ago

george-of-314 commented 1 year ago

Simple code to show HTML code of text inside Draft Editor

const [showCode, setShowCode] = useState(false);
const SwitchHTML = () => (
        <div style={{ textAlign: "right" }}>
           <a href="#switchHTML" onClick={(e) => toggleShowCode(e)}>Code {showCode ? "ausblenden" : "anzeigen"}</a>
        </div>);

const toggleShowCode = (e) => {
        e.preventDefault()
        setShowCode(!showCode)
}

When cursor is inside editor and I press "Code anzeigen" - action fires only after second click. When cursor is outside of Editor - all is fine But most strange is that all other links and switches are working fine...

Any ideas?

https://youtu.be/49j1LyP4QxE