Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/7594

Vanessa51b151c85ab2
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index cb190c6cd5..dab55537f9 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -36,6 +36,7 @@ import {makeCard, quickMakeCard} from "../../card/makeCard";
import {transferBlockRef} from "../../menus/block";
import {isMobile} from "../../util/functions";
import {AIActions} from "../../ai/actions";
+import {activeBlur} from "../../mobile/util/keyboardToolbar";
export class Gutter {
public element: HTMLElement;
@@ -700,6 +701,9 @@ export class Gutter {
public renderMenu(protyle: IProtyle, buttonElement: Element) {
hideElements(["util", "toolbar", "hint"], protyle);
window.siyuan.menus.menu.remove();
+ if (isMobile()) {
+ activeBlur();
+ }
const id = buttonElement.getAttribute("data-node-id");
const selectsElement = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
if (selectsElement.length > 1) {
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 8708f84c26..8be3f82ed6 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -30,6 +30,7 @@ import {openMobileFileById} from "../../mobile/editor";
import {getIconByType} from "../../editor/getIcon";
import {processRender} from "../util/processCode";
import {AIChat} from "../../ai/chat";
+import {isMobile} from "../../util/functions";
export class Hint {
public timeId: number;
@@ -491,7 +492,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
}
return;
}
- insertHTML(protyle.lute.SpinBlockDOM(value), protyle);
+ insertHTML(protyle.lute.SpinBlockDOM(value), protyle, false, isMobile());
blockRender(protyle, protyle.wysiwyg.element);
return;
} else if (this.splitChar === "/" || this.splitChar === "、") {
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index 2a91074ede..4561fc37fb 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -8,11 +8,13 @@ import {Constants} from "../../constants";
import {highlightRender} from "../markdown/highlightRender";
import {scrollCenter} from "../../util/highlightById";
-export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) => {
+export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
+ // 移动端插入嵌入块时,获取到的 range 为旧值
+ useProtyleRange = false) => {
if (html === "") {
return;
}
- const range = getEditorRange(protyle.wysiwyg.element);
+ const range = useProtyleRange ? protyle.toolbar.range : getEditorRange(protyle.wysiwyg.element);
fixTableRange(range);
if (hasClosestByAttribute(range.startContainer, "data-type", "NodeTable") && !isBlock) {
html = protyle.lute.BlockDOM2InlineBlockDOM(html);