jenkins-bot has submitted this change and it was merged.
Change subject: Do not fire mw.cx.select.word on empty string
......................................................................
Do not fire mw.cx.select.word on empty string
Change-Id: I890418886cd9c50b1b43570f301a1d583e10925f
---
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.translation.js
2 files changed, 2 insertions(+), 2 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 27771f4..4758926 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -171,7 +171,7 @@
mw.hook( 'mw.cx.source.loaded' ).add( $.proxy( this.load, this
) );
this.$content.on( 'click', function () {
var selection = window.getSelection().toString();
- if ( selection ) {
+ if ( selection.trim() ) {
mw.hook( 'mw.cx.select.word' ).fire( selection
);
}
} );
diff --git a/modules/translation/ext.cx.translation.js
b/modules/translation/ext.cx.translation.js
index a1f85b7..907af50 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -155,7 +155,7 @@
$section.on( 'click keyup', $.debounce( 250, function () {
var selection = window.getSelection().toString();
- if ( selection ) {
+ if ( selection.trim() ) {
// In this case, user is interested in
targetLanguage->targetLanguage
// dictionary lookup. Or synonyms.
mw.hook( 'mw.cx.select.word' ).fire( selection,
mw.cx.targetLanguage, mw.cx.targetLanguage );
--
To view, visit https://gerrit.wikimedia.org/r/160425
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I890418886cd9c50b1b43570f301a1d583e10925f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Jsahleen <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits