mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 23:38:49 +01:00
This commit is contained in:
parent
e7204ac10f
commit
7981945bd3
3 changed files with 5 additions and 2 deletions
|
|
@ -177,7 +177,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
|
|||
if (!popoverTargetElement && linkElement && linkElement.getAttribute("data-href")?.startsWith("siyuan://blocks")) {
|
||||
popoverTargetElement = linkElement;
|
||||
}
|
||||
if (!popoverTargetElement) {
|
||||
if (!popoverTargetElement || window.siyuan.menus.menu?.data.isSameNode(popoverTargetElement)) {
|
||||
// 移动到弹窗的 loading 元素上,但经过 settimeout 后 loading 已经被移除了
|
||||
// https://ld246.com/article/1673596577519/comment/1673767749885#comments
|
||||
let targetElement = target;
|
||||
|
|
@ -269,7 +269,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: false
|
|||
};
|
||||
|
||||
export const showPopover = async (app: App, showRef = false) => {
|
||||
if (!popoverTargetElement) {
|
||||
if (!popoverTargetElement || window.siyuan.menus.menu.data?.isSameNode(popoverTargetElement)) {
|
||||
return;
|
||||
}
|
||||
let ids: string[];
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {Constants} from "../constants";
|
|||
|
||||
export class Menu {
|
||||
public element: HTMLElement;
|
||||
public data: any; // 用于记录当前菜单的数据
|
||||
public removeCB: () => void;
|
||||
private wheelEvent: string;
|
||||
|
||||
|
|
@ -111,6 +112,7 @@ export class Menu {
|
|||
this.element.removeAttribute("style"); // zIndex
|
||||
window.siyuan.menus.menu.element.removeAttribute("data-name"); // 标识再次点击不消失
|
||||
window.siyuan.menus.menu.element.removeAttribute("data-from"); // 标识是否在浮窗内打开
|
||||
window.siyuan.menus.menu.data = undefined; // 移除数据
|
||||
}
|
||||
|
||||
public append(element?: HTMLElement, index?: number) {
|
||||
|
|
|
|||
|
|
@ -604,6 +604,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
h: 26
|
||||
});
|
||||
const popoverElement = hasTopClosestByClassName(protyle.element, "block__popover", true);
|
||||
window.siyuan.menus.menu.data = element;
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", popoverElement ? popoverElement.dataset.level + "popover" : "app");
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.element.querySelector("input").select();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue