[MediaWiki-commits] [Gerrit] Remove unwanted span tags getting added to published content - change (mediawiki...ContentTranslation)

2015-08-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove unwanted span tags getting added to published content
..


Remove unwanted span tags getting added to published content

While editing the content, especially when using the Enter key
to break paragraph, and then doing backspace, etc., span tags are
created. These spans get inline style attributes, too. Clean up them
before publishing

Testplan:
Translate some article. In a paragraph, press Enter and then Backspace
to cancel the line break. You will notice a new span created and it will
have a style attribute. Publish such a translation. There should not be
any spans in published wikitext.

Bug: T90724
Change-Id: Ia3b59646403dd7c92aedd68002011c135ed57578
---
M modules/publish/ext.cx.publish.js
1 file changed, 9 insertions(+), 0 deletions(-)

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 03a17e4..3362c6e 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -364,6 +364,15 @@
return $( this ).html();
} );
 
+   // Browsers add spans with inline styles during free 
editing the content.
+   // For example, Chrome adds span on enter key press 
and copies current css styles to inline
+   // styles.
+   $section.find( 'span' ).replaceWith( function () {
+   if ( !!$( this ).attr( 'style' ) ) {
+   return $( this ).html();
+   }
+   } );
+
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3b59646403dd7c92aedd68002011c135ed57578
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com
Gerrit-Reviewer: Amire80 amir.ahar...@mail.huji.ac.il
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove unwanted span tags getting added to published content - change (mediawiki...ContentTranslation)

2015-08-02 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/228773

Change subject: Remove unwanted span tags getting added to published content
..

Remove unwanted span tags getting added to published content

While editing the content, especially when using enter key press
to break paragraph, and then doing backspace etc, span tags are
created. These spans get inline style attributes too. Clean up them
before publishing

Testplan:
Translate some article. In a paragraph, press enter and then backspace
to cancel the line break. You will notice a new span created and it will
have style attribute. Publish such a translation. There should not be
any spans in published wikitext.

Bug: T90724
Change-Id: Ia3b59646403dd7c92aedd68002011c135ed57578
---
M modules/publish/ext.cx.publish.js
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/73/228773/1

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 03a17e4..3362c6e 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -364,6 +364,15 @@
return $( this ).html();
} );
 
+   // Browsers add spans with inline styles during free 
editing the content.
+   // For example, Chrome adds span on enter key press 
and copies current css styles to inline
+   // styles.
+   $section.find( 'span' ).replaceWith( function () {
+   if ( !!$( this ).attr( 'style' ) ) {
+   return $( this ).html();
+   }
+   } );
+
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3b59646403dd7c92aedd68002011c135ed57578
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits