Skip to content

Commit

Permalink
fix(MediaWiki:Gadget-wikieditor-highlight.js): no async event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry authored Dec 4, 2024
1 parent 3f82a51 commit f5da815
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@
}
const btnSettings = new OO.ui.ButtonWidget({
classes: ["tool"], icon: "settings", framed: false, title: "代码高亮设置",
}).on("click", async () => {
}).on("click", () => {
$("#cm-settings").trigger("click");
});
const btnHighlight = new OO.ui.ButtonWidget({
classes: ["tool"], icon: "highlight", framed: false, title: "代码高亮开关",
}).on("click", async () => {
if (cm) {
cm.toggle();
$(".group-codeeditor-main").toggle();
btnSettings.$element.toggle();
} else {
await init();
btnHighlight.$element.after(btnSettings.$element);
}
btnHighlight.$element.toggleClass("tool-active");
state = !state;
localObjectStorage.setItem("wikieditor-codemirror", state);
}).on("click", () => {
(async () => {
if (cm) {
cm.toggle();
$(".group-codeeditor-main").toggle();
btnSettings.$element.toggle();
} else {
await init();
btnHighlight.$element.after(btnSettings.$element);
}
btnHighlight.$element.toggleClass("tool-active");
state = !state;
localObjectStorage.setItem("wikieditor-codemirror", state);
})();
});
$textarea.on("wikiEditor-toolbar-doneInitialSections", () => {
btnHighlight.$element.appendTo("#wikiEditor-section-main > .group-insert");
Expand Down

0 comments on commit f5da815

Please sign in to comment.