From 09519a24d2b68bb179713091b951e9e0c3d83aa6 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 20 Jun 2017 17:51:51 -0700 Subject: [PATCH] Add newline to end of wikitext documents Bug: T156609 Change-Id: I80d82ad87464b1c6e0344b29123bb96fcc4cffad --- modules/ve-mw/init/ve.init.mw.Target.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/ve.init.mw.Target.js b/modules/ve-mw/init/ve.init.mw.Target.js index 160b5c8e2f..be66b2caef 100644 --- a/modules/ve-mw/init/ve.init.mw.Target.js +++ b/modules/ve-mw/init/ve.init.mw.Target.js @@ -191,8 +191,11 @@ ve.init.mw.Target.prototype.createModelFromDom = function () { ve.init.mw.Target.static.parseDocument = function ( documentString, mode ) { var doc; if ( mode === 'source' ) { + // Add trailing linebreak to wikitext documents for consistency + // with old editor and usability. Will be stripped on save. T156609 + documentString += '\n'; // Parent method - doc = ve.init.mw.Target.super.static.parseDocument.apply( this, arguments ); + doc = ve.init.mw.Target.super.static.parseDocument.call( this, documentString, mode ); } else { // Parsoid documents are XHTML so we can use parseXhtml which fixed some IE issues. doc = ve.parseXhtml( documentString );