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

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