jenkins-bot has submitted this change and it was merged.

Change subject: Publish preprocessing: Remove the empty br tags inserted by 
Firefox
......................................................................


Publish preprocessing: Remove the empty br tags inserted by Firefox

Testplan:

Translate some article. Press enter in between a paragraph text to
leave line breaks. In a header, remove the template text, and type something 
new.
Publish.
Expected result: The line breaks in paragraph should appear in published text.
And there should not be any <br> tags in the header.

Bug: T99851
Change-Id: Ia91f2f2fbe42a2a329df0874357147653859fe7c
---
M modules/publish/ext.cx.publish.js
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Amire80: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index c4bc447..0991f9a 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -308,7 +308,14 @@
                // Remove empty sections.
                $content.find( mw.cx.getSectionSelector() ).each( function () {
                        var $section = $( this );
-
+                       // Firefox inserts <br type="_moz"> in Content ediables 
while clearing the content
+                       // to keep the height and caret. 
https://bugzilla.mozilla.org/show_bug.cgi?id=414223
+                       // It is not guaranted that the type attribute will be 
present.
+                       // Remove them. But do not remove breaks from 
paragraphs. They can be intentional
+                       // line breaks.
+                       if ( $section.is( 'h1, h2, h3, h4, h5, h6' ) ) {
+                               $section.find( 'br' ).remove();
+                       }
                        if ( !$.trim( $section.text() ) ) {
                                $section.remove();
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/212774
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia91f2f2fbe42a2a329df0874357147653859fe7c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to