onChange function not called if value changes back to original value
See original GitHub issueDescription
the Editor onChange
prop function is called every time the value in the editor changes. Like when typing. Unless that typing leads back to the original value, from the value
prop, from when the Editor was first loaded
//...
const handleEditorChange = (value: string | undefined, event: monaco.editor.IModelContentChangedEvent) => {
console.log('Text change')
}
//...
return (
<Editor
height="100%"
value={text}
onMount={handleEditorDidMount}
onChange={handleEditorChange}
/>
)
//...
Expected behavior onChange should always be called. A change back to the original value is still a change
"@monaco-editor/react": "^4.1.3",
"monaco-editor": "^0.23.0",
I understand the onChange prop is probably not called because, since the value is changed back to the original, then there “are no changes” anymore. However, I need a way to know if the value has both, been changed, and been changed back to original. With no function running for the latter -how can I tell?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
input onChange function not being called when value changes
What I'm asking is: is it possible to force an onChange event to fire, or preferably, have the onChange event fire when the...
Read more >OnChange event on controls not consistent when default ...
It seems that some controls don't fire the OnChange action when the default value property is set/bound to an output from a component:....
Read more >Value of field doesn't change if the field type is itemtype and ...
My scenario is after selecting any value in field 'A' which is of item type, I have to set/change the value of field...
Read more >Solved: OnChange script not working as intended - ServiceNow
You will need an onLoad script to perform essentially the same functionality, as onChange will only fire when the value changes. View solution ......
Read more >How onchange Event work in JavaScript | Examples - eduCBA
One question comes like when this change event can trigger or there is an intention to get the changed or variated value into...
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
Hello @Seanmclem
It should be fixed, but for now either replace
value
withdefaultValue
or handleon change
manually; check this@Seanmclem Could you share a complete snippet of the code you ended up using. Currently encountering a similar error #278 and think it could help! Thanks for the help