mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Stop using DOM mutation events to detect changes.
Unreliable in some browsers, and may be deprecated in the future.
This commit is contained in:
parent
a2ef14e218
commit
d24aba73ad
2 changed files with 13 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
@ -307,7 +307,18 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
|||
fireEvent( 'input' );
|
||||
};
|
||||
|
||||
body.addEventListener( 'DOMCharacterDataModified', docWasChanged, false );
|
||||
addEventListener( 'keyup', function ( event ) {
|
||||
var code = event.keyCode;
|
||||
// Presume document was changed if:
|
||||
// 1. A modifier key (other than shift) wasn't held down
|
||||
// 2. The key pressed is not in range 16<=x<=20 (control keys)
|
||||
// 3. The key pressed is not in range 33<=x<=45 (navigation keys)
|
||||
if ( !event.ctrlKey && !event.metaKey && !event.altKey &&
|
||||
( code < 16 || code > 20 ) &&
|
||||
( code < 33 || code > 45 ) ) {
|
||||
docWasChanged();
|
||||
}
|
||||
});
|
||||
|
||||
// Leaves bookmark
|
||||
var recordUndoState = function ( range ) {
|
||||
|
|
Loading…
Reference in a new issue