Skip to content

Commit cffec4b

Browse files
committedJan 14, 2025
🎨 #13735
1 parent 1a12ba9 commit cffec4b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎app/src/protyle/wysiwyg/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,10 @@ export class WYSIWYG {
383383
this.emojiToMd(tempElement);
384384
}
385385
html = tempElement.innerHTML;
386+
textPlain = range.toString();
386387
} else if (selectImgElement) {
387388
html = selectImgElement.outerHTML;
389+
textPlain = selectImgElement.querySelector("img").getAttribute("data-src");
388390
} else if (selectTypes.length > 0 && range.startContainer.nodeType === 3 && range.startContainer.parentElement.tagName === "SPAN" &&
389391
range.startContainer.parentElement.isSameNode(range.endContainer.parentElement)) {
390392
// 复制粗体等字体中的一部分
@@ -400,6 +402,7 @@ export class WYSIWYG {
400402
}
401403
spanElement.textContent = range.toString();
402404
html = spanElement.outerHTML;
405+
textPlain = range.toString();
403406
} else {
404407
tempElement.append(range.cloneContents());
405408
this.emojiToMd(tempElement);
@@ -415,6 +418,8 @@ export class WYSIWYG {
415418
textPlain = tempElement.textContent.replace(Constants.ZWSP, "").replace(/\n$/, "");
416419
} else if (hasClosestByMatchTag(range.startContainer, "CODE")) {
417420
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
421+
} else {
422+
textPlain = range.toString();
418423
}
419424
}
420425
}

0 commit comments

Comments
 (0)
Please sign in to comment.