This commit is contained in:
Vanessa 2022-08-18 12:32:49 +08:00
parent 4c53bd294e
commit 4af21d1756

View file

@ -100,16 +100,14 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
textHTML = "";
}
// process word
const doc = new DOMParser().parseFromString(textHTML, "text/html");
let wordHTML = "";
if (doc.body) {
wordHTML = doc.body.innerHTML;
}
// 复制空格的时候不能让其转换为空
if (wordHTML !== Constants.ZWSP) {
textHTML = wordHTML;
if (!textHTML.endsWith(Constants.ZWSP) && !textHTML.startsWith(Constants.ZWSP)) {
// process word
const doc = new DOMParser().parseFromString(textHTML, "text/html");
if (doc.body && doc.body.innerHTML) {
textHTML = doc.body.innerHTML;
}
}
textHTML = Lute.Sanitize(textHTML);
const nodeElement = hasClosestBlock(event.target);