|
|
Line 493: |
Line 493: |
|
| |
|
| // Fix scripts literally disappearing when clicking "save changes" in VE | | // Fix scripts literally disappearing when clicking "save changes" in VE |
| | var originalSaveComplete = ve.init.mw.ArticleTarget.prototype.saveComplete; |
| | |
| mw.hook('ve.activationComplete').add(function () { | | mw.hook('ve.activationComplete').add(function () { |
| ve.init.mw.ArticleTarget.prototype.saveComplete = function (data) { | | ve.init.mw.ArticleTarget.prototype.saveComplete = function (data) { |
| this.editSummaryValue = null; | | // Calling the original implementation first |
| this.initialEditSummary = null;
| | originalSaveComplete.call(this, data); |
| this.saveDeferred.resolve();
| | // Custom things |
| this.emit('save', data);
| |
| var target = this;
| |
| if (!this.pageExists || this.restoring) { | |
| this.teardown().then(function () {
| |
| var newUrlParams = data.newrevid === undefined ? {} : {
| |
| venotify: target.restoring ? 'restored' : 'created'
| |
| };
| |
| if (data.isRedirect) {
| |
| newUrlParams.redirect = 'no';
| |
| }
| |
| location.href = target.viewUri.extend(newUrlParams);
| |
| });
| |
| } else {
| |
| if (mw.loader.getState('mediawiki.page.watch.ajax') === 'ready') {
| |
| mw.loader.using('mediawiki.page.watch.ajax', function () {
| |
| var watch = mw.libs['mediawiki.page.watch.ajax'];
| |
| if (watch) {
| |
| watch.updatePageWatchStatus(data.watched, data.watchlistexpiry);
| |
| }
| |
| });
| |
| }
| |
| this.restoring = false;
| |
| this.requestedRevId = undefined;
| |
| if (data.newrevid !== undefined) {
| |
| mw.config.set({
| |
| wgCurRevisionId: data.newrevid,
| |
| wgRevisionId: data.newrevid
| |
| });
| |
| this.revid = data.newrevid;
| |
| this.currentRevisionId = data.newrevid;
| |
| }
| |
| mw.config.set(data.jsconfigvars);
| |
| mw.loader.load(data.modules);
| |
| mw.config.set({
| |
| wgIsRedirect: !!data.isRedirect
| |
| });
| |
| if (this.saveDialog) {
| |
| this.saveDialog.reset();
| |
| }
| |
| this.replacePageContent(data.content, data.categorieshtml, data.displayTitleHtml, data.lastModified, data.contentSub);
| |
| this.tryTeardown(true);
| |
| } | |
| doRoundEdges(); | | doRoundEdges(); |
| performIE();
| |
| enhancements(); | | enhancements(); |
|
| |
| } | | } |
| }); | | }); |