mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
4ecb555c1f
commit
aa56c16830
5 changed files with 20 additions and 7 deletions
|
|
@ -15,8 +15,19 @@ export class Plugin {
|
|||
this.eventBus = new EventBus(options.name);
|
||||
}
|
||||
|
||||
public getData() {
|
||||
|
||||
public addTopBar(options: {
|
||||
icon: string,
|
||||
title: string,
|
||||
position: "right",
|
||||
callback: (evt: MouseEvent) => void
|
||||
}) {
|
||||
const iconElement = document.createElement("div");
|
||||
iconElement.className = "toolbar__item b3-tooltips b3-tooltips__sw";
|
||||
iconElement.setAttribute("aria-label", options.title);
|
||||
iconElement.innerHTML = options.icon.startsWith("icon") ? `<svg><use xlink:href="#${options.icon}"></use></svg>` : options.icon;
|
||||
iconElement.addEventListener("click", options.callback);
|
||||
document.querySelector("#" + (options.position === "right" ? "barSearch" : "drag")).before(iconElement);
|
||||
return iconElement;
|
||||
}
|
||||
|
||||
public onload() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue