Vanessa 2026-02-16 15:35:27 +08:00
parent 59cecc25c2
commit 6d5743fee3
3 changed files with 29 additions and 7 deletions

View file

@ -1,4 +1,9 @@
import {hasClosestByAttribute, hasClosestByClassName, hasTopClosestByClassName,} from "../../protyle/util/hasClosest";
import {
hasClosestBlock,
hasClosestByAttribute,
hasClosestByClassName,
hasTopClosestByClassName, isInEmbedBlock,
} from "../../protyle/util/hasClosest";
import {closeModel, closePanel} from "./closePanel";
import {popMenu} from "../menu";
import {activeBlur} from "./keyboardToolbar";
@ -33,6 +38,21 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => {
event.preventDefault();
return;
}
if (typeof yDiff === "undefined" && window.siyuan.mobile.editor.protyle.options.render.gutter) {
const nodeElement = hasClosestBlock(target);
if (nodeElement) {
if (nodeElement && (nodeElement.classList.contains("list") || nodeElement.classList.contains("li"))) {
// 光标在列表下部应显示右侧的元素,而不是列表本身。放在 windowEvent 中的 mousemove 下处理
return;
}
const embedElement = isInEmbedBlock(nodeElement);
if (embedElement) {
window.siyuan.mobile.editor.protyle.gutter.render(window.siyuan.mobile.editor.protyle, embedElement);
return;
}
window.siyuan.mobile.editor.protyle.gutter.render(window.siyuan.mobile.editor.protyle, nodeElement, target);
}
}
isFirstMove = true;
if (!clientY || typeof yDiff === "undefined" ||
target.tagName === "AUDIO" ||

View file

@ -1,4 +1,5 @@
import {getAllEditor} from "../../layout/getAll";
import {isIPhone} from "../util/compatibility";
// "gutter", "toolbar", "select", "hint", "util", "dialog", "gutterOnly"
export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
@ -25,7 +26,9 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
}
// 不能 remove("protyle-wysiwyg--hl") 否则打开页签的时候 "cb-get-hl" 高亮会被移除
if (protyle.gutter && panels.includes("gutterOnly")) {
protyle.gutter.element.classList.add("fn__none");
if (!isIPhone()) {
protyle.gutter.element.classList.add("fn__none");
}
protyle.gutter.element.innerHTML = "";
}
if (protyle.toolbar && panels.includes("toolbar")) {

View file

@ -182,8 +182,8 @@ export const initUI = (protyle: IProtyle) => {
}
});
let overAttr = false;
const isTouch = isTouchDevice();
protyle.element.addEventListener(isTouch ? "touchend" : "mouseover", (event: KeyboardEvent & {
/// #if !MOBILE
protyle.element.addEventListener("mouseover", (event: KeyboardEvent & {
target: HTMLElement
}) => {
// attr
@ -221,7 +221,7 @@ export const initUI = (protyle: IProtyle) => {
// gutter
const buttonElement = hasClosestByTag(event.target, "BUTTON");
if (!isTouch && buttonElement && buttonElement.parentElement.classList.contains("protyle-gutters")) {
if (buttonElement && buttonElement.parentElement.classList.contains("protyle-gutters")) {
const type = buttonElement.getAttribute("data-type");
if (type === "fold" || type === "NodeAttributeViewRow") {
Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl, .av__row--hl")).forEach(item => {
@ -254,7 +254,6 @@ export const initUI = (protyle: IProtyle) => {
}
// 面包屑
/// #if !MOBILE
if (protyle.selectElement.classList.contains("fn__none")) {
const svgElement = hasClosestByAttribute(event.target, "data-node-id", null);
if (svgElement && svgElement.parentElement.classList.contains("protyle-breadcrumb__bar")) {
@ -267,8 +266,8 @@ export const initUI = (protyle: IProtyle) => {
}
}
}
/// #endif
});
/// #endif
};
export const addLoading = (protyle: IProtyle, msg?: string) => {