Santhosh has uploaded a new change for review.

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

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(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 45ffb35..3a7cf69 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.prop( 'tagName' ) 
=== 'UL' ) {
+                                       $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.prop( 'tagName' ) 
=== 'UL' ) {
+                                       $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: newchange
Gerrit-Change-Id: I52a26d67aef2e8e248565fb7f8ccc3b0b36d6571
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