When I delete some text in the contenteditable div in mistake, I can reverse it with Ctrl + z.
But after I made some change with javascript. I can't use Ctrl + z to reverse to previous change.
For example, when I add node to the selected text ,like <p>
or <h1>
, I could not reverse the content to previous change.
jsfiddle.net/NfGM3/
(bad coding because I am new to window.getSelection()
)
I use div instead of textarea because I want to add some node into the content.
So, how can I make it reversible in contenteditable div after change made with js ?