This commit is contained in:
Vanessa 2024-07-25 17:55:25 +08:00
parent 73e2ce44e9
commit c6d2d629e8
16 changed files with 98 additions and 78 deletions

View file

@ -8,7 +8,11 @@ import {Constants} from "../../constants";
import {isIPad} from "../../protyle/util/compatibility";
import {globalTouchEnd, globalTouchStart} from "./touch";
import {initDockMenu} from "../../menus/dock";
import {hasClosestByAttribute, hasClosestByClassName, hasTopClosestByAttribute} from "../../protyle/util/hasClosest";
import {
hasClosestByAttribute,
hasClosestByClassName,
isInEmbedBlock
} from "../../protyle/util/hasClosest";
import {initTabMenu} from "../../menus/tab";
import {getInstanceById} from "../../layout/util";
import {Tab} from "../../layout/Tab";
@ -85,7 +89,7 @@ export const initWindowEvent = (app: App) => {
}
return;
}
const embedBlockElement = hasTopClosestByAttribute(target, "data-type", "NodeBlockQueryEmbed");
const embedBlockElement = isInEmbedBlock(target);
if (embedBlockElement) {
embedBlockElement.firstElementChild.classList.toggle("protyle-icons--show");
return;

View file

@ -1,5 +1,10 @@
import {isIPad} from "../../protyle/util/compatibility";
import {hasClosestByAttribute, hasClosestByClassName, hasTopClosestByTag} from "../../protyle/util/hasClosest";
import {
hasClosestByAttribute,
hasClosestByClassName,
hasTopClosestByTag,
isInEmbedBlock
} from "../../protyle/util/hasClosest";
import {initFileMenu, initNavigationMenu} from "../../menus/navigation";
import {fileAnnotationRefMenu, inlineMathMenu, linkMenu, refMenu, tagMenu} from "../../menus/protyle";
import {App} from "../../index";
@ -80,7 +85,7 @@ export const globalTouchEnd = (event: TouchEvent, yDiff: number, time: number, a
return true;
}
// 内元素弹出菜单
if (target.tagName === "SPAN" && !hasClosestByAttribute(target, "data-type", "NodeBlockQueryEmbed")) {
if (target.tagName === "SPAN" && !isInEmbedBlock(target)) {
let editor: Protyle;
/// #if !MOBILE
const tabContainerElement = hasClosestByClassName(target, "protyle", true);