Hacks to get VE loading on mobile while user has NWE enabled

* ext.visualEditor.mwwikitext does not have mobile target
* We call mw.libs.ve.setEditorPreference from ArticleTarget

Change-Id: Ifae6e951155c83b13f3111732b0dc500349b1df2
This commit is contained in:
Alex Monk 2016-11-05 05:50:32 +00:00
parent 6913a736fd
commit 81e32c6a4b
2 changed files with 6 additions and 2 deletions

View file

@ -197,7 +197,10 @@ ve.init.mw.ArticleTarget.prototype.setMode = function () {
if ( this.mode !== oldMode ) { if ( this.mode !== oldMode ) {
this.updateTabs( true ); this.updateTabs( true );
mw.libs.ve.setEditorPreference( this.mode === 'visual' ? 'visualeditor' : 'wikitext' ); if ( mw.libs.ve.setEditorPreference ) {
// only set up by DAT.init
mw.libs.ve.setEditorPreference( this.mode === 'visual' ? 'visualeditor' : 'wikitext' );
}
} }
}; };

View file

@ -38,7 +38,8 @@
( (
mw.user.options.get( 'visualeditor-newwikitext' ) || mw.user.options.get( 'visualeditor-newwikitext' ) ||
new mw.Uri().query.veaction === 'editsource' new mw.Uri().query.veaction === 'editsource'
) ) &&
mw.loader.getState( 'ext.visualEditor.mwwikitext' )
) { ) {
modules.push( 'ext.visualEditor.mwwikitext' ); modules.push( 'ext.visualEditor.mwwikitext' );
} }