Vanessa 2025-03-28 12:35:54 +08:00
parent 356a29eb72
commit afead500fb

View File

@ -18,6 +18,7 @@ import {hideElements} from "../ui/hideElements";
import {Constants} from "../../constants"; import {Constants} from "../../constants";
import {scrollCenter} from "../../util/highlightById"; import {scrollCenter} from "../../util/highlightById";
import {isMobile} from "../../util/functions"; import {isMobile} from "../../util/functions";
import {mathRender} from "../render/mathRender";
export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Range, type: "Delete" | "Backspace" | "remove") => { export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Range, type: "Delete" | "Backspace" | "remove") => {
// 删除后,防止滚动条滚动后调用 get 请求,因为返回的请求已查找不到内容块了 // 删除后,防止滚动条滚动后调用 get 请求,因为返回的请求已查找不到内容块了
@ -409,6 +410,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
range.insertNode(leftNodes); range.insertNode(leftNodes);
// 图片前删除到上一个文字块时,图片前有 zwsp // 图片前删除到上一个文字块时,图片前有 zwsp
previousLastElement.outerHTML = protyle.lute.SpinBlockDOM(previousLastElement.outerHTML); previousLastElement.outerHTML = protyle.lute.SpinBlockDOM(previousLastElement.outerHTML);
mathRender(getPreviousBlock(removeElement) as HTMLElement);
removeElement.remove(); removeElement.remove();
// extractContents 内容过多时需要进行滚动条重置,否则位置会错位 // extractContents 内容过多时需要进行滚动条重置,否则位置会错位
protyle.contentElement.scrollTop = scroll; protyle.contentElement.scrollTop = scroll;