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

Change subject: Allow placing cursor inside empty list when translating from 
scratch
......................................................................


Allow placing cursor inside empty list when translating from scratch

Testplan:
Translate any page with list. Translate such a section, clear it using
"Clear paragraph", try typing to the list items. You should be able
to type there.

Alternatively, try language pairs with different directionality or
choose 'Disable machine translation'

There is some code duplication in the place the fix was made.
Deferred to another commit.

Bug: T103504
Change-Id: I52a26d67aef2e8e248565fb7f8ccc3b0b36d6571
---
M modules/translation/ext.cx.translation.js
1 file changed, 10 insertions(+), 0 deletions(-)

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



diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 45ffb35..f7081ea 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -270,6 +270,11 @@
                                if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
                                        // Clear figure caption alone.
                                        $clone.find( 'figcaption' ).empty();
+                               } else if ( $sourceSection.is( 'ul, ol' ) ) {
+                                       $clone = $sourceSection.clone();
+                                       // Explicit contenteditable attribute 
helps to place the cursor
+                                       // in empty UL.
+                                       $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
                                } else {
                                        $clone.empty();
                                }
@@ -281,6 +286,11 @@
                                        // When clearing figures, replace it 
with placeholder.
                                        $clone = getPlaceholder( sourceId )
                                                .attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
+                               } else if ( $sourceSection.is( 'ul, ol' ) ) {
+                                       $clone = $sourceSection.clone();
+                                       // Explicit contenteditable attribute 
helps to place the cursor
+                                       // in empty UL.
+                                       $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
                                } else {
                                        $clone.empty();
                                }

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

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

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

Reply via email to