mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-28 02:00:34 +00:00
090929cf1d
Disable preview functionality when screen is less than 600px. Bug: T293337 Change-Id: I4615f629a0c97fb325721bbddee5c9eb074c3a5c
21 lines
619 B
JavaScript
21 lines
619 B
JavaScript
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
|
|
var RealtimePreview = require( './RealtimePreview.js' );
|
|
var realtimePreview = new RealtimePreview();
|
|
$textarea.wikiEditor( 'addToToolbar', {
|
|
section: 'secondary',
|
|
group: 'default',
|
|
tools: {
|
|
realtimepreview: {
|
|
type: 'element',
|
|
element: function ( context ) {
|
|
return realtimePreview.getToolbarButton( context ).$element;
|
|
}
|
|
}
|
|
}
|
|
} );
|
|
if ( realtimePreview.getUserPref() && realtimePreview.isScreenWideEnough() ) {
|
|
realtimePreview.setEnabled();
|
|
mw.hook( 'ext.WikiEditor.realtimepreview.inuse' ).fire( this );
|
|
}
|
|
} );
|