Esanders has uploaded a new change for review.

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

Change subject: Prevent toolGroup hack from running twice
......................................................................

Prevent toolGroup hack from running twice

Change-Id: I8f817c09afb2211e549935998bf71e98f0de9dfe
---
M modules/ve.ui.CiteFromIdInspectorTool.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Citoid 
refs/changes/88/230088/1

diff --git a/modules/ve.ui.CiteFromIdInspectorTool.js 
b/modules/ve.ui.CiteFromIdInspectorTool.js
index 8967fc3..e2bbdc8 100644
--- a/modules/ve.ui.CiteFromIdInspectorTool.js
+++ b/modules/ve.ui.CiteFromIdInspectorTool.js
@@ -23,6 +23,10 @@
                // to replace. This way, if toolbarGroups are changed in VE code
                // we won't have to manually change the index here.
                for ( j = 0, jLen = toolGroups.length; j < jLen; j++ ) {
+                       if ( ve.getProp( toolGroups[j], 'include', 0 ) === 
'citefromid' ) {
+                               citeIndex = -1;
+                               break;
+                       }
                        if ( ve.getProp( toolGroups[j], 'include', 0, 'group' ) 
=== 'cite' ) {
                                citeIndex = j;
                                break;
@@ -30,7 +34,9 @@
                }
 
                // HACK: Replace the previous cite group with the citoid tool.
-               toolGroups[ citeIndex ] = { include: [ 'citefromid' ] };
+               if ( citeIndex !== -1 ) {
+                       toolGroups[ citeIndex ] = { include: [ 'citefromid' ] };
+               }
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f817c09afb2211e549935998bf71e98f0de9dfe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Citoid
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

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

Reply via email to