Ankita-ks has uploaded a new change for review.

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

Change subject: Suggestions displayed on clicking the highlighted error
......................................................................

Suggestions displayed on clicking the highlighted error

Change-Id: Ic6d5695f6f7cf05846e7c9478bf1651429b3eb65
---
M modules/ext.LanguageToolDialog.js
1 file changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LanguageTool 
refs/changes/72/232572/1

diff --git a/modules/ext.LanguageToolDialog.js 
b/modules/ext.LanguageToolDialog.js
index d407816..29822d3 100644
--- a/modules/ext.LanguageToolDialog.js
+++ b/modules/ext.LanguageToolDialog.js
@@ -153,6 +153,7 @@
                                doneButton.$element
                        )
                );
+       this.handleClicks.bind( this );
 };
 
 /**
@@ -171,6 +172,7 @@
                        this.surface.getModel().connect( this, { 
documentUpdate: this.updateFragmentsDebounced } );
                        this.surface.getView().connect( this, { position: 
this.renderFragmentsDebounced } );
                        this.surface.getView().$window.on( 'scroll', 
this.onWindowScrollDebounced );
+                       this.surface.getModel().on('select', 
this.handleClicks.bind( this ) );
 
                        text = fragment.getText();
                        if ( text && text !== this.findText.getValue() ) {
@@ -180,6 +182,21 @@
                        this.initialFragment = fragment;
                }, this );
 };
+
+mw.LanguageToolDialog.prototype.handleClicks = function ( e ) {
+       var i, r, range;
+
+       if( !e.isNull() ) {
+               var range = e.getRange();
+               for ( i = 0; i < this.fragments.length; i++) {
+                       r = this.fragments[ i ].getSelection().getRange();
+                       if( r.start <= range.start && r.end >=range.end ) {
+                               this.focusedIndex = i;
+                               this.highlightFocused();
+                       }
+               }
+       }
+}
 
 /**
  * @inheritdoc
@@ -581,7 +598,7 @@
 };
 // End of wrapper code by James Padolsey
 
-mw.LanguageToolDialog.prototype.displayInformation = function () {
+mw.LanguageToolDialog.prototype.displayInformation = function ( clickFlag ) {
        var i, index, replacements, error, replaceArr, len;
 
        if ( this.errors && this.errors.length > this.focusedIndex ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6d5695f6f7cf05846e7c9478bf1651429b3eb65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LanguageTool
Gerrit-Branch: master
Gerrit-Owner: Ankita-ks <[email protected]>

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

Reply via email to