diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index db3117c155..8d52c408d2 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -21,7 +21,9 @@ class ApiVisualEditor extends ApiBase {
if ( $params['paction'] === 'parse' ) {
if ( $page->exists() ) {
$parsed = Http::get(
- $parsoid . $page->getPrefixedDBkey()
+ // Insert slash since wgVisualEditorParsoidURL may or may not
+ // end in a slash. Double slashes are no problem --catrope
+ $parsoid . '/' . $page->getPrefixedDBkey()
);
if ( $parsed ) {
@@ -35,7 +37,10 @@ class ApiVisualEditor extends ApiBase {
);
}
} else {
- $result = array( 'result' => 'success', 'parsed' => '' );
+ $result = array(
+ 'result' => 'success',
+ 'parsed' => ''
+ );
}
} elseif ( $params['paction'] === 'save' && $user->isBlocked() ) {
$result = array( 'result' => 'error' );
diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index acca0d7617..726ffdbf35 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -38,15 +38,19 @@ ve.init.mw.ViewPageTarget = function () {
this.deactivating = false;
this.scrollTop = null;
this.proxiedOnSurfaceModelTransact = ve.proxy( this.onSurfaceModelTransact, this );
- this.surfaceOptions = { 'toolbars': { 'top': { 'float': !this.isMobileDevice } } };
+ this.surfaceOptions = {
+ 'toolbars': {
+ 'top': {
+ 'float': !this.isMobileDevice
+ }
+ }
+ };
this.currentUri = new mw.Uri( window.location.toString() );
this.section = this.currentUri.query.vesection || null;
this.namespaceName = mw.config.get( 'wgCanonicalNamespace' );
this.viewUri = new mw.Uri( mw.util.wikiGetlink( this.pageName ) );
- this.editUri = new mw.Uri( this.viewUri.toString() );
- this.editUri.extend( { 'action': 'edit' } );
- this.veEditUri = new mw.Uri( this.viewUri.toString() );
- this.veEditUri.extend( { 'veaction': 'edit' } );
+ this.editUri = this.viewUri.clone().extend( { 'action': 'edit' } );
+ this.veEditUri = this.viewUri.clone().extend( { 'veaction': 'edit' } );
this.isViewPage = (
this.namespaceName === 'VisualEditor' &&
mw.config.get( 'wgAction' ) === 'view' &&
@@ -54,7 +58,7 @@ ve.init.mw.ViewPageTarget = function () {
);
this.canBeActivated = (
this.namespaceName === 'VisualEditor' ||
- this.pageName.substr( 0, 13 ) === 'VisualEditor:'
+ this.pageName.indexOf( 'VisualEditor:' ) === 0
);
// Events
@@ -96,7 +100,7 @@ ve.init.mw.ViewPageTarget.saveDialogTemplate = '\
id="ve-init-mw-viewPageTarget-saveDialog-minorEdit">\
\
-