2021-11-18 10:50:17 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} );
|
2022-03-31 05:03:18 +00:00
|
|
|
if ( realtimePreview.getUserPref() ) {
|
|
|
|
realtimePreview.enable();
|
2022-03-29 05:34:11 +00:00
|
|
|
mw.hook( 'ext.WikiEditor.realtimepreview.inuse' ).fire( this );
|
2022-03-31 05:03:18 +00:00
|
|
|
}
|
2021-11-18 10:50:17 +00:00
|
|
|
} );
|