0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Don't fire an input event on setHTML call.

This commit is contained in:
Neil Jenkins 2014-12-30 10:22:39 +07:00
parent 249ea93c13
commit 8e8874b554
3 changed files with 9 additions and 5 deletions

View file

@ -1593,7 +1593,6 @@ proto.undo = function () {
this._recordUndoState( this.getSelection() ); this._recordUndoState( this.getSelection() );
this._undoIndex -= 1; this._undoIndex -= 1;
this._ignoreChange = true;
this._setHTML( this._undoStack[ this._undoIndex ] ); this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark(); var range = this._getRangeAndRemoveBookmark();
if ( range ) { if ( range ) {
@ -1616,7 +1615,6 @@ proto.redo = function () {
undoStackLength = this._undoStackLength; undoStackLength = this._undoStackLength;
if ( undoIndex + 1 < undoStackLength && this._isInUndoState ) { if ( undoIndex + 1 < undoStackLength && this._isInUndoState ) {
this._undoIndex += 1; this._undoIndex += 1;
this._ignoreChange = true;
this._setHTML( this._undoStack[ this._undoIndex ] ); this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark(); var range = this._getRangeAndRemoveBookmark();
if ( range ) { if ( range ) {
@ -3122,6 +3120,7 @@ proto._setHTML = function ( html ) {
do { do {
fixCursor( node ); fixCursor( node );
} while ( node = getNextBlock( node ) ); } while ( node = getNextBlock( node ) );
this._ignoreChange = true;
}; };
proto.getHTML = function ( withBookMark ) { proto.getHTML = function ( withBookMark ) {
@ -3173,6 +3172,9 @@ proto.setHTML = function ( html ) {
fixCursor( node ); fixCursor( node );
} }
// Don't fire an input event
this._ignoreChange = true;
// Remove existing body children // Remove existing body children
var body = this._body; var body = this._body;
while ( child = body.lastChild ) { while ( child = body.lastChild ) {

File diff suppressed because one or more lines are too long

View file

@ -515,7 +515,6 @@ proto.undo = function () {
this._recordUndoState( this.getSelection() ); this._recordUndoState( this.getSelection() );
this._undoIndex -= 1; this._undoIndex -= 1;
this._ignoreChange = true;
this._setHTML( this._undoStack[ this._undoIndex ] ); this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark(); var range = this._getRangeAndRemoveBookmark();
if ( range ) { if ( range ) {
@ -538,7 +537,6 @@ proto.redo = function () {
undoStackLength = this._undoStackLength; undoStackLength = this._undoStackLength;
if ( undoIndex + 1 < undoStackLength && this._isInUndoState ) { if ( undoIndex + 1 < undoStackLength && this._isInUndoState ) {
this._undoIndex += 1; this._undoIndex += 1;
this._ignoreChange = true;
this._setHTML( this._undoStack[ this._undoIndex ] ); this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark(); var range = this._getRangeAndRemoveBookmark();
if ( range ) { if ( range ) {
@ -2044,6 +2042,7 @@ proto._setHTML = function ( html ) {
do { do {
fixCursor( node ); fixCursor( node );
} while ( node = getNextBlock( node ) ); } while ( node = getNextBlock( node ) );
this._ignoreChange = true;
}; };
proto.getHTML = function ( withBookMark ) { proto.getHTML = function ( withBookMark ) {
@ -2095,6 +2094,9 @@ proto.setHTML = function ( html ) {
fixCursor( node ); fixCursor( node );
} }
// Don't fire an input event
this._ignoreChange = true;
// Remove existing body children // Remove existing body children
var body = this._body; var body = this._body;
while ( child = body.lastChild ) { while ( child = body.lastChild ) {