mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Remove empty lines in visual mode in some more cases
After switching from source mode to visual mode, there will be some
Parsoid-generated white space between block nodes, which remains when
the reply is posted in visual mode.
Follow-up to e064f43499
.
Bug: T300439
Change-Id: Ia5d2c06f0a4125e9f148eddd3235f95138c9d37f
This commit is contained in:
parent
bacf6a8fc6
commit
6572e108f9
|
@ -588,10 +588,14 @@ class CommentModifier {
|
|||
// as nodes are removed.
|
||||
$childNodeList = iterator_to_array( $container->childNodes );
|
||||
foreach ( $childNodeList as $node ) {
|
||||
if (
|
||||
strtolower( $node->nodeName ) === 'p' &&
|
||||
if ( (
|
||||
$node instanceof Text &&
|
||||
CommentUtils::htmlTrim( $node->nodeValue ?? '' ) === ''
|
||||
) || (
|
||||
$node instanceof Element &&
|
||||
strtolower( $node->tagName ) === 'p' &&
|
||||
CommentUtils::htmlTrim( DOMCompat::getInnerHTML( $node ) ) === ''
|
||||
) {
|
||||
) ) {
|
||||
$container->removeChild( $node );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue