0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 23:40:35 -05:00

Ensure removeAllFormatting always returns self.

This commit is contained in:
Neil Jenkins 2015-06-17 14:23:52 +07:00
parent 36432d45bd
commit 8b112b7615

View file

@ -2188,15 +2188,15 @@ var stylingNodeNames = /(^|>)(?:B|I|S|SUB|SUP|U|BLOCKQUOTE|OL|UL|LI|T(?:ABLE|BOD
proto.removeAllFormatting = function ( range ) { proto.removeAllFormatting = function ( range ) {
if ( !range && !( range = this.getSelection() ) || range.collapsed ) { if ( !range && !( range = this.getSelection() ) || range.collapsed ) {
return false; return this;
} }
var stopNode = range.commonAncestorContainer; var stopNode = range.commonAncestorContainer;
while ( stylingNodeNames.test( getPath( stopNode ) ) ) { while ( stylingNodeNames.test( getPath( stopNode ) ) ) {
stopNode = stopNode.parentNode; stopNode = stopNode.parentNode;
} }
return false;
if ( stopNode.nodeType === TEXT_NODE ) { if ( stopNode.nodeType === TEXT_NODE ) {
return this;
} }
moveRangeBoundariesUpTree( range, stopNode ); moveRangeBoundariesUpTree( range, stopNode );