这是林泊百科的迁移技术测试站点,所有改动不会同步到林泊百科上,此站点将会在正式迁移后关闭,请勿存放重要数据
MediaWiki:Gadget-Emoji.js:修订间差异
跳转到导航
跳转到搜索
小 排版 |
小无编辑摘要 |
||
| 第18行: | 第18行: | ||
} | } | ||
}); | }); | ||
$textarea.wikiEditor( 'addToToolbar', { | |||
section: 'secondary', | |||
group: 'default', | |||
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; | |||
} | |||
} | |||
} | |||
} ); | |||
});}); | });}); | ||
2022年4月3日 (日) 07:48的版本
$(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: 'secondary',
group: 'default',
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;
}
}
}
} );
});});