Vanessa 2025-09-06 18:31:38 +08:00
parent fc1cbf46aa
commit 4e4398ef47
3 changed files with 31 additions and 10 deletions

View file

@ -1,7 +1,7 @@
import {Constants} from "../../constants";
import {uploadFiles, uploadLocalFiles} from "../upload";
import {processPasteCode, processRender} from "./processCode";
import {getLocalFiles, readText} from "./compatibility";
import {getLocalFiles, getTextSiyuanFromTextHTML, readText} from "./compatibility";
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
import {getEditorRange} from "./selection";
import {blockRender} from "../render/blockRender";
@ -288,6 +288,12 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
if (textPlain.endsWith(Constants.ZWSP) && !textHTML && !siyuanHTML) {
siyuanHTML = textPlain.substr(0, textPlain.length - 1);
}
// 复制/剪切折叠标题需获取 siyuanHTML
if (textHTML && textPlain && !siyuanHTML) {
const textObj = getTextSiyuanFromTextHTML(textHTML);
siyuanHTML = textObj.textSiyuan;
textHTML = textObj.textHtml;
}
// 剪切复制中首位包含空格或仅有空格 https://github.com/siyuan-note/siyuan/issues/5667
if (!siyuanHTML) {
// process word