diff --git a/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js index b8c5214776..e6996c2784 100644 --- a/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js @@ -97,13 +97,13 @@ } function setupTempWikitextEditor( data ) { - var content = data.content; + var wikitext = data.content; // Add trailing linebreak to non-empty wikitext documents for consistency // with old editor and usability. Will be stripped on save. T156609 - if ( content ) { - content += '\n'; + if ( wikitext ) { + wikitext += '\n'; } - tempWikitextEditor = new mw.libs.ve.MWTempWikitextEditorWidget( { value: content } ); + tempWikitextEditor = new mw.libs.ve.MWTempWikitextEditorWidget( { value: wikitext } ); tempWikitextEditorData = data; // Create an equal-height placeholder for the toolbar to avoid vertical jump @@ -132,17 +132,17 @@ } function syncTempWikitextEditor() { - var newContent = tempWikitextEditor.getValue(); + var wikitext = tempWikitextEditor.getValue(); // Strip trailing linebreak. Will get re-added in ArticleTarget#parseDocument. - if ( newContent.slice( -1 ) === '\n' ) { - newContent = newContent.slice( 0, -1 ); + if ( wikitext.slice( -1 ) === '\n' ) { + wikitext = wikitext.slice( 0, -1 ); } - if ( newContent !== tempWikitextEditorData.content ) { + if ( wikitext !== tempWikitextEditorData.content ) { // Write changes back to response data object, // which will be used to construct the surface. - tempWikitextEditorData.content = newContent; + tempWikitextEditorData.content = wikitext; // TODO: Consider writing changes using a // transaction so they can be undone. // For now, just mark surface as pre-modified diff --git a/modules/ve-mw/preinit/ve.init.mw.TempWikitextEditorWidget.js b/modules/ve-mw/preinit/ve.init.mw.TempWikitextEditorWidget.js index 577d4d74f1..76803e8a42 100644 --- a/modules/ve-mw/preinit/ve.init.mw.TempWikitextEditorWidget.js +++ b/modules/ve-mw/preinit/ve.init.mw.TempWikitextEditorWidget.js @@ -13,22 +13,20 @@ mw.libs.ve = mw.libs.ve || {}; * This widget can be used to show the user a basic editing interface * while VE libraries are still loading. * - * It has a similar API to OO.ui.TextInputWidget, but is designed to + * It has a similar API to OO.ui.InputWidget, but is designed to * be loaded before any core VE code or dependencies, e.g. OOUI. * * @class * * @constructor - * @param {Object} [config] Configuration options - * @cfg {string} [value] Initial value + * @param {Object} config Configuration options + * @cfg {string} value Raw wikitext to edit */ mw.libs.ve.MWTempWikitextEditorWidget = function VeUiMwTempWikitextEditorWidget( config ) { var conf = mw.config.get( 'wgVisualEditor' ), dir = conf.pageLanguageDir, lang = conf.pageLanguageCode; - config = config || {}; - this.$element = $( '