Follow-up I80d82ad87: Only add linebreak to non-empty documents

This is the same behaviour as the old editor, and
unbreaks editors that use placeholders.

Change-Id: I7b5a18f1fb0d41c5dc08d1b893c90db2bf3dbd86
This commit is contained in:
Ed Sanders 2017-11-21 15:42:04 +00:00
parent 26e78ea946
commit 38dba57e95

View file

@ -215,9 +215,9 @@ ve.init.mw.ArticleTarget.static.documentCommands = ve.init.mw.ArticleTarget.supe
* @inheritdoc
*/
ve.init.mw.ArticleTarget.static.parseDocument = function ( documentString, mode ) {
// Add trailing linebreak to wikitext documents for consistency
// Add trailing linebreak to non-empty wikitext documents for consistency
// with old editor and usability. Will be stripped on save. T156609
if ( mode === 'source' ) {
if ( mode === 'source' && documentString ) {
documentString += '\n';
}