Vanessa 2023-04-17 17:51:45 +08:00
parent 648d00e587
commit c8177c262e
4 changed files with 12 additions and 8 deletions

View file

@ -32,8 +32,8 @@ const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
};
export const pasteAsPlainText = async (protyle: IProtyle) => {
/// #if !BROWSER
let localFiles: string[] = [];
/// #if !BROWSER
if ("darwin" === window.siyuan.config.system.os) {
const xmlString = clipboard.read("NSFilenamesPboardType");
const domParser = new DOMParser();
@ -50,10 +50,15 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
if (localFiles.length > 0) {
uploadLocalFiles(localFiles, protyle, false);
writeText("");
} else {
getCurrentWindow().webContents.pasteAndMatchStyle();
}
/// #endif
if (localFiles.length === 0) {
getCurrentWindow().webContents.pasteAndMatchStyle();
// 下个版本再进行修改 https://github.com/siyuan-note/siyuan/issues/8010
// navigator.clipboard.readText().then(async textPlain => {
// insertHTML(protyle.lute.BlockDOM2Content(protyle.lute.Md2BlockDOM(textPlain)), protyle);
// });
}
};
export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {