mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-20 23:36:10 +01:00
⚡ Improve pasting performance for large amounts of content https://github.com/siyuan-note/siyuan/issues/15306
This commit is contained in:
parent
9d392bd663
commit
7c692e8273
4 changed files with 362 additions and 187 deletions
|
|
@ -4,10 +4,12 @@ import {transaction, updateTransaction} from "../wysiwyg/transaction";
|
|||
import {getContenteditableElement} from "../wysiwyg/getBlock";
|
||||
import {
|
||||
fixTableRange,
|
||||
focusBlock, focusByRange,
|
||||
focusBlock,
|
||||
focusByRange,
|
||||
focusByWbr,
|
||||
getEditorRange,
|
||||
getSelectionOffset, setLastNodeRange,
|
||||
getSelectionOffset,
|
||||
setLastNodeRange,
|
||||
} from "./selection";
|
||||
import {Constants} from "../../constants";
|
||||
import {highlightRender} from "../render/highlightRender";
|
||||
|
|
@ -257,7 +259,9 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
// 移动端插入嵌入块时,获取到的 range 为旧值
|
||||
useProtyleRange = false,
|
||||
// 在开头粘贴块则插入上方
|
||||
insertByCursor = false) => {
|
||||
insertByCursor = false,
|
||||
// 是否需要再次 spin
|
||||
spin = true) => {
|
||||
if (html === "") {
|
||||
return;
|
||||
}
|
||||
|
|
@ -364,7 +368,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
}
|
||||
|
||||
let innerHTML = unSpinHTML || // 在 table 中插入需要使用转换好的行内元素 https://github.com/siyuan-note/siyuan/issues/9358
|
||||
protyle.lute.SpinBlockDOM(html) || // 需要再 spin 一次 https://github.com/siyuan-note/siyuan/issues/7118
|
||||
(spin && protyle.lute.SpinBlockDOM(html)) || // 需要再 spin 一次 https://github.com/siyuan-note/siyuan/issues/7118
|
||||
html; // 空格会被 Spin 不再,需要使用原文
|
||||
// 粘贴纯文本时会进行内部转义,这里需要进行反转义 https://github.com/siyuan-note/siyuan/issues/10620
|
||||
innerHTML = innerHTML.replace(/;;;lt;;;/g, "<").replace(/;;;gt;;;/g, ">");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue