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

Fix whitespace errors.

Thanks to @gertsonderby who pointed these out in #138.
This commit is contained in:
Neil Jenkins 2015-09-28 15:48:23 +02:00
parent 0ec3c43791
commit 9461368a5c
3 changed files with 12 additions and 12 deletions

View file

@ -698,7 +698,7 @@ var insertNodeInRange = function ( range, node ) {
childCount = children.length; childCount = children.length;
if ( startOffset === childCount) { if ( startOffset === childCount ) {
startContainer.appendChild( node ); startContainer.appendChild( node );
} else { } else {
startContainer.insertBefore( node, children[ startOffset ] ); startContainer.insertBefore( node, children[ startOffset ] );
@ -2705,7 +2705,7 @@ proto._keyUpDetectChange = function ( event ) {
// 3. The key pressed is not in range 33<=x<=45 (navigation keys) // 3. The key pressed is not in range 33<=x<=45 (navigation keys)
if ( !event.ctrlKey && !event.metaKey && !event.altKey && if ( !event.ctrlKey && !event.metaKey && !event.altKey &&
( code < 16 || code > 20 ) && ( code < 16 || code > 20 ) &&
( code < 33 || code > 45 ) ) { ( code < 33 || code > 45 ) ) {
this._docWasChanged(); this._docWasChanged();
} }
}; };
@ -2734,7 +2734,7 @@ proto._recordUndoState = function ( range ) {
undoStack = this._undoStack; undoStack = this._undoStack;
// Truncate stack if longer (i.e. if has been previously undone) // Truncate stack if longer (i.e. if has been previously undone)
if ( undoIndex < this._undoStackLength) { if ( undoIndex < this._undoStackLength ) {
undoStack.length = this._undoStackLength = undoIndex; undoStack.length = this._undoStackLength = undoIndex;
} }
@ -2898,9 +2898,9 @@ proto._addFormat = function ( tag, attributes, range ) {
SHOW_TEXT|SHOW_ELEMENT, SHOW_TEXT|SHOW_ELEMENT,
function ( node ) { function ( node ) {
return ( node.nodeType === TEXT_NODE || return ( node.nodeType === TEXT_NODE ||
node.nodeName === 'BR'|| node.nodeName === 'BR' ||
node.nodeName === 'IMG' ) && node.nodeName === 'IMG'
isNodeContainedInRange( range, node, true ); ) && isNodeContainedInRange( range, node, true );
}, },
false false
); );

View file

@ -581,7 +581,7 @@ proto._keyUpDetectChange = function ( event ) {
// 3. The key pressed is not in range 33<=x<=45 (navigation keys) // 3. The key pressed is not in range 33<=x<=45 (navigation keys)
if ( !event.ctrlKey && !event.metaKey && !event.altKey && if ( !event.ctrlKey && !event.metaKey && !event.altKey &&
( code < 16 || code > 20 ) && ( code < 16 || code > 20 ) &&
( code < 33 || code > 45 ) ) { ( code < 33 || code > 45 ) ) {
this._docWasChanged(); this._docWasChanged();
} }
}; };
@ -610,7 +610,7 @@ proto._recordUndoState = function ( range ) {
undoStack = this._undoStack; undoStack = this._undoStack;
// Truncate stack if longer (i.e. if has been previously undone) // Truncate stack if longer (i.e. if has been previously undone)
if ( undoIndex < this._undoStackLength) { if ( undoIndex < this._undoStackLength ) {
undoStack.length = this._undoStackLength = undoIndex; undoStack.length = this._undoStackLength = undoIndex;
} }
@ -774,9 +774,9 @@ proto._addFormat = function ( tag, attributes, range ) {
SHOW_TEXT|SHOW_ELEMENT, SHOW_TEXT|SHOW_ELEMENT,
function ( node ) { function ( node ) {
return ( node.nodeType === TEXT_NODE || return ( node.nodeType === TEXT_NODE ||
node.nodeName === 'BR'|| node.nodeName === 'BR' ||
node.nodeName === 'IMG' ) && node.nodeName === 'IMG'
isNodeContainedInRange( range, node, true ); ) && isNodeContainedInRange( range, node, true );
}, },
false false
); );

View file

@ -66,7 +66,7 @@ var insertNodeInRange = function ( range, node ) {
childCount = children.length; childCount = children.length;
if ( startOffset === childCount) { if ( startOffset === childCount ) {
startContainer.appendChild( node ); startContainer.appendChild( node );
} else { } else {
startContainer.insertBefore( node, children[ startOffset ] ); startContainer.insertBefore( node, children[ startOffset ] );