mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 22:25:27 +00:00
Merge "Intercept desktop editor links"
This commit is contained in:
commit
43a459bf5f
|
@ -151,7 +151,8 @@
|
||||||
* @param {Page} page The page to edit.
|
* @param {Page} page The page to edit.
|
||||||
*/
|
*/
|
||||||
function setupEditor( page ) {
|
function setupEditor( page ) {
|
||||||
var isNewPage = page.options.id === 0,
|
var uri, fragment, editorOverride,
|
||||||
|
isNewPage = page.options.id === 0,
|
||||||
leadSection = page.getLeadSectionElement();
|
leadSection = page.getLeadSectionElement();
|
||||||
|
|
||||||
if ( mw.util.getParamValue( 'undo' ) ) {
|
if ( mw.util.getParamValue( 'undo' ) ) {
|
||||||
|
@ -237,9 +238,15 @@
|
||||||
// Not on pages which are outputs of the Page Translation feature
|
// Not on pages which are outputs of the Page Translation feature
|
||||||
mw.config.get( 'wgTranslatePageTranslation' ) !== 'translation' &&
|
mw.config.get( 'wgTranslatePageTranslation' ) !== 'translation' &&
|
||||||
|
|
||||||
// If the user prefers the VisualEditor or the user has no preference and
|
(
|
||||||
// the VisualEditor is the default editor for this wiki
|
// If the user prefers the VisualEditor or the user has no preference and
|
||||||
preferredEditor === 'VisualEditor'
|
// the VisualEditor is the default editor for this wiki
|
||||||
|
preferredEditor === 'VisualEditor' ||
|
||||||
|
// We've loaded it via the URL for this request
|
||||||
|
editorOverride === 'VisualEditor'
|
||||||
|
) &&
|
||||||
|
|
||||||
|
editorOverride !== 'SourceEditor'
|
||||||
) {
|
) {
|
||||||
logInit( 'visualeditor' );
|
logInit( 'visualeditor' );
|
||||||
loader.loadModule( 'mobile.editor.ve' ).done( function () {
|
loader.loadModule( 'mobile.editor.ve' ).done( function () {
|
||||||
|
@ -302,6 +309,27 @@
|
||||||
// prevent folding section when clicking Edit
|
// prevent folding section when clicking Edit
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
if ( !router.getPath() && ( mw.util.getParamValue( 'veaction' ) || mw.util.getParamValue( 'action' ) ) ) {
|
||||||
|
if ( mw.util.getParamValue( 'veaction' ) === 'edit' ) {
|
||||||
|
editorOverride = 'VisualEditor';
|
||||||
|
} else if ( mw.util.getParamValue( 'veaction' ) === 'editsource' ) {
|
||||||
|
editorOverride = 'SourceEditor';
|
||||||
|
}
|
||||||
|
// else: action=edit, for which we allow the default to take effect
|
||||||
|
fragment = '#/editor/' + ( mw.util.getParamValue( 'section' ) || '0' );
|
||||||
|
if ( window.history && history.pushState ) {
|
||||||
|
uri = mw.Uri();
|
||||||
|
delete uri.query.action;
|
||||||
|
delete uri.query.veaction;
|
||||||
|
// Note: replaceState rather than pushState, because we're
|
||||||
|
// just reformatting the URL to the equivalent-meaning for the
|
||||||
|
// mobile site.
|
||||||
|
history.replaceState( null, document.title, uri.toString() + fragment );
|
||||||
|
} else {
|
||||||
|
router.navigate( fragment );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue