/*! * VisualEditor UserInterface MWExportWikitextDialog class. * * @copyright See AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * Dialog for exportWikitexting CollabTarget pages * * @class * @extends OO.ui.ProcessDialog * * @constructor * @param {Object} [config] Config options */ ve.ui.MWExportWikitextDialog = function VeUiMwExportWikitextDialog( config ) { // Parent constructor ve.ui.MWExportWikitextDialog.super.call( this, config ); // Initialization this.$element.addClass( 've-ui-mwExportWikitextDialog' ); }; /* Inheritance */ OO.inheritClass( ve.ui.MWExportWikitextDialog, OO.ui.ProcessDialog ); /* Static Properties */ ve.ui.MWExportWikitextDialog.static.name = 'mwExportWikitext'; ve.ui.MWExportWikitextDialog.static.title = ve.msg( 'visualeditor-rebase-client-export' ); ve.ui.MWExportWikitextDialog.static.actions = [ { label: OO.ui.deferMsg( 'visualeditor-dialog-action-done' ), flags: [ 'safe', 'close' ] } ]; ve.ui.MWExportWikitextDialog.static.size = 'larger'; /** * @inheritdoc */ ve.ui.MWExportWikitextDialog.prototype.initialize = function () { // Parent method ve.ui.MWExportWikitextDialog.super.prototype.initialize.call( this ); this.titleInput = new mw.widgets.TitleInputWidget( { value: ve.init.target.getImportTitle() }, { api: ve.init.target.getContentApi() } ); this.titleButton = new OO.ui.ButtonWidget( { label: ve.msg( 'visualeditor-rebase-client-export-start' ), flags: [ 'primary', 'progressive' ] } ); this.titleField = new OO.ui.ActionFieldLayout( this.titleInput, this.titleButton, { align: 'top', label: ve.msg( 'visualeditor-rebase-client-import-name' ), help: ve.msg( 'visualeditor-rebase-client-title-help' ), helpInline: true } ); this.titleButton.on( 'click', this.export.bind( this ) ); this.wikitextLayout = new mw.widgets.CopyTextLayout( { align: 'top', label: ve.msg( 'visualeditor-savedialog-review-wikitext' ), multiline: true, textInput: { // The following classes are used here: // * mw-editfont-monospace // * mw-editfont-sans-serif // * mw-editfont-serif classes: [ 'mw-editfont-' + mw.user.options.get( 'editfont' ) ], autosize: true, readOnly: true, // Height will be trimmed in getReadyProcess rows: 99 } } ); // TODO: Move to CSS this.titleField.$element.css( 'max-width', 'none' ); this.titleInput.$element.css( 'max-width', 'none' ); this.wikitextLayout.$element.css( 'max-width', 'none' ); this.wikitextLayout.$field.css( 'max-width', 'none' ); this.wikitextLayout.textInput.$element.css( 'max-width', 'none' ); const $content = $( '