mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 03:40:15 +01:00
This commit is contained in:
parent
ffc9563f6c
commit
3d1de2ad56
3 changed files with 95 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ import {MobileFiles} from "./MobileFiles";
|
|||
import {MobileOutline} from "./MobileOutline";
|
||||
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
||||
import {MobileBacklinks} from "./MobileBacklinks";
|
||||
import {MobileBookmarks} from "./MobileBookmarks";
|
||||
import {MobileTags} from "./MobileTags";
|
||||
|
||||
export const initFramework = () => {
|
||||
setInlineStyle();
|
||||
|
|
@ -21,6 +23,8 @@ export const initFramework = () => {
|
|||
const sidebarElement = document.getElementById("sidebar");
|
||||
let outline: MobileOutline;
|
||||
let backlink: MobileBacklinks;
|
||||
let bookmark: MobileBookmarks
|
||||
let tag: MobileTags
|
||||
sidebarElement.querySelector(".toolbar--border").addEventListener(getEventName(), (event: Event & { target: Element }) => {
|
||||
const svgElement = hasTopClosestByTag(event.target, "svg");
|
||||
if (!svgElement || svgElement.classList.contains("toolbar__icon--active")) {
|
||||
|
|
@ -42,6 +46,18 @@ export const initFramework = () => {
|
|||
} else {
|
||||
backlink.update();
|
||||
}
|
||||
} else if (type === "sidebar-bookmark-tab") {
|
||||
if (!backlink) {
|
||||
bookmark = new MobileBookmarks();
|
||||
} else {
|
||||
backlink.update();
|
||||
}
|
||||
} else if (type === "sidebar-tag-tab") {
|
||||
if (!backlink) {
|
||||
tag = new MobileTags();
|
||||
} else {
|
||||
backlink.update();
|
||||
}
|
||||
}
|
||||
svgElement.classList.add("toolbar__icon--active");
|
||||
sidebarElement.lastElementChild.querySelector(`[data-type="${itemType.replace("-tab", "")}"]`).classList.remove("fn__none");
|
||||
|
|
@ -60,6 +76,10 @@ export const initFramework = () => {
|
|||
outline.update();
|
||||
} else if (type === "sidebar-backlink-tab") {
|
||||
backlink.update();
|
||||
} else if (type === "sidebar-bookmark-tab") {
|
||||
bookmark.update();
|
||||
} else if (type === "sidebar-tag-tab") {
|
||||
tag.update();
|
||||
}
|
||||
});
|
||||
document.getElementById("toolbarMore").addEventListener(getEventName(), () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue