MediaWiki:Gadget-Emoji.js:修订间差异
来自Limbo Wiki
小无编辑摘要 |
小无编辑摘要 |
||
第19行: | 第19行: | ||
}); | }); | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
section: ' | section: 'advanced', | ||
group: ' | group: 'format', | ||
tools: { | tools: { | ||
dothing: { | dothing: { |
2022年4月2日 (六) 23:49的版本
$(function() {mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { $textarea.wikiEditor( 'addToToolbar',{ section: 'advanced', group: 'format', tools: { buttonId: { label: 'Comment visible only for editors', type: 'button', action: { type: 'encapsulate', options: { pre: '<!-- ', peri: 'Insert comment here', post: ' -->' } } } } }); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { dothing: { type: 'element', element: function ( context ) { // Note that the `context` object contains various useful references. console.log( context ); var button = new OO.ui.ButtonInputWidget( { label: 'Do a thing', icon: 'hieroglyph' } ); button.connect( null, { click: function ( e ) { // Do whatever is required when the button is clicked. console.log( e ); OO.ui.alert( 'A thing is done.' ); } } ); return button.$element; } } } } ); });});