diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php index d89b6efb3e..5712cb1341 100644 --- a/VisualEditor.i18n.php +++ b/VisualEditor.i18n.php @@ -51,6 +51,8 @@ $messages['en'] = array( 'visualeditor-savedialog-label-restore' => 'Restore page', 'visualeditor-editnotices-tool' => '$1 {{PLURAL:$1|notice|notices}}', 'visualeditor-feedback-tool' => 'Leave feedback', + 'visualeditor-beta-label' => 'beta', + 'visualeditor-beta-warning' => 'VisualEditor is in \'beta\' and so may not let you edit everything yet.', 'visualeditor-meta-tool' => 'Page settings', 'visualeditor-window-title' => 'Inspect', 'visualeditor-linkinspector-title' => 'Hyperlink', @@ -107,7 +109,6 @@ $messages['en'] = array( 'visualeditor-problem' => 'Describe what went wrong with the wikitext serialization', 'visualeditor-aliennode-tooltip' => 'Sorry, this element cannot be edited using the VisualEditor', 'visualeditor-descriptionpagelink' => 'Project:VisualEditor', - 'visualeditor-alphawarning' => 'You are using an alpha version of the [[{{MediaWiki:Visualeditor-descriptionpagelink}}|VisualEditor]]. It may be slow and make erroneous changes—please check each edit that you make.', 'visualeditor-browserwarning' => 'You are using a browser which is not officially supported by VisualEditor.', 'visualeditor-report-notice' => 'I understand that by clicking "Report problem" I will transmit my changes and my feedback, which will be stored for analysis. I agree to provide feedback in accordance with the [[{{MediaWiki:Visualeditor-report-link}}|Terms of Use]].', 'visualeditor-report-link' => 'foundation:Terms of Use', @@ -201,6 +202,8 @@ See also: 'visualeditor-savedialog-label-restore' => 'Label text for save button when the user is editing a previous revision', 'visualeditor-editnotices-tool' => 'Text of tool in the toolbar that shows edit notices (such as [[MediaWiki:editnotice-0]] and [[MediaWiki:editnotice-8/en]]) as a pop-up', 'visualeditor-feedback-tool' => 'Text of tool in the toolbar that lets users provide feedback', + 'visualeditor-beta-label' => 'Text of tool in the toolbar that highlights that VisualEditor is still in beta', + 'visualeditor-beta-warning' => 'Note shown when user clicks on \'beta\' label in VisualEditor, warning users that the software may have issues', 'visualeditor-meta-tool' => 'Text of tool in the toolbar the lets users set categories, language links and other page settings. {{Identical|Page settings}}', 'visualeditor-window-title' => 'Title of an unnamed inspector', @@ -275,7 +278,6 @@ Parameters: 'visualeditor-aliennode-tooltip' => 'Tooltip for items that the VisualEditor cannot edit', 'visualeditor-descriptionpagelink' => 'Name of a page describing the use of the VisualEditor in this project. {{doc-important|Do not translate "Project"; it is automatically converted to the wiki\'s project namespace.}}', - 'visualeditor-alphawarning' => 'Edit notice shown when the VisualEditor loads, warning users that the software may have issues', 'visualeditor-browserwarning' => 'Edit notice shown when the VisualEditor loads, warning users that their browser is not officially supported', 'visualeditor-report-notice' => 'Notice to user that their data will be sent for analysis. Link is in {{msg-mw|Visualeditor-report-link}}. diff --git a/VisualEditor.php b/VisualEditor.php index 58262ba592..b717e31988 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -60,8 +60,6 @@ $wgVisualEditorResourceTemplate = array( 'group' => 'ext.visualEditor', ); -$wgVisualEditorEditNotices = array( 'visualeditor-alphawarning' ); - $wgVisualEditorEnableSectionEditLinks = false; $wgResourceModules += array( @@ -167,6 +165,8 @@ $wgResourceModules += array( 'visualeditor-problem', 'visualeditor-editnotices-tool', 'visualeditor-feedback-tool', + 'visualeditor-beta-label', + 'visualeditor-beta-warning', 'visualeditor-meta-tool', 'visualeditor-restore-page', 'visualeditor-create-page', diff --git a/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css b/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css index f48ee4fc7f..f821833f36 100644 --- a/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css +++ b/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css @@ -34,6 +34,24 @@ margin-top: 0.2em; } +/* Beta notices */ + +.ve-init-mw-viewPageTarget-toolbar-betaNotice { + display: none; + position: absolute; + right: -0.5em; + top: 30px; + width: 11em; + font-family: sans-serif; + border: solid 1px #ccc; + padding: 0.5em 1.25em 0 1.25em; + border-radius: 0.25em; + background-color: #fff; + box-shadow: 0 0.15em 0.5em 0 rgba(0, 0, 0, 0.2); + z-index: 3; + line-height: 1.5em; +} + /* Edit notices */ .ve-init-mw-viewPageTarget-toolbar-editNotices { @@ -44,7 +62,7 @@ width: 29em; font-family: sans-serif; border: solid 1px #ccc; - padding: 0 0.75em 0 0.75em; + padding: 0 1.75em 0 0.75em; border-radius: 0.25em; background-color: #fff; box-shadow: 0 0.15em 0.5em 0 rgba(0, 0, 0, 0.2); @@ -76,6 +94,12 @@ color: #555555; } +.ve-init-mw-viewPageTarget-tool-beta-label { + color: #aaaaaa; + font-size: 120%; + font-variant: small-caps; +} + .ve-init-mw-viewPageTarget-tool:hover .ve-init-mw-viewPageTarget-tool-label { text-decoration: underline; } diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js index 432ba08e06..9aa7cdb8c6 100644 --- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js @@ -39,17 +39,24 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { this.saveDialogSaveButton = null; this.saveDialogReviewGoodButton = null; - this.$toolbarEditNotices = $( '
' ).addClass( - 've-init-mw-viewPageTarget-toolbar-editNotices' - ); - this.$toolbarEditNoticesTool = $( '
' ).addClass( - 've-init-mw-viewPageTarget-tool' - ); - this.$toolbarFeedbackTool = $( '
' ).addClass( - 've-init-mw-viewPageTarget-tool' - ); - this.$toolbarMwMetaButton = $( '
' ).addClass( 've-init-mw-viewPageTarget-tool' ); - this.$saveDialog = $( '
' ).addClass( 've-init-mw-viewPageTarget-saveDialog' ); + this.$toolbarEditNotices = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-toolbar-editNotices' ); + this.$toolbarEditNoticesTool = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-tool' ); + + this.$toolbarFeedbackTool = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-tool' ); + + this.$toolbarBetaNotice = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-toolbar-betaNotice' ); + this.$toolbarBetaNoticeTool = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-tool' ); + + this.$toolbarMwMetaButton = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-tool' ); + this.$saveDialog = $( '
' ) + .addClass( 've-init-mw-viewPageTarget-saveDialog' ); + this.onBeforeUnloadFallback = null; this.onBeforeUnloadHandler = null; this.active = false; @@ -315,6 +322,7 @@ ve.init.mw.ViewPageTarget.prototype.onLoad = function ( doc ) { this.doc = doc; this.setUpSurface( doc ); this.setupToolbarEditNotices(); + this.setupToolbarBetaNotice(); this.setupToolbarButtons(); this.setupSaveDialog(); this.attachToolbarButtons(); @@ -592,6 +600,19 @@ ve.init.mw.ViewPageTarget.prototype.onToolbarMwMetaButtonClick = function () { */ ve.init.mw.ViewPageTarget.prototype.onToolbarEditNoticesToolClick = function () { this.$toolbarEditNotices.fadeToggle( 'fast' ); + this.$toolbarBetaNotice.fadeOut( 'fast' ); + this.$document.focus(); +}; + +/** + * Handle clicks on the beta notices tool in the toolbar. + * + * @method + * @param {jQuery.Event} e Mouse click event + */ +ve.init.mw.ViewPageTarget.prototype.onToolbarBetaNoticeToolClick = function () { + this.$toolbarBetaNotice.fadeToggle( 'fast' ); + this.$toolbarEditNotices.fadeOut( 'fast' ); this.$document.focus(); }; @@ -742,10 +763,9 @@ ve.init.mw.ViewPageTarget.prototype.onSaveDialogPrevButtonClick = function () { }; /** - * Get a list of edit notices. + * Set up the list of edit notices. * * @method - * @returns {string[]} HTML strings for each edit notice */ ve.init.mw.ViewPageTarget.prototype.setupToolbarEditNotices = function () { var key; @@ -755,6 +775,18 @@ ve.init.mw.ViewPageTarget.prototype.setupToolbarEditNotices = function () { } }; +/** + * Set up the beta notices panel. + * + * @method + * @returns {string[]} HTML strings for each edit notice + */ +ve.init.mw.ViewPageTarget.prototype.setupToolbarBetaNotice = function () { + this.$toolbarBetaNotice.empty(); + this.$toolbarBetaNotice + .append( $( '' ).text( ve.msg( 'visualeditor-beta-warning' ) ) ); +}; + /** * Switch to editing mode. * @@ -956,6 +988,16 @@ ve.init.mw.ViewPageTarget.prototype.setupToolbarButtons = function () { .click( ve.bind( this.onToolbarEditNoticesToolClick, this ) ); this.$toolbarEditNotices.fadeIn( 'fast' ); } + + this.$toolbarBetaNoticeTool + .append( + $( '' ) + .addClass( 've-init-mw-viewPageTarget-tool-label ve-init-mw-viewPageTarget-tool-beta-label' ) + .text( ve.msg( 'visualeditor-beta-label' ) ) + ) + .append( this.$toolbarBetaNotice ) + .click( ve.bind( this.onToolbarBetaNoticeToolClick, this ) ); + this.$toolbarFeedbackTool .addClass( 've-ui-icon-comment' ) .append( @@ -976,6 +1018,7 @@ ve.init.mw.ViewPageTarget.prototype.tearDownToolbarButtons = function () { this.toolbarSaveButton.disconnect( this ); this.$toolbarMwMetaButton.empty().off( 'click' ); this.$toolbarEditNoticesTool.empty().off( 'click' ); + this.$toolbarBetaNoticeTool.empty().off( 'click' ); this.$toolbarFeedbackTool.empty().off( 'click' ); }; @@ -986,7 +1029,9 @@ ve.init.mw.ViewPageTarget.prototype.tearDownToolbarButtons = function () { */ ve.init.mw.ViewPageTarget.prototype.attachToolbarButtons = function () { var $target = this.toolbar.$actions; - $target.append( this.$toolbarFeedbackTool ); + $target.append( this.$toolbarBetaNoticeTool ); + this.$toolbarBetaNotice.append( this.$toolbarFeedbackTool ); + if ( !ve.isEmptyObject( this.editNotices ) ) { $target.append( this.$toolbarEditNoticesTool ); } @@ -1008,6 +1053,7 @@ ve.init.mw.ViewPageTarget.prototype.detachToolbarButtons = function () { this.$toolbarMwMetaButton.detach(); this.$toolbarEditNoticesTool.detach(); this.$toolbarFeedbackTool.detach(); + this.$toolbarBetaNoticeTool.detach(); }; /** @@ -1205,6 +1251,7 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () { viewPage.surface.disable(); + viewPage.$toolbarBetaNotice.fadeOut( 'fast' ); viewPage.$toolbarEditNotices.fadeOut( 'fast' ); viewPage.swapSaveDialog( 'save' );