User:PPenloglou-WMF/common.js: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
group: 'format', |
group: 'format', |
||
tools: { |
tools: { |
||
" |
"translate": { |
||
label: ' |
label: 'Wrap in <translate>', |
||
type: 'button', |
type: 'button', |
||
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png', |
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png', |
||
Line 15: | Line 15: | ||
type: 'encapsulate', |
type: 'encapsulate', |
||
options: { |
options: { |
||
pre: "< |
pre: "<translate>", |
||
post: " |
post: "</translate>" |
||
} |
} |
||
} |
} |
Latest revision as of 19:52, 10 May 2024
// 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: 'advanced',
group: 'format',
tools: {
"translate": {
label: 'Wrap in <translate>',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
action: {
type: 'encapsulate',
options: {
pre: "<translate>",
post: "</translate>"
}
}
}
}
});
});
}