Santhosh has uploaded a new change for review.

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

Change subject: Bind link handlers to source links even if target section is 
empty
......................................................................

Bind link handlers to source links even if target section is empty

If target section has not links, llink handlers were not added to
links in source section. This is problematic.

Make sure all source and target links are with link handlers.

Change-Id: I052e22c04f93c0ca9ab9824ae12641d8f43d0b1f
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 79485bc..b44c0a3 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -280,7 +280,7 @@
                selection = mw.cx.selection.get();
                $link = $( '<a>' )
                        .addClass( 'cx-target-link' )
-                       .text( selection.toString() )
+                       .text( selection.toString() || this.title )
                        .attr( {
                                title: this.title,
                                href: this.title,
@@ -870,8 +870,10 @@
         */
        function adaptLinks( $section ) {
                var $links,
+                       $sourceSection,
                        sourceLinkTargets = [];
 
+               $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
                $links = $section.find( 'a[rel="mw:WikiLink"]' );
 
                if ( !$section.data( 'cx-draft' ) ) {
@@ -885,6 +887,10 @@
                        .done( function () {
                                $links.cxTargetLink();
                        } );
+               $sourceSection.find( 'a[rel="mw:WikiLink"]' ).each( function () 
{
+                       $( this ).cxSourceLink();
+               } );
+
        }
 
        mw.cx.tools.link = LinkCard;

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

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