mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-09 22:22:34 +01:00
This commit is contained in:
parent
10690ba3f7
commit
c8a0314d74
3 changed files with 22 additions and 19 deletions
|
|
@ -100,7 +100,7 @@ export const getPlainText = (blockElement: HTMLElement, isNested = false) => {
|
|||
|
||||
export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
|
||||
try {
|
||||
let clipText = await readText();
|
||||
let clipText = await readText() || "";
|
||||
// 删掉 <span data-type\="text".*>text</span> 标签,只保留文本
|
||||
clipText = clipText.replace(/<span data-type="text".*?>(.*?)<\/span>/g, "$1");
|
||||
|
||||
|
|
@ -150,7 +150,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
|
||||
let textPlain = await readText();
|
||||
let textPlain = await readText() || "";
|
||||
if (getSelection().rangeCount > 0) {
|
||||
const range = getSelection().getRangeAt(0);
|
||||
if (hasClosestByAttribute(range.startContainer, "data-type", "code") || hasClosestByClassName(range.startContainer, "hljs")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue