-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "HIX score outdated" #2401
Fix "HIX score outdated" #2401
Conversation
Code Climate has analyzed commit 1b137d5 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 76.7%. View more on Code Climate. |
e921225
to
316d4aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR 💪 It fixes the problem 🙂
But some side effect was found:
- an unsaved warning will be shown when some changes are really made and the page is published or saved as draft. For example, add some words in a page and save it.
- After leaving this unsaved warning by chosing "Verlassen" and saving the page several times,
IntegrityError
will be raised.
316d4aa
to
3286df3
Compare
I cut out everything not related to this issue and put it in #2476 |
bcbedd3
to
44fec1f
Compare
…tent used to get current value Co-authored-by: Tory <[email protected]>
44fec1f
to
1b137d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates 🙂 Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Short description
Any action within the tinymce editor modifies the content, and should thus set the content to be dirty. At least, this is the assumption of tinymce. But there are actions that do not modify the content, like making a selection, or end up at a previous state, like adding a character back after accidentally removing it.
This PR fixes this problem by simply monkeypatching tinymce's
isDirty()
andsetDirty()
methods, always comparing it to a previous value and saving that on successful autosaves.Evaluating the HIX score also sets such a value to use as basis for determining whether an earlier score is actually outdated or not.
Proposed changes
isDirty()
andsetDirty()
to actually represent the content being different from the last saved statestartContent
property that is initialised to the initial content and then never used anywhereSide effects
isDirty()
behaves differently now (not relying on theisNotDirty
property anymore) andsetDirty()
tries to keepisNotDirty
in line with what the newisDirty()
would probably return if no changes to this are missed (this might get out of sync when an autosave is performed)Additional notes
Resolved issues
Fixes: #2300
Pull Request Review Guidelines