mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Merge "Remove #wpTextbox1 fallback from ArticleTargetLoader#requestPageData"
This commit is contained in:
commit
77987b976d
|
@ -252,7 +252,9 @@
|
||||||
section,
|
section,
|
||||||
oldid,
|
oldid,
|
||||||
'mwTarget', // ve.init.mw.DesktopArticleTarget.static.name
|
'mwTarget', // ve.init.mw.DesktopArticleTarget.static.name
|
||||||
modified
|
modified,
|
||||||
|
// If switching to visual, check if we have wikitext to convert
|
||||||
|
mode === 'visual' ? $( '#wpTextbox1' ).textSelection( 'getContents' ) : undefined
|
||||||
);
|
);
|
||||||
} )
|
} )
|
||||||
.done( incrementLoadingProgress );
|
.done( incrementLoadingProgress );
|
||||||
|
|
|
@ -103,13 +103,14 @@
|
||||||
* @param {string} [oldid] Old revision ID, current if omitted
|
* @param {string} [oldid] Old revision ID, current if omitted
|
||||||
* @param {string} [targetName] Optional target name for tracking
|
* @param {string} [targetName] Optional target name for tracking
|
||||||
* @param {boolean} [modified] The page was been modified before loading (e.g. in source mode)
|
* @param {boolean} [modified] The page was been modified before loading (e.g. in source mode)
|
||||||
|
* @param {string} [wikitext] Wikitext to convert to HTML. The original document is fetched if undefined.
|
||||||
* @return {jQuery.Promise} Abortable promise resolved with a JSON object
|
* @return {jQuery.Promise} Abortable promise resolved with a JSON object
|
||||||
*/
|
*/
|
||||||
requestPageData: function ( mode, pageName, section, oldid, targetName, modified ) {
|
requestPageData: function ( mode, pageName, section, oldid, targetName, modified, wikitext ) {
|
||||||
if ( mode === 'source' ) {
|
if ( mode === 'source' ) {
|
||||||
return this.requestWikitext( pageName, section, oldid, targetName, modified );
|
return this.requestWikitext( pageName, section, oldid, targetName, modified );
|
||||||
} else {
|
} else {
|
||||||
return this.requestParsoidData( pageName, oldid, targetName, modified );
|
return this.requestParsoidData( pageName, oldid, targetName, modified, wikitext );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -168,10 +169,6 @@
|
||||||
'Api-User-Agent': 'VisualEditor-MediaWiki/' + mw.config.get( 'wgVersion' )
|
'Api-User-Agent': 'VisualEditor-MediaWiki/' + mw.config.get( 'wgVersion' )
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( wikitext === undefined ) {
|
|
||||||
wikitext = $( '#wpTextbox1' ).textSelection( 'getContents' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
// wikitext can be an empty string
|
// wikitext can be an empty string
|
||||||
wikitext !== undefined &&
|
wikitext !== undefined &&
|
||||||
|
|
Loading…
Reference in a new issue