mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-20 14:04:06 +01:00
This commit is contained in:
parent
4244c18779
commit
7823357e1c
2 changed files with 11 additions and 28 deletions
|
|
@ -142,19 +142,6 @@ export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
};
|
||||
|
||||
const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
|
||||
let needRender = true;
|
||||
protyle.options.hint.extend.find(item => {
|
||||
if (item.key === textPlain) {
|
||||
needRender = false;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (needRender) {
|
||||
protyle.hint.render(protyle);
|
||||
}
|
||||
};
|
||||
|
||||
export const pasteAsPlainText = async (protyle: IProtyle) => {
|
||||
let localFiles: string[] = [];
|
||||
/// #if !BROWSER
|
||||
|
|
@ -210,7 +197,6 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
|
|||
|
||||
// insertHTML 会进行内部反转义
|
||||
insertHTML(content, protyle, false, false, true);
|
||||
filterClipboardHint(protyle, textPlain);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -266,6 +252,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
}) & {
|
||||
target: HTMLElement
|
||||
}) => {
|
||||
protyle.hint.enableExtend = false;
|
||||
if ("clipboardData" in event || "dataTransfer" in event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
@ -383,7 +370,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
}
|
||||
return;
|
||||
}
|
||||
hideElements(["select"], protyle);
|
||||
hideElements(["select", "hint"], protyle);
|
||||
protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl").forEach(item => {
|
||||
item.classList.remove("protyle-wysiwyg--hl");
|
||||
});
|
||||
|
|
@ -476,7 +463,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
|
||||
insertHTML(tempInnerHTML, protyle, isBlock, false, true);
|
||||
}
|
||||
filterClipboardHint(protyle, protyle.lute.BlockDOM2StdMd(tempInnerHTML));
|
||||
blockRender(protyle, protyle.wysiwyg.element);
|
||||
processRender(protyle.wysiwyg.element);
|
||||
highlightRender(protyle.wysiwyg.element);
|
||||
|
|
@ -569,7 +555,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
processRender(protyle.wysiwyg.element);
|
||||
highlightRender(protyle.wysiwyg.element);
|
||||
avRender(protyle.wysiwyg.element, protyle);
|
||||
filterClipboardHint(protyle, response.data);
|
||||
scrollCenter(protyle, undefined, false, "smooth");
|
||||
});
|
||||
return;
|
||||
|
|
@ -610,7 +595,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
|
||||
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
|
||||
insertHTML(textPlainDom, protyle, false, false, true);
|
||||
filterClipboardHint(protyle, textPlain);
|
||||
}
|
||||
blockRender(protyle, protyle.wysiwyg.element);
|
||||
processRender(protyle.wysiwyg.element);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue