mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
e03644895d
commit
636039ea52
3 changed files with 21 additions and 7 deletions
|
|
@ -72,11 +72,11 @@ class App {
|
||||||
initAssets();
|
initAssets();
|
||||||
fetchPost("/api/setting/getCloudUser", {}, userResponse => {
|
fetchPost("/api/setting/getCloudUser", {}, userResponse => {
|
||||||
window.siyuan.user = userResponse.data;
|
window.siyuan.user = userResponse.data;
|
||||||
loadPlugins(siyuanApp);
|
|
||||||
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
|
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
|
||||||
window.siyuan.emojis = emojiResponse.data as IEmoji[];
|
window.siyuan.emojis = emojiResponse.data as IEmoji[];
|
||||||
initFramework();
|
initFramework();
|
||||||
initRightMenu();
|
initRightMenu();
|
||||||
|
loadPlugins(siyuanApp);
|
||||||
openChangelog();
|
openChangelog();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {Dialog} from "../dialog";
|
||||||
import {MenuItem} from "../menus/Menu";
|
import {MenuItem} from "../menus/Menu";
|
||||||
import {Menu as SiyuanMenu} from "../menus/Menu";
|
import {Menu as SiyuanMenu} from "../menus/Menu";
|
||||||
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
|
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
|
||||||
|
import {isMobile} from "../util/functions";
|
||||||
|
|
||||||
export class Menu {
|
export class Menu {
|
||||||
private menu: SiyuanMenu;
|
private menu: SiyuanMenu;
|
||||||
|
|
@ -58,6 +59,7 @@ export class Menu {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.menu.fullscreen(position);
|
this.menu.fullscreen(position);
|
||||||
|
this.menu.element.style.zIndex = "310";
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|
@ -74,4 +76,5 @@ export const API = {
|
||||||
Plugin: Plugin,
|
Plugin: Plugin,
|
||||||
Dialog,
|
Dialog,
|
||||||
Menu,
|
Menu,
|
||||||
|
isMobile
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
import {EventBus} from "./EventBus";
|
import {EventBus} from "./EventBus";
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
|
import {isMobile, isWindow} from "../util/functions";
|
||||||
|
|
||||||
export class Plugin {
|
export class Plugin {
|
||||||
public i18n: IObject;
|
public i18n: IObject;
|
||||||
|
|
@ -28,12 +29,22 @@ export class Plugin {
|
||||||
callback: (evt: MouseEvent) => void
|
callback: (evt: MouseEvent) => void
|
||||||
}) {
|
}) {
|
||||||
const iconElement = document.createElement("div");
|
const iconElement = document.createElement("div");
|
||||||
iconElement.className = "toolbar__item b3-tooltips b3-tooltips__sw";
|
if (isMobile()) {
|
||||||
iconElement.setAttribute("aria-label", options.title);
|
iconElement.className = "b3-menu__item";
|
||||||
iconElement.setAttribute("data-menu", "true");
|
iconElement.setAttribute("aria-label", options.title);
|
||||||
iconElement.innerHTML = options.icon.startsWith("icon") ? `<svg><use xlink:href="#${options.icon}"></use></svg>` : options.icon;
|
iconElement.setAttribute("data-menu", "true");
|
||||||
iconElement.addEventListener("click", options.callback);
|
iconElement.innerHTML = (options.icon.startsWith("icon") ? `<svg class="b3-menu__icon"><use xlink:href="#${options.icon}"></use></svg>` : options.icon) +
|
||||||
document.querySelector("#" + (options.position === "right" ? "barSearch" : "drag")).before(iconElement);
|
`<span class="b3-menu__label">${options.title}</span>`;
|
||||||
|
iconElement.addEventListener("click", options.callback);
|
||||||
|
document.querySelector("#menuAbout").after(iconElement);
|
||||||
|
} else if (!isWindow()) {
|
||||||
|
iconElement.className = "toolbar__item b3-tooltips b3-tooltips__sw";
|
||||||
|
iconElement.setAttribute("aria-label", options.title);
|
||||||
|
iconElement.setAttribute("data-menu", "true");
|
||||||
|
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;
|
return iconElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue