Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Don't add <br> tag on the first <li> removed in removeFormatting
Browse files Browse the repository at this point in the history
RELNOTES: Don't add `<br>` tag on the first `<li>` removed in `goog.editor.plugins.RemoveFormatting`.
PiperOrigin-RevId: 444279148
Change-Id: I9128e377db59b34003a2857f7b6a5e02033a9173
  • Loading branch information
Closure Team authored and copybara-github committed Apr 25, 2022
1 parent a91b57a commit 7d36ac4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion closure/goog/editor/plugins/removeformatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ goog.editor.plugins.RemoveFormatting.prototype.removeFormattingWorker_ =
break;

case String(goog.dom.TagName.TR):
// Don't add a newline for the first TR.
case String(goog.dom.TagName.LI):
// Don't add a newline for the first TR or LI.
if (node.previousSibling) {
goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
}
Expand Down
6 changes: 3 additions & 3 deletions closure/goog/editor/plugins/removeformatting_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ testSuite({
FORMATTER.removeFormatting_();
// Test that we split the list.
assertHTMLEquals(
'<ul><li>one</li></ul><br>two<ul><li>three</li></ul>',
'<ul><li>one</li></ul>two<ul><li>three</li></ul>',
div.innerHTML);
FIELDMOCK.$verify();
});
Expand All @@ -468,7 +468,7 @@ testSuite({
FORMATTER.removeFormatting_();
// Test that we completely remove the list.
assertHTMLEquals(
'<br>one<br>two<br>threeafter', div.innerHTML);
'one<br>two<br>threeafter', div.innerHTML);
FIELDMOCK.$verify();
});
},
Expand Down Expand Up @@ -502,7 +502,7 @@ testSuite({
FORMATTER.removeFormatting_();
// Test that we leave the list start alone.
assertHTMLEquals(
'<ul><li>one</li></ul><br>two<br>threeafter',
'<ul><li>one</li></ul>two<br>threeafter',
div.innerHTML);
FIELDMOCK.$verify();
});
Expand Down

0 comments on commit 7d36ac4

Please # to comment.