[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Move #getWikitextFragment up to ArticleTarget
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/332993 ) Change subject: Move #getWikitextFragment up to ArticleTarget .. Move #getWikitextFragment up to ArticleTarget Change-Id: Ice4b04db4a45c07ccffc3892e6db5d814c2ec37b --- M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js M modules/ve-mw/init/ve.init.mw.ArticleTarget.js 2 files changed, 41 insertions(+), 41 deletions(-) Approvals: jenkins-bot: Verified Jforrester: Looks good to me, approved diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index d035055..47b415f 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1838,47 +1838,6 @@ }; /** - * Get a wikitext fragment from a document - * - * @param {ve.dm.Document} doc Document - * @param {boolean} [useRevision=true] Whether to use the revision ID + ETag - * @return {jQuery.Promise} Abortable promise which resolves with a wikitext string - */ -ve.init.mw.DesktopArticleTarget.prototype.getWikitextFragment = function ( doc, useRevision ) { - var promise, xhr, - params = { - action: 'visualeditoredit', - token: this.editToken, - paction: 'serialize', - html: ve.dm.converter.getDomFromModel( doc ).body.innerHTML, - page: this.pageName - }; - - if ( useRevision === undefined || useRevision ) { - params.oldid = this.revid; - params.etag = this.etag; - } - - xhr = new mw.Api().post( - params, - { contentType: 'multipart/form-data' } - ); - - promise = xhr.then( function ( response ) { - if ( response.visualeditoredit ) { - return response.visualeditoredit.content; - } - return $.Deferred().reject(); - } ); - - promise.abort = function () { - xhr.abort(); - }; - - return promise; -}; - -/** * Resets the document opacity when we've decided to cancel switching to the wikitext editor. */ ve.init.mw.DesktopArticleTarget.prototype.resetDocumentOpacity = function () { diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 0ab38e5..9d0808c 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -2144,3 +2144,44 @@ this.welcomeDialogPromise.reject(); } }; + +/** + * Get a wikitext fragment from a document + * + * @param {ve.dm.Document} doc Document + * @param {boolean} [useRevision=true] Whether to use the revision ID + ETag + * @return {jQuery.Promise} Abortable promise which resolves with a wikitext string + */ +ve.init.mw.ArticleTarget.prototype.getWikitextFragment = function ( doc, useRevision ) { + var promise, xhr, + params = { + action: 'visualeditoredit', + token: this.editToken, + paction: 'serialize', + html: ve.dm.converter.getDomFromModel( doc ).body.innerHTML, + page: this.pageName + }; + + if ( useRevision === undefined || useRevision ) { + params.oldid = this.revid; + params.etag = this.etag; + } + + xhr = new mw.Api().post( + params, + { contentType: 'multipart/form-data' } + ); + + promise = xhr.then( function ( response ) { + if ( response.visualeditoredit ) { + return response.visualeditoredit.content; + } + return $.Deferred().reject(); + } ); + + promise.abort = function () { + xhr.abort(); + }; + + return promise; +}; -- To view, visit https://gerrit.wikimedia.org/r/332993 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ice4b04db4a45c07ccffc3892e6db5d814c2ec37b Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders Gerrit-Reviewer: Jforrester Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Move #getWikitextFragment up to ArticleTarget
Esanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332993 ) Change subject: Move #getWikitextFragment up to ArticleTarget .. Move #getWikitextFragment up to ArticleTarget Change-Id: Ice4b04db4a45c07ccffc3892e6db5d814c2ec37b --- M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js M modules/ve-mw/init/ve.init.mw.ArticleTarget.js 2 files changed, 41 insertions(+), 41 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/93/332993/1 diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index d035055..47b415f 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1838,47 +1838,6 @@ }; /** - * Get a wikitext fragment from a document - * - * @param {ve.dm.Document} doc Document - * @param {boolean} [useRevision=true] Whether to use the revision ID + ETag - * @return {jQuery.Promise} Abortable promise which resolves with a wikitext string - */ -ve.init.mw.DesktopArticleTarget.prototype.getWikitextFragment = function ( doc, useRevision ) { - var promise, xhr, - params = { - action: 'visualeditoredit', - token: this.editToken, - paction: 'serialize', - html: ve.dm.converter.getDomFromModel( doc ).body.innerHTML, - page: this.pageName - }; - - if ( useRevision === undefined || useRevision ) { - params.oldid = this.revid; - params.etag = this.etag; - } - - xhr = new mw.Api().post( - params, - { contentType: 'multipart/form-data' } - ); - - promise = xhr.then( function ( response ) { - if ( response.visualeditoredit ) { - return response.visualeditoredit.content; - } - return $.Deferred().reject(); - } ); - - promise.abort = function () { - xhr.abort(); - }; - - return promise; -}; - -/** * Resets the document opacity when we've decided to cancel switching to the wikitext editor. */ ve.init.mw.DesktopArticleTarget.prototype.resetDocumentOpacity = function () { diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 0ab38e5..9d0808c 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -2144,3 +2144,44 @@ this.welcomeDialogPromise.reject(); } }; + +/** + * Get a wikitext fragment from a document + * + * @param {ve.dm.Document} doc Document + * @param {boolean} [useRevision=true] Whether to use the revision ID + ETag + * @return {jQuery.Promise} Abortable promise which resolves with a wikitext string + */ +ve.init.mw.ArticleTarget.prototype.getWikitextFragment = function ( doc, useRevision ) { + var promise, xhr, + params = { + action: 'visualeditoredit', + token: this.editToken, + paction: 'serialize', + html: ve.dm.converter.getDomFromModel( doc ).body.innerHTML, + page: this.pageName + }; + + if ( useRevision === undefined || useRevision ) { + params.oldid = this.revid; + params.etag = this.etag; + } + + xhr = new mw.Api().post( + params, + { contentType: 'multipart/form-data' } + ); + + promise = xhr.then( function ( response ) { + if ( response.visualeditoredit ) { + return response.visualeditoredit.content; + } + return $.Deferred().reject(); + } ); + + promise.abort = function () { + xhr.abort(); + }; + + return promise; +}; -- To view, visit https://gerrit.wikimedia.org/r/332993 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice4b04db4a45c07ccffc3892e6db5d814c2ec37b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits