jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/339103 )
Change subject: For the mode switch tool, show a different tooltip when disabled ...................................................................... For the mode switch tool, show a different tooltip when disabled Bug: T158723 Change-Id: I8c397e9b10c51d78c0b0f18c494ca9f36400d23e --- M extension.json M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json M modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js 4 files changed, 18 insertions(+), 2 deletions(-) Approvals: Esanders: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index a5132f7..5a4a5ea 100644 --- a/extension.json +++ b/extension.json @@ -319,7 +319,8 @@ "tooltip-ca-editsource", "tooltip-ca-ve-edit", "visualeditor-ca-editsource-section", - "visualeditor-mweditmodeve-tool" + "visualeditor-mweditmodeve-tool", + "visualeditor-mweditmodeve-tool-unavailable" ], "position": "top" }, @@ -1144,6 +1145,7 @@ "visualeditor-mweditmodeve-showagain", "visualeditor-mweditmodeve-title", "visualeditor-mweditmodeve-tool", + "visualeditor-mweditmodeve-tool-unavailable", "visualeditor-mweditmodeve-warning", "visualeditor-mweditmodewt-popup-body", "visualeditor-mweditmodewt-popup-title", diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 5dfe4c6..9814f50 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -285,6 +285,7 @@ "visualeditor-mweditmodeve-showagain": "Don't show this message again", "visualeditor-mweditmodeve-title": "Switch to visual editing?", "visualeditor-mweditmodeve-tool": "Switch to visual editing", + "visualeditor-mweditmodeve-tool-unavailable": "Visual editing is not available here", "visualeditor-mweditmodeve-warning": "You are switching to visual editing.\nDo you want to continue?", "visualeditor-mweditmodewt-popup-body": "You can switch back to source editing at any time by clicking on this icon.", "visualeditor-mweditmodewt-popup-title": "You have switched to visual editing", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index 6a138e3..8cb78fb 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -298,6 +298,7 @@ "visualeditor-mweditmodeve-showagain": "Label for the checkboxes to not show one of the 'switched to visual mode' or 'switched to source mode' popups again", "visualeditor-mweditmodeve-title": "Title of dialog to confirm switching to visual mode.", "visualeditor-mweditmodeve-tool": "Label for tool that changes edit mode to visual editing.", + "visualeditor-mweditmodeve-tool-unavailable": "Label for tool that changes edit mode to visual editing when it is not available.", "visualeditor-mweditmodeve-warning": "Warning message show before changing edit mode to visual editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}}, or instaed that they'd need to start source editing from scratch using {{msg-mw|Visualeditor-mweditmodesource-warning-switch-discard}}.", "visualeditor-mweditmodewt-popup-body": "Body text of popup shown after switching to visual mode from source mode", "visualeditor-mweditmodewt-popup-title": "Title of popup shown after switching to visual mode from source mode", diff --git a/modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js b/modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js index 375c7ac..3315472 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js @@ -131,9 +131,21 @@ * @inheritdoc */ ve.ui.MWEditModeVisualTool.prototype.onUpdateState = function () { + var isVisualModeNowAvailable = ve.init.target.isModeAvailable( 'visual' ); + // Parent method ve.ui.MWEditModeVisualTool.super.prototype.onUpdateState.apply( this, arguments ); - this.setDisabled( !ve.init.target.isModeAvailable( 'visual' ) ); + // Cached for performance + if ( this.isVisualModeAvailable !== isVisualModeNowAvailable ) { + this.isVisualModeAvailable = isVisualModeNowAvailable; + + this.setDisabled( !isVisualModeNowAvailable ); + this.setTitle( OO.ui.msg( + isVisualModeNowAvailable ? + 'visualeditor-mweditmodeve-tool' : + 'visualeditor-mweditmodeve-tool-unavailable' + ) ); + } }; ve.ui.toolFactory.register( ve.ui.MWEditModeVisualTool ); -- To view, visit https://gerrit.wikimedia.org/r/339103 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8c397e9b10c51d78c0b0f18c494ca9f36400d23e Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits