Replace deprecated easy-deflate.deflate with mediawiki.deflate

Change-Id: I5c77d4818074fd3dc937d7688d449952b92ee358
This commit is contained in:
Ed Sanders 2019-10-30 19:13:47 +00:00
parent 9cfe9714c5
commit 1bb72f0bb5
3 changed files with 9 additions and 11 deletions

View file

@ -22,7 +22,7 @@
"license-name": "MIT",
"type": "editor",
"requires": {
"MediaWiki": ">= 1.34.0"
"MediaWiki": ">= 1.35.0"
},
"callback": "VisualEditorHooks::onRegistration",
"config": {

View file

@ -167,10 +167,10 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
*/
protected function getWikitextNoCache( Title $title, $params, $parserParams ) {
$this->requireOnlyOneParameter( $params, 'html' );
if ( EasyDeflate::isDeflated( $params['html'] ) ) {
$status = EasyDeflate::inflate( $params['html'] );
if ( Deflate::isDeflated( $params['html'] ) ) {
$status = Deflate::inflate( $params['html'] );
if ( !$status->isGood() ) {
$this->dieWithError( 'easydeflate-invaliddeflate', 'invaliddeflate' );
$this->dieWithError( 'deflate-invaliddeflate', 'invaliddeflate' );
}
$html = $status->getValue();
} else {

View file

@ -7,8 +7,6 @@
/* eslint-disable no-jquery/no-global-selector */
/* global EasyDeflate */
/**
* Initialization MediaWiki article target.
*
@ -550,10 +548,10 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
// Auto-save
this.initAutosave();
// Start loading easy-deflate module in the background, so it's
// Start loading deflate module in the background, so it's
// already loaded when the save dialog is opened.
setTimeout( function () {
mw.loader.load( 'easy-deflate.deflate' );
mw.loader.load( 'mediawiki.deflate' );
}, 500 );
}
@ -1151,7 +1149,7 @@ ve.init.mw.ArticleTarget.prototype.onSaveDialogClose = function () {
};
/**
* Get deflated HTML. This function is async because easy-deflate may not have finished loading yet.
* Get deflated HTML. This function is async because deflate may not have finished loading yet.
*
* @param {HTMLDocument} newDoc Document to get HTML for
* @return {jQuery.Promise} Promise resolved with deflated HTML
@ -1159,9 +1157,9 @@ ve.init.mw.ArticleTarget.prototype.onSaveDialogClose = function () {
*/
ve.init.mw.ArticleTarget.prototype.deflateHtml = function ( newDoc ) {
var html = this.getHtml( newDoc, this.doc );
return mw.loader.using( 'easy-deflate.deflate' )
return mw.loader.using( 'mediawiki.deflate' )
.then( function () {
return EasyDeflate.deflate( html );
return mw.deflate( html );
} );
};