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

Fix whitespace.

This commit is contained in:
Neil Jenkins 2015-06-17 14:07:46 +07:00
parent a36cb12a16
commit 36432d45bd
3 changed files with 19 additions and 19 deletions

View file

@ -3621,7 +3621,7 @@ proto.setTextDirection = function ( direction ) {
}; };
function forEachChildInRange( rootNode, range, iterator ) { function forEachChildInRange ( rootNode, range, iterator ) {
var walker = new TreeWalker( rootNode, SHOW_ELEMENT|SHOW_TEXT, var walker = new TreeWalker( rootNode, SHOW_ELEMENT|SHOW_TEXT,
function ( node ) { function ( node ) {
return node.parentNode === rootNode && return node.parentNode === rootNode &&
@ -3634,11 +3634,11 @@ function forEachChildInRange( rootNode, range, iterator ) {
} }
} }
function mapEachChildInRange( rootNode, range, iterator ) { function mapEachChildInRange ( rootNode, range, iterator ) {
var output = []; var output = [];
forEachChildInRange( rootNode, range, function ( node ) { forEachChildInRange( rootNode, range, function ( node ) {
output.push( iterator( node ) ); output.push( iterator( node ) );
} ); });
return output; return output;
} }
@ -3687,17 +3687,17 @@ proto.removeAllFormatting = function ( range ) {
} else if ( isInline( node ) ) { } else if ( isInline( node ) ) {
contents.push( doc.createTextNode( node.textContent ) ); contents.push( doc.createTextNode( node.textContent ) );
} }
} ); });
var oldContents = mapEachChildInRange( stopNode, range, function ( node ) { var oldContents = mapEachChildInRange( stopNode, range, function ( node ) {
return node; return node;
} ); });
contents.forEach( function ( node ) { contents.forEach( function ( node ) {
stopNode.insertBefore( node, oldContents[0] ); stopNode.insertBefore( node, oldContents[0] );
} ); });
oldContents.forEach( function ( node ) { oldContents.forEach( function ( node ) {
stopNode.removeChild( node ); stopNode.removeChild( node );
} ); });
this.setSelection( this._getRangeAndRemoveBookmark() ); this.setSelection( this._getRangeAndRemoveBookmark() );

File diff suppressed because one or more lines are too long

View file

@ -2163,7 +2163,7 @@ proto.setTextDirection = function ( direction ) {
}; };
function forEachChildInRange( rootNode, range, iterator ) { function forEachChildInRange ( rootNode, range, iterator ) {
var walker = new TreeWalker( rootNode, SHOW_ELEMENT|SHOW_TEXT, var walker = new TreeWalker( rootNode, SHOW_ELEMENT|SHOW_TEXT,
function ( node ) { function ( node ) {
return node.parentNode === rootNode && return node.parentNode === rootNode &&
@ -2176,11 +2176,11 @@ function forEachChildInRange( rootNode, range, iterator ) {
} }
} }
function mapEachChildInRange( rootNode, range, iterator ) { function mapEachChildInRange ( rootNode, range, iterator ) {
var output = []; var output = [];
forEachChildInRange( rootNode, range, function ( node ) { forEachChildInRange( rootNode, range, function ( node ) {
output.push( iterator( node ) ); output.push( iterator( node ) );
} ); });
return output; return output;
} }
@ -2195,8 +2195,8 @@ proto.removeAllFormatting = function ( range ) {
while ( stylingNodeNames.test( getPath( stopNode ) ) ) { while ( stylingNodeNames.test( getPath( stopNode ) ) ) {
stopNode = stopNode.parentNode; stopNode = stopNode.parentNode;
} }
if (stopNode.nodeType === TEXT_NODE) {
return false; return false;
if ( stopNode.nodeType === TEXT_NODE ) {
} }
moveRangeBoundariesUpTree( range, stopNode ); moveRangeBoundariesUpTree( range, stopNode );
@ -2212,14 +2212,14 @@ proto.removeAllFormatting = function ( range ) {
split( endContainer, endOffset, stopNode ); split( endContainer, endOffset, stopNode );
split( startContainer, startOffset, stopNode ); split( startContainer, startOffset, stopNode );
range = this._getRangeAndRemoveBookmark(null, true); range = this._getRangeAndRemoveBookmark( null, true );
moveRangeBoundariesUpTree( range, stopNode ); moveRangeBoundariesUpTree( range, stopNode );
this._saveRangeToBookmark( range ); this._saveRangeToBookmark( range );
var that = this; var that = this;
var contents = []; var contents = [];
forEachChildInRange( stopNode, range, function cleanSingleNode( node ) { forEachChildInRange( stopNode, range, function cleanSingleNode ( node ) {
if ( isContainer( node ) ) { if ( isContainer( node ) ) {
forEachChildInRange( node, range, cleanSingleNode ); forEachChildInRange( node, range, cleanSingleNode );
} else if ( isBlock( node ) ) { } else if ( isBlock( node ) ) {
@ -2229,17 +2229,17 @@ proto.removeAllFormatting = function ( range ) {
} else if ( isInline( node ) ) { } else if ( isInline( node ) ) {
contents.push( doc.createTextNode( node.textContent ) ); contents.push( doc.createTextNode( node.textContent ) );
} }
} ); });
var oldContents = mapEachChildInRange( stopNode, range, function ( node ) { var oldContents = mapEachChildInRange( stopNode, range, function ( node ) {
return node; return node;
} ); });
contents.forEach( function ( node ) { contents.forEach( function ( node ) {
stopNode.insertBefore( node, oldContents[0] ); stopNode.insertBefore( node, oldContents[0] );
} ); });
oldContents.forEach( function ( node ) { oldContents.forEach( function ( node ) {
stopNode.removeChild( node ); stopNode.removeChild( node );
} ); });
this.setSelection( this._getRangeAndRemoveBookmark() ); this.setSelection( this._getRangeAndRemoveBookmark() );