« MediaWiki:Common.js » : différence entre les versions
De Keyla project
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 4 : | Ligne 4 : | ||
// 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', { | ||
section: ' | section: 'emoticons', | ||
group : ' | group: 'faces', | ||
tools: { | tools: { | ||
smile: { | |||
label: ' | label: 'Smile!', // or use mw.message( key ).escaped() for a localized label, see above | ||
type: 'button', | type: 'button', | ||
icon: | icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: " | pre: ":)" // text to be inserted | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
}); | } ); | ||
} ); | } ); | ||
} | } |
Version du 29 août 2023 à 09:52
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: 'emoticons',
group: 'faces',
tools: {
smile: {
label: 'Smile!', // or use mw.message( key ).escaped() for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ":)" // text to be inserted
}
}
}
}
} );
} );
}