mediawiki-extensions-WikiEd.../modules/realtimepreview/init.js

21 lines
575 B
JavaScript
Raw Normal View History

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.enable();
mw.hook( 'ext.WikiEditor.realtimepreview.inuse' ).fire( this );
}
} );