jenkins-bot has submitted this change and it was merged.

Change subject: Inherit more functionality from core source mode
......................................................................


Inherit more functionality from core source mode

Change-Id: Id027681ab5f0c9f4b9ed127b583e45f0fe57ce69
Depends-On: I02f3849027a6652701c2d354d1b77ece9d1a56c1
---
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
M modules/ve-mw/ui/styles/ve.ui.MWDesktopWikitextSurface.css
3 files changed, 7 insertions(+), 33 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index bffbe4f..9e60820 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -1151,28 +1151,10 @@
 /**
  * Create a document to save
  *
- * TODO: Move this code to the surface?
- *
  * @return {Object} Document to save
  */
 ve.init.mw.ArticleTarget.prototype.createDocToSave = function () {
-       var i, l, text, data,
-               surface = this.getSurface();
-
-       if ( surface.getMode() === 'source' ) {
-               text = '';
-               data = surface.getModel().getDocument().data.data;
-               for ( i = 0, l = data.length; i < l; i++ ) {
-                       if ( data[ i ].type === '/paragraph' && data[ i + 1 
].type === 'paragraph' ) {
-                               text += '\n';
-                       } else if ( !data[ i ].type ) {
-                               text += data[ i ];
-                       }
-               }
-
-               return text;
-       }
-       return surface.getDom();
+       return this.getSurface().getDom();
 };
 
 /**
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 499dde8..32f0bc5 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -154,24 +154,15 @@
 /* Methods */
 
 /**
- * Parse document string into an HTML document
- *
- * @param {string} documentString Document
- * @param {string} mode Editing mode
- * @return {HTMLDocument} HTML document
+ * @inheritdoc
  */
 ve.init.mw.Target.prototype.parseDocument = function ( documentString, mode ) {
        var doc;
        if ( mode === 'source' ) {
-               // Parse as plain text in source mode
-               doc = ve.createDocumentFromHtml( '' );
-
-               documentString.split( '\n' ).forEach( function ( line ) {
-                       var p = doc.createElement( 'p' );
-                       p.appendChild( doc.createTextNode( line ) );
-                       doc.body.appendChild( p );
-               } );
+               // Parent method
+               doc = ve.init.mw.Target.super.prototype.parseDocument.apply( 
this, arguments );
        } else {
+               // Parsoid documents are XHTML so we can use parseXhtml which 
fixed some IE issues.
                doc = ve.parseXhtml( documentString );
 
                // Fix relative or missing base URL if needed
diff --git a/modules/ve-mw/ui/styles/ve.ui.MWDesktopWikitextSurface.css 
b/modules/ve-mw/ui/styles/ve.ui.MWDesktopWikitextSurface.css
index 732af11..27efdae 100644
--- a/modules/ve-mw/ui/styles/ve.ui.MWDesktopWikitextSurface.css
+++ b/modules/ve-mw/ui/styles/ve.ui.MWDesktopWikitextSurface.css
@@ -7,9 +7,10 @@
 
 .ve-ui-mwDesktopWikitextSurface .ve-ce-documentNode {
        font-size: 13.3333px;
+       /* Inherit mw-editfont setting instead of default source mode setting */
+       font-family: inherit;
 }
 
 .ve-ui-mwDesktopWikitextSurface .ve-ce-paragraphNode {
        line-height: 20px;
-       margin: 0;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/324526
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id027681ab5f0c9f4b9ed127b583e45f0fe57ce69
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to