diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index 0579119926..2cbd290632 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -222,11 +222,11 @@ class ApiVisualEditor extends ApiBase { if ( $params['html'] === null ) { $this->dieUsageMsg( 'missingparam', 'html' ); } - $serialized = array( 'content' => $this->postHTML( $page, $params['html'], $parserParams ) ); - if ( $serialized === false ) { + $content = $this->postHTML( $page, $params['html'], $parserParams ); + if ( $content === false ) { $this->dieUsage( 'Error contacting the Parsoid server', 'parsoidserver' ); } else { - $result = array_merge( array( 'result' => 'success' ), $serialized ); + $result = array( 'result' => 'success', 'content' => $content ); } } elseif ( $params['paction'] === 'save' || $params['paction'] === 'diff' ) { $wikitext = $this->postHTML( $page, $params['html'], $parserParams ); 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 50d15c9b8a..e94205fdf9 100644 --- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js @@ -466,7 +466,6 @@ ve.init.mw.ViewPageTarget.prototype.onShowChangesError = function ( jqXHR, statu ve.init.mw.ViewPageTarget.prototype.onSerializeError = function ( jqXHR, status ) { alert( ve.msg( 'visualeditor-serializeerror', status ) ); this.$saveDialogLoadingIcon.hide(); - this.saveDialogReviewGoodButton.setDisabled( false ); this.saveDialogReviewWrongButton.setDisabled( false ); }; diff --git a/modules/ve/init/mw/ve.init.mw.Target.js b/modules/ve/init/mw/ve.init.mw.Target.js index ce87f127c7..8fc90e1970 100644 --- a/modules/ve/init/mw/ve.init.mw.Target.js +++ b/modules/ve/init/mw/ve.init.mw.Target.js @@ -329,7 +329,11 @@ ve.init.mw.Target.onSerialize = function ( response ) { var data = response.visualeditor; if ( !data && !response.error ) { ve.init.mw.Target.onSerializeError.call( this, null, 'Invalid response from server', null ); - } else if ( response.error || data.result === 'error' ) { + } else if ( response.error ) { + ve.init.mw.Target.onSerializeError.call( + this, null, 'Unsuccessful request: ' + response.error.info, null + ); + } else if ( data.result === 'error' ) { ve.init.mw.Target.onSerializeError.call( this, null, 'Server error', null ); } else if ( typeof data.content !== 'string' ) { ve.init.mw.Target.onSerializeError.call(