Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/297995
Change subject: RIP: Remove non-VE editor with toolbar ...................................................................... RIP: Remove non-VE editor with toolbar We don't plan to work on this anymore. Bug: T109107 Change-Id: I680f18bceb8990cde798b875ccadd56011298711 --- M extension.json M i18n/en.json M i18n/qqq.json D resources/mobile.editor.overlay.withtoolbar.images/reference-ltr.svg D resources/mobile.editor.overlay.withtoolbar.images/reference-rtl.svg D resources/mobile.editor.overlay.withtoolbar/AddReferenceOverlay.js D resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.js D resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.less D resources/mobile.editor.overlay.withtoolbar/contentAddReference.hogan D resources/mobile.editor.overlay.withtoolbar/editorFooter.hogan M resources/skins.minerva.editor/init.js 11 files changed, 2 insertions(+), 399 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/95/297995/1 diff --git a/extension.json b/extension.json index e2348dc..2be7af5 100644 --- a/extension.json +++ b/extension.json @@ -786,53 +786,6 @@ "mobile-frontend-editor-viewing-source-page" ] }, - "mobile.editor.overlay.withtoolbar": { - "targets": [ - "mobile", - "desktop" - ], - "dependencies": [ - "mobile.editor.overlay", - "oojs-ui.styles.icons-editing-styling", - "jquery.textSelection", - "mobile.editor.overlay.withtoolbar.images" - ], - "scripts": [ - "resources/mobile.editor.overlay.withtoolbar/AddReferenceOverlay.js", - "resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.js" - ], - "styles": [ - "resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.less" - ], - "templates": { - "editorFooter.hogan": "resources/mobile.editor.overlay.withtoolbar/editorFooter.hogan", - "contentAddReference.hogan": "resources/mobile.editor.overlay.withtoolbar/contentAddReference.hogan" - }, - "messages": [ - "mobile-frontend-editor-bold", - "mobile-frontend-editor-italic", - "mobile-frontend-editor-reference", - "mobile-frontend-editor-insert-reference", - "mobile-frontend-editor-reference-placeholder", - "mobile-frontend-editor-italic-text", - "mobile-frontend-editor-bold-text", - "mobile-frontend-editor-add-reference" - ] - }, - "mobile.editor.overlay.withtoolbar.images": { - "class": "ResourceLoaderImageModule", - "prefix": "oo-ui-icon", - "selector": ".oo-ui-icon-{name}", - "position": "bottom", - "images": { - "reference": { - "file": { - "rtl": "resources/mobile.editor.overlay.withtoolbar.images/reference-rtl.svg", - "ltr": "resources/mobile.editor.overlay.withtoolbar.images/reference-ltr.svg" - } - } - } - }, "mobile.search": { "class": "MFResourceLoaderParsedMessageModule", "dependencies": [ diff --git a/i18n/en.json b/i18n/en.json index a131751..d46eeea 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -145,14 +145,6 @@ "mobile-frontend-editor-redlink-leave": "No, thanks.", "mobile-frontend-editor-redlink-explain": "This page has not yet been created.", "mobile-frontend-editor-redlink-create": "Create page", - "mobile-frontend-editor-bold": "Bold", - "mobile-frontend-editor-italic": "Italic", - "mobile-frontend-editor-bold-text": "Bold text", - "mobile-frontend-editor-italic-text": "Italic text", - "mobile-frontend-editor-reference": "Reference", - "mobile-frontend-editor-insert-reference": "Insert reference", - "mobile-frontend-editor-reference-placeholder": "Which source do you refer to?", - "mobile-frontend-editor-add-reference": "Add", "mobile-frontend-enable-images": "Enable images on mobile site", "mobile-frontend-expand-sections-description": "Always expand all sections when navigating to a new page.", "mobile-frontend-expand-sections-status": "Expand all sections", diff --git a/i18n/qqq.json b/i18n/qqq.json index c1c4098..f9df2f9 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -144,14 +144,6 @@ "mobile-frontend-editor-redlink-leave": "Used as a message for a link, that the user doesn't want to edit a page, that does not exist yet.\n{{Identical|No thanks}}", "mobile-frontend-editor-redlink-explain": "Question for the user, if he want to edit a page, which link he clicked and that does not exist yet, or not.", "mobile-frontend-editor-redlink-create": "Label for a create page button.\n{{Identical|Create page}}", - "mobile-frontend-editor-bold": "Title of \"Bold\" button in editor.\n{{Identical|Bold}}", - "mobile-frontend-editor-italic": "Title of \"Italic\" button in editor.\n{{Identical|Italic}}", - "mobile-frontend-editor-bold-text": "Placeholder, which will be inserted into the text area, if the user clicks the bold text button in editor, and no text is selected.", - "mobile-frontend-editor-italic-text": "Placeholder, which will be inserted into the text area, if the user clicks the italic text button in editor, and no text is selected.", - "mobile-frontend-editor-reference": "Title of \"Reference\" button in editor.\n{{Identical|Reference}}", - "mobile-frontend-editor-insert-reference": "Title of the insert reference overlay in editor.", - "mobile-frontend-editor-reference-placeholder": "Placeholder text for the textarea on the reference overlay.", - "mobile-frontend-editor-add-reference": "Message used in the reference overlay to add a reference to the wikitext textarea.\n{{Identical|Add}}", "mobile-frontend-enable-images": "Unused at this time.\n\nSee also:\n* {{msg-mw|Mobile-frontend-disable-images}}", "mobile-frontend-expand-sections-description": "On settings page description for turning on/off expansion of all sections on page load.\n\nSee also:\n* {{msg-mw|Mobile-frontend-expand-sections-status}}", "mobile-frontend-expand-sections-status": "On settings page label for turning on/off expansion of all sections on page load.\n\nSee also:\n* {{msg-mw|Mobile-frontend-expand-sections-description}}", diff --git a/resources/mobile.editor.overlay.withtoolbar.images/reference-ltr.svg b/resources/mobile.editor.overlay.withtoolbar.images/reference-ltr.svg deleted file mode 100644 index 7b03835..0000000 --- a/resources/mobile.editor.overlay.withtoolbar.images/reference-ltr.svg +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <g id="reference"> - <path id="bookmark" d="M5 4v17h12c1 0 2-1 2-2V4H5zm12 14c0 1-1 1-1 1H8V6h2v6l2-2 2 2V6h3v12z"/> - </g> -</svg> diff --git a/resources/mobile.editor.overlay.withtoolbar.images/reference-rtl.svg b/resources/mobile.editor.overlay.withtoolbar.images/reference-rtl.svg deleted file mode 100644 index 6a154d6..0000000 --- a/resources/mobile.editor.overlay.withtoolbar.images/reference-rtl.svg +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <g id="reference"> - <path id="bookmark" d="M19 4v17H7c-1 0-2-1-2-2V4h14zM7 18c0 1 1 1 1 1h8V6h-2v6l-2-2-2 2V6H7v12z"/> - </g> -</svg> diff --git a/resources/mobile.editor.overlay.withtoolbar/AddReferenceOverlay.js b/resources/mobile.editor.overlay.withtoolbar/AddReferenceOverlay.js deleted file mode 100644 index dd1a41b..0000000 --- a/resources/mobile.editor.overlay.withtoolbar/AddReferenceOverlay.js +++ /dev/null @@ -1,66 +0,0 @@ -( function ( M, $ ) { - var Overlay = M.require( 'mobile.overlays/Overlay' ); - - /** - * Overlay that shows an editor - * @class AddReferenceOverlay - * @extends Overlay - */ - function AddReferenceOverlay() { - Overlay.apply( this, arguments ); - } - - OO.mfExtend( AddReferenceOverlay, Overlay, { - /** - * @inheritdoc - * @cfg {Object} defaults Default options hash. - * @cfg {String} defaults.referenceMsg Label of the reference input field - * @cfg {String} defaults.heading Title of the error reporting interface - * logging in. - */ - defaults: $.extend( {}, Overlay.prototype.defaults, { - referenceMsg: mw.msg( 'mobile-frontend-editor-reference-placeholder' ), - heading: mw.msg( 'mobile-frontend-editor-insert-reference' ), - headerButtonsListClassName: 'overlay-action', - headerButtons: [ { - className: 'submit', - msg: mw.msg( 'mobile-frontend-editor-add-reference' ) - } ] - } ), - /** - * @inheritdoc - */ - templatePartials: $.extend( {}, Overlay.prototype.templatePartials, { - content: mw.template.get( 'mobile.editor.overlay.withtoolbar', 'contentAddReference.hogan' ) - } ), - /** - * @inheritdoc - */ - events: $.extend( {}, Overlay.prototype.events, { - 'click button.submit': 'onSubmitClick' - } ), - /** - * Handle a click on the submit button - */ - onSubmitClick: function () { - var parts = { - pre: '<ref>', - peri: $( '.referenceInput' ).val(), - post: '</ref>' - }; - - this.options.editorOverlay.$content.textSelection( 'encapsulateSelection', parts ); - this.hide(); - }, - - /** - * @inheritdoc - */ - onExit: function () { - this.hide(); - return false; - } - } ); - - M.define( 'mobile.editor.overlay.withtoolbar/AddReferenceOverlay', AddReferenceOverlay ); -}( mw.mobileFrontend, jQuery ) ); diff --git a/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.js b/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.js deleted file mode 100644 index 6cfc547..0000000 --- a/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.js +++ /dev/null @@ -1,189 +0,0 @@ -( function ( M, $ ) { - var EditorOverlay = M.require( 'mobile.editor.overlay/EditorOverlay' ), - AddReferenceOverlay = M.require( 'mobile.editor.overlay.withtoolbar/AddReferenceOverlay' ); - - /** - * Overlay that shows an editor - * @class EditorOverlayWithToolbar - * @extends EditorOverlay - */ - function EditorOverlayWithToolbar() { - EditorOverlay.apply( this, arguments ); - } - - OO.mfExtend( EditorOverlayWithToolbar, EditorOverlay, { - templatePartials: $.extend( {}, EditorOverlay.prototype.templatePartials, { - footer: mw.template.get( 'mobile.editor.overlay.withtoolbar', 'editorFooter.hogan' ) - } ), - /** @inheritdoc **/ - postRender: function () { - var self = this; - - this._initializeEditorButtons(); - EditorOverlay.prototype.postRender.apply( this, arguments ); - // check, if the toolbar should be still visible on resize - setTimeout( function () { - self.onResize(); - }, 0 ); - // repeat the check whenever the screen size changes - M.on( 'resize', $.proxy( this, 'onResize' ) ); - }, - - /** - * Creates several basic buttons to better work with wikitext - */ - _initializeEditorButtons: function () { - var formattingTools, - toolFactory = new OO.ui.ToolFactory(), - toolGroupFactory = new OO.ui.ToolGroupFactory(), - toolbar = new OO.ui.Toolbar( toolFactory, toolGroupFactory ); - - /** - * Creates and returns a new Tool object with the given data - * @param {String} group The group this Tool should been - * @param {String} name The name of this Tool - * @param {String} icon Name of the icon to use - * @param {String} title Title of the Tool - * @param {Function} callback Function to call, when this Tool is selected - * @return {OO.ui.Tool} - * @ignore - */ - function getToolButton( group, name, icon, title, callback ) { - /** - * Creates a new instance of OO.ui.Tool - * @param {String} group The group this Tool should been - * @param {Object} [config] Configuration options - */ - var toolButton = function ( group, config ) { - // Parent constructor - OO.ui.Tool.call( this, group, config ); - }; - - // inherit OO.ui.Tool - OO.inheritClass( toolButton, OO.ui.Tool ); - - /** - * Handle the tool being selected. - */ - toolButton.prototype.onSelect = function () { - callback.call( this ); - // we don't want to leave the button selected - this.setActive( false ); - }; - /** - * Toolbar update state handler. - */ - toolButton.prototype.onUpdateState = function () { - // do nothing - }; - - // set properties - toolButton.static.name = name; - toolButton.static.group = group; - toolButton.static.title = title; - toolButton.static.icon = icon; - - return toolButton; - } - // Array of buttons to add to the toolbar and their data - formattingTools = [ - [ 'formattingTools', 'bold', 'bold', mw.msg( 'mobile-frontend-editor-bold' ), $.proxy( this, 'onWrapOrAddDefault', 'bold' ) ], - [ 'formattingTools', 'italic', 'italic', mw.msg( 'mobile-frontend-editor-italic' ), $.proxy( this, 'onWrapOrAddDefault', 'italic' ) ], - [ 'formattingTools', 'reference', 'reference', mw.msg( 'mobile-frontend-editor-reference' ), $.proxy( this, 'onAddReference' ) ] - ]; - // add the buttons to the toolbar - $.each( formattingTools, function ( i, data ) { - toolFactory.register( getToolButton( data[0], data[1], data[2], data[3], data[4] ) ); - } ); - - toolbar.setup( [ { - // include the button group in this toolbar - include: [ { - group: 'formattingTools' - } ] - } ] ); - // add the toolbar to the toolbar container - this.$( '.toolbar' ).append( toolbar.$element ); - }, - - /** - * Handles a click on a toolbar Tool button and wraps - * the selected text (if any) into the action's pre- and post - * signs. If no text is selected it adds an example to the cursor - * position. - * @param {String} action The performed action - */ - onWrapOrAddDefault: function ( action ) { - var parts = {}; - - // set pre and post and default strings - switch ( action ) { - case 'bold': - parts = { - pre: '\'\'\'', - peri: mw.msg( 'mobile-frontend-editor-bold-text' ) + ' ', - post: '\'\'\'' - }; - break; - case 'italic': - parts = { - pre: '\'\'', - peri: mw.msg( 'mobile-frontend-editor-italic-text' ) + ' ', - post: '\'\'' - }; - break; - } - // replace/add the text to the content - this.onInputWikitextEditor(); - this.$content.textSelection( 'encapsulateSelection', parts ); - }, - - /** - * Handles a click on the "add reference" button and opens a simple Overlay to add - * a source/cite/reference to the text. - */ - onAddReference: function () { - var self = this, - referenceOverlay = new AddReferenceOverlay( { - editorOverlay: this - } ); - - // Open the Overlay and handle the hide event - referenceOverlay.on( 'hide', function () { - self.show(); - } ).show(); - - // When closing this overlay, also close the child section overlay - this.on( 'hide', function () { - referenceOverlay.remove(); - } ); - }, - - /** - * @inheritdoc - */ - onStageChanges: function () { - this.$( '.overlay-footer-container' ).hide(); - EditorOverlay.prototype.onStageChanges.apply( this, arguments ); - }, - - /** - * resize-event handler. Check if the overlay height is big enough to hold - * the textarea and the toolbar and both is still visible. If not, hide the - * toolbar. - */ - onResize: function () { - this.$( '.toolbar' ).toggleClass( 'hidden', this.$el.innerHeight() <= 200 ); - }, - - /** - * @inheritdoc - */ - _hidePreview: function () { - this.$( '.overlay-footer-container' ).show(); - EditorOverlay.prototype._hidePreview.apply( this, arguments ); - } - } ); - - M.define( 'mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar', EditorOverlayWithToolbar ); -}( mw.mobileFrontend, jQuery ) ); diff --git a/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.less b/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.less deleted file mode 100644 index f208547..0000000 --- a/resources/mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar.less +++ /dev/null @@ -1,51 +0,0 @@ -@import 'minerva.variables.less'; -@import 'minerva.mixins.less'; - -/* add a border to each tool, instead of using a toolgroup for every tool */ -.oo-ui-widget { - border-left: 1px solid @grayLight; -} - -/* remove the doubled border for the toolgroup element */ -.oo-ui-toolGroup { - border-left: 0; -} - -// Adjustments for OOJs UI Toolbars in mobile -.overlay-footer { - // center-align buttons - text-align: center; - - .toolbar { - // Expand the toolbar as wide as possible to limit the size of the - // overlay-action. (Both are displayed as table-cells.) - width: 100%; - .oo-ui-toolbar { - // Everything is measured in ems so the easiest way to scale - // is to change the base font size. - font-size: unit( @targetIconSize / @baseIconSize, em ); - .oo-ui-iconElement-icon { - /* We should be able to use 'contain' here, but some OOUI icon containers are oversized (T85139) */ - .background-size( @targetIconSize, @targetIconSize ); - } - } - .oo-ui-tool-title, - .oo-ui-popupToolGroup-header { - // Undo font size increase for labels - font-size: unit( 0.9 / ( @targetIconSize / @baseIconSize ), em ); - } - .oo-ui-toolbar-bar { - // Overlay toolbar has its own borders - border: 0; - } - // Convert 0.3em margin to padding to make clickable area larger - .oo-ui-toolGroup { - margin: 0; - } - .oo-ui-barToolGroup .oo-ui-tool-link { - padding: 0.25em + 0.3em; - // Remove once MF box-sizing is fixed - .box-sizing( content-box ); - } - } -} diff --git a/resources/mobile.editor.overlay.withtoolbar/contentAddReference.hogan b/resources/mobile.editor.overlay.withtoolbar/contentAddReference.hogan deleted file mode 100644 index 35ac8dc..0000000 --- a/resources/mobile.editor.overlay.withtoolbar/contentAddReference.hogan +++ /dev/null @@ -1 +0,0 @@ -<textarea class="mw-ui-input wikitext-editor referenceInput" placeholder="{{referenceMsg}}"></textarea> \ No newline at end of file diff --git a/resources/mobile.editor.overlay.withtoolbar/editorFooter.hogan b/resources/mobile.editor.overlay.withtoolbar/editorFooter.hogan deleted file mode 100644 index c2dfcd7..0000000 --- a/resources/mobile.editor.overlay.withtoolbar/editorFooter.hogan +++ /dev/null @@ -1,3 +0,0 @@ -<div class="overlay-footer edit-buttons"> - <div class="toolbar"></div> -</div> \ No newline at end of file diff --git a/resources/skins.minerva.editor/init.js b/resources/skins.minerva.editor/init.js index 900c48e..aee4189 100644 --- a/resources/skins.minerva.editor/init.js +++ b/resources/skins.minerva.editor/init.js @@ -182,22 +182,10 @@ * @method */ function loadSourceEditor() { - var rlModuleName, moduleName; - logInit( 'wikitext' ); - // use the new wikitexteditor with a basic toolbar as a test for beta users and users - // without an iphone (bottom toolbars doesn't work) - Bug T109224 - // FIXME: Make this working with iOS8 - if ( !user.inUserBucketA() && context.isBetaGroupMember() && !browser.isIos( 8 ) ) { - moduleName = 'mobile.editor.overlay.withtoolbar/EditorOverlayWithToolbar'; - rlModuleName = 'mobile.editor.overlay.withtoolbar'; - } else { - moduleName = 'mobile.editor.overlay/EditorOverlay'; - rlModuleName = 'mobile.editor.overlay'; - } - loader.loadModule( rlModuleName ).done( function () { - var EditorOverlay = M.require( moduleName ); + loader.loadModule( 'mobile.editor.overlay' ).done( function () { + var EditorOverlay = M.require( 'mobile.editor.overlay/EditorOverlay' ); result.resolve( new EditorOverlay( editorOptions ) ); } ); } -- To view, visit https://gerrit.wikimedia.org/r/297995 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I680f18bceb8990cde798b875ccadd56011298711 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits