更多操作
(创建页面,内容为“// Check if we're editing a page. if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { // Add a hook handler. mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { // Configure a new toolbar entry on the given $textarea jQuery object. $textarea.wikiEditor( 'addToToolbar', { section: 'main', groups: { list: { tools: { templates: {…”) |
无编辑摘要 |
||
第4行: | 第4行: | ||
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | ||
// Configure a new toolbar entry on the given $textarea jQuery object. | // Configure a new toolbar entry on the given $textarea jQuery object. | ||
//题库模板的下拉菜单 | |||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
section: 'main', | section: 'main', | ||
第10行: | 第11行: | ||
tools: { | tools: { | ||
templates: { | templates: { | ||
label: ' | label: '题库模板', | ||
type: 'select', | type: 'select', | ||
list: { | list: { | ||
' | 'A1-button': { | ||
label: ' | label: 'A1型题', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: '{{ | pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=', | ||
post: '}}' | post: '\n}}' | ||
} | } | ||
} | } |
2023年6月3日 (六) 20:18的版本
// Check if we're editing a page.
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
// Add a hook handler.
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
// Configure a new toolbar entry on the given $textarea jQuery object.
//题库模板的下拉菜单
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
groups: {
list: {
tools: {
templates: {
label: '题库模板',
type: 'select',
list: {
'A1-button': {
label: 'A1型题',
action: {
type: 'encapsulate',
options: {
pre: '{{A型题\n|source=\n|title=\n|choices="A":"","B":"","C":"","D":"","E":""\n|answer=\n|explain=',
post: '\n}}'
}
}
},
'Clear-button': {
label: 'Clear',
action: {
type: 'encapsulate',
options: {
pre: '{{Clear}}'
}
}
},
'Done-button': {
label: 'Done',
action: {
type: 'encapsulate',
options: {
pre: '{{Done}}'
}
}
}
}
}
}
}
}
} );
} );
}