This commit is contained in:
Vanessa 2023-03-08 23:18:21 +08:00
parent 9e4eac1255
commit 51b151c85a
3 changed files with 10 additions and 3 deletions

View file

@ -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) {

View file

@ -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 === "、") {

View file

@ -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);