ckeditor4
ckeditor4 copied to clipboard
checkDirty() returns true if clicking or editing a widget, but without changing anything
Type of report
Bug
Provide detailed reproduction steps (if any)
- Go to https://jsfiddle.net/fq2dr3Lc/1/
- Select the widget by clicking the drag handler or click inside it to edit it, but don't change anything.
- Reload the page
Expected result
Page reloads.
Actual result
Browser asks for confirmation.
Other details
If you select the widget, confirmation appears. If you then click after it, confirmation doesn't appear. If you click inside to edit it, confirmation appears. if you then click after it, confirmation appear also.
- Browser: Firefox
- OS: Windows 7
- CKEditor version: 4.14.1
- Installed CKEditor plugins: full
I can confirm the issue - looks like some artifacts (probably from selection) are different between initial editor content and snapshot took for dirty comparison. Couldn't reproduce on Chrome.
I can reproduce it in Chrome not by selecting the widget, but by clicking inside "title" or "content" editable part, dirty flag is set. But, if you then click below the widget in the empty paragraph, dirty flag is unset again. Also, it's not a problem of the initial editor data, but rather the data just before selecting or clicking inside a widget, please see an updated fiddle where I've put a "reset dirty flag" button: https://jsfiddle.net/j1ueo5b7/
- Type something below the widget, in the empty paragraph
- Try to reload the page -> confirmation appears (correct behavior). Hit cancel in reloading.
- Click "Reset dirty flag" button.
- Click inside an editable part of the widget.
- Try to reload the page -> confirmation appears (wrong behavior).
Summary: Firefox: Selecting a widget, sets the dirty flag. Deselecting the widget, unsets the dirty flag. Clicking in editable part, sets the dirty flag and is always set from that point no matter what I do. Chrome: Selecting a widget, doesn't set the dirty flag. Clicking in editable part, sets the dirty flag. Clicking outside the widget, unsets the flag again.
I am able to reproduce on Chrome Version 103.0.5060.134 (Official Build) (64-bit)