You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

function updateVisualEditorConfig() {
if (ve) {
if (ve.init && ve.init.mw && ve.init.mw.Target) {
ve.init.mw.Target.static.toolbarGroups.forEach(function (toolbarItem) {
if (toolbarItem.name === 'format') {
// 将heading1从demote中移除防止heading1出现在底部
toolbarItem.demote = toolbarItem.demote.filter(function (item) {
return item !== 'heading1';
});
}
});
} else {
console.warn('Cannot find "ve.init.Target"');
}
if (ve.ui) {
// 重命名heading1-6
for (var i = 1; i <= 6; i ++) {
var className = 'MWHeading' + i + 'FormatTool';
var msgId = 'isekai-ve-formatdropdown-format-mw-heading' + i;
if (ve.ui[className]) {
ve.ui[className].static.title = OO.ui.deferMsg(msgId);
} else {
console.warn('Cannot find "ve.ui.' + className + '"');
}
}
} else {
console.warn('Cannot find "ve.ui"');
}
} else {
console.warn('Cannot find ve lib');
}
}
updateVisualEditorConfig();