This commit is contained in:
Vanessa 2022-07-30 23:35:40 +08:00
parent d633aad606
commit b75be56ac0
3 changed files with 6 additions and 5 deletions

View file

@ -267,9 +267,9 @@ let rectElement: HTMLElement;
const showToolbar = (element: HTMLElement, range: Range, target?: HTMLElement) => {
if (target) {
// 阻止 popover
target.classList.remove("popover__block");
target.setAttribute("prevent-popover", "true");
setTimeout(() => {
target.classList.add("popover__block");
target.removeAttribute("prevent-popover");
}, 620);
}

View file

@ -106,7 +106,8 @@ export const initBlockPopover = () => {
if (!popoverTargetElement && aElement && aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") && aElement.getAttribute("prevent-popover") !== "true") {
popoverTargetElement = aElement;
}
if (!popoverTargetElement || window.siyuan.altIsPressed || window.siyuan.shiftIsPressed || window.siyuan.ctrlIsPressed) {
if (!popoverTargetElement || window.siyuan.altIsPressed || window.siyuan.shiftIsPressed || window.siyuan.ctrlIsPressed ||
(popoverTargetElement && popoverTargetElement.getAttribute("prevent-popover") === "true")) {
return;
}
// https://github.com/siyuan-note/siyuan/issues/4314

View file

@ -452,9 +452,9 @@ export class WYSIWYG {
const rect = target.getBoundingClientRect();
setPosition(window.siyuan.menus.menu.element, rect.left, rect.top + 13, 26);
// 阻止 popover
target.removeAttribute("data-type");
target.setAttribute("prevent-popover", "true");
setTimeout(() => {
target.setAttribute("data-type", "block-ref");
target.removeAttribute("prevent-popover");
}, 620);
return false;
}