Vanessa 2025-04-17 10:12:22 +08:00
parent aca0ac2afc
commit f5c12e1ba1

View File

@ -72,7 +72,7 @@ import {countBlockWord, countSelectWord} from "../../layout/status";
import {showMessage} from "../../dialog/message"; import {showMessage} from "../../dialog/message";
import {getBacklinkHeadingMore, loadBreadcrumb} from "./renderBacklink"; import {getBacklinkHeadingMore, loadBreadcrumb} from "./renderBacklink";
import {removeSearchMark} from "../toolbar/util"; import {removeSearchMark} from "../toolbar/util";
import {activeBlur, hideKeyboardToolbar} from "../../mobile/util/keyboardToolbar"; import {activeBlur} from "../../mobile/util/keyboardToolbar";
import {commonClick} from "./commonClick"; import {commonClick} from "./commonClick";
import {avClick, avContextmenu, updateAVName} from "../render/av/action"; import {avClick, avContextmenu, updateAVName} from "../render/av/action";
import {selectRow, stickyRow, updateHeader} from "../render/av/row"; import {selectRow, stickyRow, updateHeader} from "../render/av/row";
@ -2151,7 +2151,7 @@ export class WYSIWYG {
return; return;
} }
}); });
let mobileBlur = false;
this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => { this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
if (this.preventClick) { if (this.preventClick) {
this.preventClick = false; this.preventClick = false;
@ -2167,6 +2167,7 @@ export class WYSIWYG {
/// #if MOBILE /// #if MOBILE
// https://github.com/siyuan-note/siyuan/issues/14569 // https://github.com/siyuan-note/siyuan/issues/14569
if (event.target.tagName === "VIDEO") { if (event.target.tagName === "VIDEO") {
mobileBlur = true;
activeBlur(); activeBlur();
return; return;
} }
@ -2263,6 +2264,7 @@ export class WYSIWYG {
action.push(Constants.CB_GET_HL); action.push(Constants.CB_GET_HL);
} }
/// #if MOBILE /// #if MOBILE
mobileBlur = true;
activeBlur(); activeBlur();
openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
/// #else /// #else
@ -2329,6 +2331,7 @@ export class WYSIWYG {
excludeIDs: [blockElement.getAttribute("data-node-id")] excludeIDs: [blockElement.getAttribute("data-node-id")]
}, (response) => { }, (response) => {
checkFold(response.data.refDefs[0].refID, (zoomIn) => { checkFold(response.data.refDefs[0].refID, (zoomIn) => {
mobileBlur = true;
activeBlur(); activeBlur();
openMobileFileById(protyle.app, response.data.refDefs[0].refID, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); openMobileFileById(protyle.app, response.data.refDefs[0].refID, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
}); });
@ -2402,6 +2405,7 @@ export class WYSIWYG {
const embedId = embedItemElement.getAttribute("data-id"); const embedId = embedItemElement.getAttribute("data-id");
checkFold(embedId, (zoomIn, action) => { checkFold(embedId, (zoomIn, action) => {
/// #if MOBILE /// #if MOBILE
mobileBlur = true;
activeBlur(); activeBlur();
openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
/// #else /// #else
@ -2669,9 +2673,11 @@ export class WYSIWYG {
if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) { if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) {
countSelectWord(newRange, protyle.block.rootID); countSelectWord(newRange, protyle.block.rootID);
} }
if (getSelection().rangeCount === 0) { if (getSelection().rangeCount === 0 && !mobileBlur) {
// TODO https://github.com/siyuan-note/siyuan/issues/14589 点击 video 也可以测试一下 https://github.com/siyuan-note/siyuan/issues/14569
// https://github.com/siyuan-note/siyuan/issues/5901 // https://github.com/siyuan-note/siyuan/issues/5901
focusByRange(newRange); focusByRange(newRange);
mobileBlur = false;
} }
/// #if !MOBILE /// #if !MOBILE
pushBack(protyle, newRange); pushBack(protyle, newRange);