This commit is contained in:
parent
5d6c71e35a
commit
9532a3eab6
1 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
|
||||
import * as dayjs from "dayjs";
|
||||
import {transaction, updateTransaction} from "../wysiwyg/transaction";
|
||||
import {getContenteditableElement} from "../wysiwyg/getBlock";
|
||||
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||
import {fixTableRange, focusBlock, focusByWbr, getEditorRange} from "./selection";
|
||||
import {mathRender} from "../render/mathRender";
|
||||
import {Constants} from "../../constants";
|
||||
|
@ -150,6 +150,15 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
editableElement.innerHTML = replaceInnerHTML;
|
||||
}
|
||||
}
|
||||
const editWbrElement = editableElement.querySelector("wbr")
|
||||
if (editWbrElement && editableElement && !trimStartText.endsWith("\n")) {
|
||||
// 数学公式后无换行,后期渲染后添加导致 rang 错误,中文输入错误 https://github.com/siyuan-note/siyuan/issues/9054
|
||||
const previousElement = hasPreviousSibling(editWbrElement) as HTMLElement
|
||||
if (previousElement && previousElement.nodeType !== 3 && previousElement.dataset.type.indexOf("inline-math") > -1 &&
|
||||
!hasNextSibling(editWbrElement)) {
|
||||
editWbrElement.insertAdjacentText("afterend", "\n");
|
||||
}
|
||||
}
|
||||
mathRender(blockElement);
|
||||
updateTransaction(protyle, id, blockElement.outerHTML, oldHTML);
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
|
|
Loading…
Add table
Reference in a new issue