mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 17:30:52 +08:00
This commit is contained in:
parent
3348fd5f47
commit
c2d17ec929
@ -84,7 +84,7 @@ export const getPlainText = (blockElement: HTMLElement, isNested = false) => {
|
||||
text += Lute.UnEscapeHTMLStr(blockElement.getAttribute("data-content"));
|
||||
} else if (["NodeHeading", "NodeParagraph", "NodeCodeBlock"].includes(dataType)) {
|
||||
text += blockElement.querySelector("[spellcheck]").textContent;
|
||||
} else if (dataType ==="NodeTable") {
|
||||
} else if (dataType === "NodeTable") {
|
||||
blockElement.querySelectorAll("th, td").forEach((item) => {
|
||||
text += item.textContent.trim() + "\t";
|
||||
if (!item.nextElementSibling) {
|
||||
@ -178,7 +178,7 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
|
||||
/// #endif
|
||||
if (localFiles.length === 0) {
|
||||
// Inline-level elements support pasted as plain text https://github.com/siyuan-note/siyuan/issues/8010
|
||||
navigator.clipboard.readText().then(textPlain => {
|
||||
let textPlain = await readText();
|
||||
if (getSelection().rangeCount > 0) {
|
||||
const range = getSelection().getRangeAt(0);
|
||||
if (hasClosestByAttribute(range.startContainer, "data-type", "code") || hasClosestByClassName(range.startContainer, "hljs")) {
|
||||
@ -211,7 +211,6 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
|
||||
// insertHTML 会进行内部反转义
|
||||
insertHTML(content, protyle, false, false, true);
|
||||
filterClipboardHint(protyle, textPlain);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user