Santhosh has uploaded a new change for review.

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

Change subject: When removing figures, use a placeholder instead of empty figure
......................................................................

When removing figures, use a placeholder instead of empty figure

Empty figure tags does not work. User can add the figure again
by clicking on the placeholder(Add translation placeholder)

Similarly when machine translation is disabled, instead of providing
an empty figure, fill the image and provide empty figcaption

Bug: 73547
Change-Id: I08fea1340c65562a298c827752b1eba043b0192c
---
M modules/translation/ext.cx.translation.js
1 file changed, 21 insertions(+), 6 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 4c1700b..d2383fb 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -231,15 +231,30 @@
                                .attr( {
                                        id: 'cx' + sourceId,
                                        'data-source': sourceId,
-                                       'data-cx-state': 'source',
-                               } );
+                       'data-cx-state': 'source',
+                       } );
 
-                       if ( origin === 'mt-user-disabled' || origin === 
'clear' ) {
+                       if ( origin === 'mt-user-disabled' ) {
                                $clone.attr( 'data-cx-state', 'empty' );
-                               $clone.empty();
-                       } // else: service-failure, non-editable, 
mt-not-available
+                               if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
+                                       // Clear figure caption alone.
+                                       $clone.find( 'figcaption' ).empty();
+                               } else {
+                                       $clone.empty();
+                               }
+                       }
 
-                       // Replace the placeholder with a translatable element
+                       if ( origin === 'clear' ) {
+                               $clone.attr( 'data-cx-state', 'empty' );
+                               if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
+                                       // When clearing figures, replace it 
with placeholder.
+                                       $clone = getPlaceholder( sourceId )
+                                               .attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
+                               } else {
+                                       $clone.empty();
+                               }
+                       } // else: service-failure, non-editable, 
mt-not-available
+                        // Replace the placeholder with a translatable element
                        $section.replaceWith( $clone );
 
                        // $section was replaced. Get the updated instance.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I08fea1340c65562a298c827752b1eba043b0192c
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

Reply via email to