mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "EditModeTool: Use state-describing, not action-describing labels"
This commit is contained in:
commit
a93888afd5
|
@ -1136,7 +1136,6 @@
|
|||
"visualeditor-editingtabdialog-ok",
|
||||
"visualeditor-editingtabdialog-title",
|
||||
"visualeditor-mweditmode-tooltip",
|
||||
"visualeditor-mweditmodesource-tool",
|
||||
"visualeditor-mweditmodesource-tool-current",
|
||||
"visualeditor-mweditmodesource-tool-unavailable",
|
||||
"visualeditor-mweditmodesource-warning-cancel",
|
||||
|
@ -1146,7 +1145,6 @@
|
|||
"visualeditor-mweditmodeve-popup-title",
|
||||
"visualeditor-mweditmodeve-showagain",
|
||||
"visualeditor-mweditmodeve-title",
|
||||
"visualeditor-mweditmodeve-tool",
|
||||
"visualeditor-mweditmodeve-tool-current",
|
||||
"visualeditor-mweditmodeve-tool-unavailable",
|
||||
"visualeditor-mweditmodeve-warning",
|
||||
|
|
|
@ -275,7 +275,6 @@
|
|||
"visualeditor-mweditmode-tooltip": "Switch editor",
|
||||
"visualeditor-mweditmodesource-progress": "Switching to source editing…",
|
||||
"visualeditor-mweditmodesource-title": "Switch to source editing?",
|
||||
"visualeditor-mweditmodesource-tool": "Switch to source editing",
|
||||
"visualeditor-mweditmodesource-tool-current": "Source editing",
|
||||
"visualeditor-mweditmodesource-tool-unavailable": "Source editing is not available here",
|
||||
"visualeditor-mweditmodesource-warning": "You are switching to source editing.\nDo you want to continue?",
|
||||
|
@ -287,7 +286,6 @@
|
|||
"visualeditor-mweditmodeve-progress": "Switching to visual editing…",
|
||||
"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-current": "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?",
|
||||
|
|
|
@ -288,8 +288,7 @@
|
|||
"visualeditor-mweditmode-tooltip": "Tooltip text for editor switching menu.",
|
||||
"visualeditor-mweditmodesource-progress": "Title of progress bar shown while switching to source mode.",
|
||||
"visualeditor-mweditmodesource-title": "Title of dialog to confirm switching to source mode.",
|
||||
"visualeditor-mweditmodesource-tool": "Label for tool that changes edit mode to source editing.",
|
||||
"visualeditor-mweditmodesource-tool-current": "Label for tool that changes edit mode to source editing if the user is already in that mode.",
|
||||
"visualeditor-mweditmodesource-tool-current": "Label for tool that changes edit mode to source editing (or describes the mode if the user is already in that mode).",
|
||||
"visualeditor-mweditmodesource-tool-unavailable": "'''Please translate \"Source\" as meaning \"Source codes\", not source of references.''' Label for tool that changes edit mode to source editing when it is not available.",
|
||||
"visualeditor-mweditmodesource-warning": "Warning message show before changing edit mode to source editing. It may allow the user to keep the changes using the message {{msg-mw|Visualeditor-mweditmodesource-warning-switch}} or cancel.",
|
||||
"visualeditor-mweditmodesource-warning-cancel": "Label for the button on the confirmation dialog for switching to source editing to cancel and return to editing.\n{{Identical|Cancel}}",
|
||||
|
@ -300,8 +299,7 @@
|
|||
"visualeditor-mweditmodeve-progress": "Title of progress bar shown while switching to visual mode.",
|
||||
"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-current": "Label for tool that changes edit mode to visual editing if the user is already in that mode.",
|
||||
"visualeditor-mweditmodeve-tool-current": "Label for tool that changes edit mode to visual editing (or describes the mode if the user is already in that mode).",
|
||||
"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",
|
||||
|
|
|
@ -38,8 +38,6 @@ mw.libs.ve.MWEditModeTool.static.autoAddToCatchall = false;
|
|||
|
||||
mw.libs.ve.MWEditModeTool.static.autoAddToGroup = false;
|
||||
|
||||
mw.libs.ve.MWEditModeTool.static.currentTitle = null;
|
||||
|
||||
mw.libs.ve.MWEditModeTool.static.unavailableTooltip = null;
|
||||
|
||||
/* Methods */
|
||||
|
@ -82,32 +80,25 @@ mw.libs.ve.MWEditModeTool.prototype.onSelect = function () {
|
|||
if ( this.getMode() !== this.constructor.static.editMode ) {
|
||||
this.switch();
|
||||
}
|
||||
this.setActive( this.getMode() === this.constructor.static.editMode );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
mw.libs.ve.MWEditModeTool.prototype.onUpdateState = function () {
|
||||
var titleKey,
|
||||
modeAvailable = this.isModeAvailable( this.constructor.static.editMode ),
|
||||
isCurrent = this.getMode() === this.constructor.static.editMode;
|
||||
var modeAvailable = this.isModeAvailable( this.constructor.static.editMode );
|
||||
|
||||
// Change title if state has changed
|
||||
if ( this.isCurrent !== isCurrent || this.modeAvailable !== modeAvailable ) {
|
||||
titleKey = isCurrent ?
|
||||
this.constructor.static.currentTitle :
|
||||
this.constructor.static.title;
|
||||
this.setTitle( OO.ui.resolveMsg( titleKey ) );
|
||||
// Change tooltip if mode is unavailable
|
||||
if ( !modeAvailable ) {
|
||||
this.$link.attr( 'title', OO.ui.resolveMsg( this.constructor.static.unavailableTooltip ) );
|
||||
}
|
||||
if ( this.modeAvailable !== modeAvailable ) {
|
||||
this.$link.attr( 'title', modeAvailable ?
|
||||
OO.ui.resolveMsg( this.constructor.static.title ) :
|
||||
OO.ui.resolveMsg( this.constructor.static.unavailableTooltip )
|
||||
);
|
||||
this.setDisabled( !modeAvailable );
|
||||
this.modeAvailable = modeAvailable;
|
||||
this.isCurrent = isCurrent;
|
||||
}
|
||||
// Update disabled and active state
|
||||
this.setDisabled( !modeAvailable );
|
||||
this.setActive( isCurrent );
|
||||
this.setActive( this.getMode() === this.constructor.static.editMode );
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -128,8 +119,6 @@ mw.libs.ve.MWEditModeSourceTool.static.editMode = 'source';
|
|||
mw.libs.ve.MWEditModeSourceTool.static.name = 'editModeSource';
|
||||
mw.libs.ve.MWEditModeSourceTool.static.icon = 'wikiText';
|
||||
mw.libs.ve.MWEditModeSourceTool.static.title =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool' );
|
||||
mw.libs.ve.MWEditModeSourceTool.static.currentTitle =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-current' );
|
||||
mw.libs.ve.MWEditModeSourceTool.static.unavailableTooltip =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodesource-tool-unavailable' );
|
||||
|
@ -152,8 +141,6 @@ mw.libs.ve.MWEditModeVisualTool.static.editMode = 'visual';
|
|||
mw.libs.ve.MWEditModeVisualTool.static.name = 'editModeVisual';
|
||||
mw.libs.ve.MWEditModeVisualTool.static.icon = 'eye';
|
||||
mw.libs.ve.MWEditModeVisualTool.static.title =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool' );
|
||||
mw.libs.ve.MWEditModeVisualTool.static.currentTitle =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-current' );
|
||||
mw.libs.ve.MWEditModeVisualTool.static.unavailableTooltip =
|
||||
OO.ui.deferMsg( 'visualeditor-mweditmodeve-tool-unavailable' );
|
||||
|
|
Loading…
Reference in a new issue