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:
parent
36432d45bd
commit
8b112b7615
1 changed files with 2 additions and 2 deletions
|
@ -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 );
|
||||||
|
|
Loading…
Reference in a new issue