Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/8218

Vanessaf8ec38e41674
diff --git a/app/src/layout/dock/Bookmark.ts b/app/src/layout/dock/Bookmark.ts
index d2e3b59ad6..e540ae7ef5 100644
--- a/app/src/layout/dock/Bookmark.ts
+++ b/app/src/layout/dock/Bookmark.ts
@@ -73,12 +73,16 @@ export class Bookmark extends Model {
this.tree = new Tree({
element: this.element.lastElementChild as HTMLElement,
data: null,
- click:(element: HTMLElement, event: MouseEvent)=> {
- const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action");
- if (actionElement) {
- openBookmarkMenu(actionElement.parentElement, event, this);
- } else {
- const id = element.getAttribute("data-node-id");
+ click: (element: HTMLElement, event?: MouseEvent) => {
+ if (event) {
+ const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action");
+ if (actionElement) {
+ openBookmarkMenu(actionElement.parentElement, event, this);
+ return;
+ }
+ }
+ const id = element.getAttribute("data-node-id");
+ if (id) {
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
openFileById({
id,
diff --git a/app/src/menus/bookmark.ts b/app/src/menus/bookmark.ts
index 33471c2ce0..19aeeb67a7 100644
--- a/app/src/menus/bookmark.ts
+++ b/app/src/menus/bookmark.ts
@@ -9,6 +9,11 @@ import {isMobile} from "../util/functions";
import {MobileBookmarks} from "../mobile/dock/MobileBookmarks";
export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookmarkObj: Bookmark | MobileBookmarks) => {
+ if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
+ window.siyuan.menus.menu.element.getAttribute("data-name") === "bookmarkMenu") {
+ window.siyuan.menus.menu.remove();
+ return;
+ }
window.siyuan.menus.menu.remove();
const id = element.getAttribute("data-node-id");
if (!id && !window.siyuan.config.readonly) {
@@ -79,6 +84,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
}
}).element);
}
+ window.siyuan.menus.menu.element.setAttribute("data-name", "bookmarkMenu");
window.siyuan.menus.menu.element.style.zIndex = "221"; // 移动端被右侧栏遮挡
- window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
+ window.siyuan.menus.menu.popup({x: event.clientX - 11, y: event.clientY + 11, h: 22});
};
diff --git a/app/src/mobile/dock/MobileBookmarks.ts b/app/src/mobile/dock/MobileBookmarks.ts
index fc7f265129..39a0dca080 100644
--- a/app/src/mobile/dock/MobileBookmarks.ts
+++ b/app/src/mobile/dock/MobileBookmarks.ts
@@ -28,16 +28,18 @@ export class MobileBookmarks {
this.tree = new Tree({
element: this.element.querySelector(".bookmarkList") as HTMLElement,
data: null,
- click: (element: HTMLElement, event: MouseEvent) => {
+ click: (element: HTMLElement, event?: MouseEvent) => {
const id = element.getAttribute("data-node-id");
- const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action");
- if (actionElement) {
- openBookmarkMenu(actionElement.parentElement, event, this);
- } else {
- fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
- openMobileFileById(id, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]);
- });
+ if (event) {
+ const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action");
+ if (actionElement) {
+ openBookmarkMenu(actionElement.parentElement, event, this);
+ return;
+ }
}
+ fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
+ openMobileFileById(id, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]);
+ });
},
blockExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>',
topExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>'