jodit
jodit copied to clipboard
Cutting all text does not trigger an on change event
Jodit Version: 3.24.2 Browser: Chrome OS: Windows Is React App: False
Code
// Selecting all text and cutting (ctrl + x) deletes text but does not trigger the on change event handler
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<textarea id="editor" name="editor"></textarea>
<button onclick="printValue()">Print to Console</button>
<script>
var editor = Jodit.make('#editor');
editor.value = 'Hello';
editor.events.on('change', () => console.log(editor.value));
function printValue() {
console.log(editor.value);
}
</script>
</body>
</html>
Expected behavior: Selecting all text in the window and pressing ctrl+x displays <p><br></p>
on the console. Clicking the Print button after cutting displays <p><br></p>
on the console.
Actual behavior: Selecting all text in the window and pressing ctrl+x displays nothing on the console. Clicking the Print button after cutting displays <p><br></p>
on the console.