|
@@ -14,6 +14,8 @@ import {MobileFiles} from "./MobileFiles";
|
|
import {MobileOutline} from "./MobileOutline";
|
|
import {MobileOutline} from "./MobileOutline";
|
|
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
|
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
|
import {MobileBacklinks} from "./MobileBacklinks";
|
|
import {MobileBacklinks} from "./MobileBacklinks";
|
|
|
|
+import {MobileBookmarks} from "./MobileBookmarks";
|
|
|
|
+import {MobileTags} from "./MobileTags";
|
|
|
|
|
|
export const initFramework = () => {
|
|
export const initFramework = () => {
|
|
setInlineStyle();
|
|
setInlineStyle();
|
|
@@ -21,6 +23,8 @@ export const initFramework = () => {
|
|
const sidebarElement = document.getElementById("sidebar");
|
|
const sidebarElement = document.getElementById("sidebar");
|
|
let outline: MobileOutline;
|
|
let outline: MobileOutline;
|
|
let backlink: MobileBacklinks;
|
|
let backlink: MobileBacklinks;
|
|
|
|
+ let bookmark: MobileBookmarks
|
|
|
|
+ let tag: MobileTags
|
|
sidebarElement.querySelector(".toolbar--border").addEventListener(getEventName(), (event: Event & { target: Element }) => {
|
|
sidebarElement.querySelector(".toolbar--border").addEventListener(getEventName(), (event: Event & { target: Element }) => {
|
|
const svgElement = hasTopClosestByTag(event.target, "svg");
|
|
const svgElement = hasTopClosestByTag(event.target, "svg");
|
|
if (!svgElement || svgElement.classList.contains("toolbar__icon--active")) {
|
|
if (!svgElement || svgElement.classList.contains("toolbar__icon--active")) {
|
|
@@ -42,6 +46,18 @@ export const initFramework = () => {
|
|
} else {
|
|
} else {
|
|
backlink.update();
|
|
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");
|
|
svgElement.classList.add("toolbar__icon--active");
|
|
sidebarElement.lastElementChild.querySelector(`[data-type="${itemType.replace("-tab", "")}"]`).classList.remove("fn__none");
|
|
sidebarElement.lastElementChild.querySelector(`[data-type="${itemType.replace("-tab", "")}"]`).classList.remove("fn__none");
|
|
@@ -60,6 +76,10 @@ export const initFramework = () => {
|
|
outline.update();
|
|
outline.update();
|
|
} else if (type === "sidebar-backlink-tab") {
|
|
} else if (type === "sidebar-backlink-tab") {
|
|
backlink.update();
|
|
backlink.update();
|
|
|
|
+ } else if (type === "sidebar-bookmark-tab") {
|
|
|
|
+ bookmark.update();
|
|
|
|
+ } else if (type === "sidebar-tag-tab") {
|
|
|
|
+ tag.update();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
document.getElementById("toolbarMore").addEventListener(getEventName(), () => {
|
|
document.getElementById("toolbarMore").addEventListener(getEventName(), () => {
|