This commit is contained in:
Vanessa 2022-11-02 15:41:47 +08:00
parent e5703dc70f
commit 08859f198b
4 changed files with 12 additions and 6 deletions

View file

@ -20,6 +20,7 @@
} }
.b3-menu { .b3-menu {
max-width: 70%;
max-height: 50vh; max-height: 50vh;
overflow: auto; overflow: auto;
top: 48px; top: 48px;

View file

@ -515,8 +515,9 @@ export class Wnd {
}).element); }).element);
}); });
window.siyuan.menus.menu.popup({ window.siyuan.menus.menu.popup({
x: event.clientX - 16, x: event.clientX,
y: event.clientY, y: event.clientY,
w: 16
}); });
} }

View file

@ -76,7 +76,7 @@ export class Menu {
this.element.innerHTML = ""; this.element.innerHTML = "";
this.element.removeAttribute("data-filetreeid"); // 用于标记文档数右键所选文档 https://ld246.com/article/1667311960383 this.element.removeAttribute("data-filetreeid"); // 用于标记文档数右键所选文档 https://ld246.com/article/1667311960383
this.element.classList.add("fn__none"); this.element.classList.add("fn__none");
this.element.removeAttribute("style") this.element.removeAttribute("style"); // 页签下拉需要设置 overflow 和 max-height
} }
public append(element?: HTMLElement) { public append(element?: HTMLElement) {
@ -86,7 +86,7 @@ export class Menu {
this.element.append(element); this.element.append(element);
} }
public popup(options: { x: number, y: number, h?: number }, isLeft = false) { public popup(options: { x: number, y: number, h?: number , w?: number }, isLeft = false) {
if (this.element.innerHTML === "") { if (this.element.innerHTML === "") {
return; return;
} }
@ -97,7 +97,7 @@ export class Menu {
} }
this.element.classList.remove("fn__none"); this.element.classList.remove("fn__none");
setPosition(this.element, options.x - (isLeft ? window.siyuan.menus.menu.element.clientWidth : 0), options.y, options.h); setPosition(this.element, options.x - (isLeft ? window.siyuan.menus.menu.element.clientWidth : 0), options.y, options.h, options.w);
} }
} }

View file

@ -266,7 +266,9 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
}); });
} }
window.siyuan.menus.menu.element.style.zIndex = "310"; window.siyuan.menus.menu.element.style.zIndex = "310";
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16}); window.siyuan.menus.menu.element.style.overflow = "auto";
window.siyuan.menus.menu.element.style.maxHeight = "60vh";
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16, w: 16});
}); });
break; break;
} }
@ -471,7 +473,9 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
}); });
} }
window.siyuan.menus.menu.element.style.zIndex = "310"; window.siyuan.menus.menu.element.style.zIndex = "310";
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16}); window.siyuan.menus.menu.element.style.overflow = "auto";
window.siyuan.menus.menu.element.style.maxHeight = "60vh";
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16, w: 16});
}); });
break; break;
} }