This commit is contained in:
Vanessa 2023-03-25 16:56:56 +08:00
parent b4395bfca4
commit e936a2d5d7
5 changed files with 77 additions and 17 deletions

View file

@ -605,7 +605,7 @@ export class MobileFiles extends Model {
}
return `<li data-node-id="${item.id}" data-name="${Lute.EscapeHTMLStr(item.name)}" data-type="navigation-file"
class="b3-list-item" data-path="${item.path}">
<span style="padding-left: ${(item.path.split("/").length - 2) * 18 + 22}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}">
<span style="padding-left: ${(item.path.split("/").length - 2) * 29 + 40}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
<span class="b3-list-item__icon">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))}</span>

View file

@ -29,7 +29,8 @@ export const initFramework = () => {
let bookmark: MobileBookmarks;
let tag: MobileTags;
// 不能使用 getEventName否则点击返回会展开右侧栏
sidebarElement.querySelector(".toolbar--border").addEventListener("click", (event: Event & {
const firstToolbarElement = sidebarElement.querySelector(".toolbar--border")
firstToolbarElement.addEventListener("click", (event: Event & {
target: Element
}) => {
const svgElement = hasTopClosestByTag(event.target, "svg");
@ -41,8 +42,11 @@ export const initFramework = () => {
closePanel();
return;
}
sidebarElement.querySelectorAll(".toolbar--border svg").forEach(item => {
firstToolbarElement.querySelectorAll(".toolbar__icon").forEach(item => {
const itemType = item.getAttribute("data-type");
if (!itemType) {
return;
}
if (itemType === type) {
if (type === "sidebar-outline-tab") {
if (!outline) {
@ -57,13 +61,13 @@ export const initFramework = () => {
backlink.update();
}
} else if (type === "sidebar-bookmark-tab") {
if (!backlink) {
if (!bookmark) {
bookmark = new MobileBookmarks();
} else {
backlink.update();
}
} else if (type === "sidebar-tag-tab") {
if (!backlink) {
if (!tag) {
tag = new MobileTags();
} else {
tag.update();