mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
⚡ Improve pasting performance for large amounts of content https://github.com/siyuan-note/siyuan/issues/15306
This commit is contained in:
parent
7c692e8273
commit
d555eec852
2 changed files with 2 additions and 5 deletions
|
|
@ -259,9 +259,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
// 移动端插入嵌入块时,获取到的 range 为旧值
|
||||
useProtyleRange = false,
|
||||
// 在开头粘贴块则插入上方
|
||||
insertByCursor = false,
|
||||
// 是否需要再次 spin
|
||||
spin = true) => {
|
||||
insertByCursor = false) => {
|
||||
if (html === "") {
|
||||
return;
|
||||
}
|
||||
|
|
@ -368,7 +366,6 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
}
|
||||
|
||||
let innerHTML = unSpinHTML || // 在 table 中插入需要使用转换好的行内元素 https://github.com/siyuan-note/siyuan/issues/9358
|
||||
(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, ">");
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
textPlain = textPlain.replace(/\u200D```/g, "```");
|
||||
|
||||
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
|
||||
insertHTML(textPlainDom, protyle, false, false, true, false /* 不再次 spin 以提升性能 https://github.com/siyuan-note/siyuan/issues/15306 */);
|
||||
insertHTML(textPlainDom, protyle, false, false, true);
|
||||
}
|
||||
blockRender(protyle, protyle.wysiwyg.element);
|
||||
processRender(protyle.wysiwyg.element);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue