Mediawiki - как добавить кнопку source lang bash в редактор в WikiEditor
Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2026
прописать в wiki/MediaWiki:Common.js:
mw.loader.using('ext.wikiEditor').then(function () {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
bash: {
label: 'Bash',
type: 'button',
icon: 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22">' +
'<rect x="2" y="3" width="18" height="16" rx="2" fill="#54595d"/>' +
'<path d="M6 8l3 3-3 3" stroke="#fff" stroke-width="1.8" fill="none" stroke-linecap="round" stroke-linejoin="round"/>' +
'<line x1="11" y1="14" x2="16" y2="14" stroke="#fff" stroke-width="1.8" stroke-linecap="round"/>' +
'</svg>'
),
action: {
type: 'encapsulate',
options: {
pre: '<source lang="bash">\n',
post: '\n</source>'
}
}
}
}
});
});
В LocalSettings.php
$wgDefaultUserOptions['usebetatoolbar'] = 1; $wgHiddenPrefs[] = 'usebetatoolbar';
Заработает только после чистки кэша в браузере
