This commit is contained in:
Vanessa 2022-07-08 10:38:11 +08:00
parent d7b983b36c
commit b8444f7aca
5 changed files with 18 additions and 18 deletions

View file

@ -21,11 +21,11 @@ const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
needRender = false;
return true;
}
})
});
if (needRender) {
protyle.hint.render(protyle);
}
}
};
export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {
const range = getEditorRange(protyle.wysiwyg.element);
@ -59,7 +59,7 @@ export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Ele
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);
highlightRender(protyle.wysiwyg.element);
filterClipboardHint(protyle, textPlain)
filterClipboardHint(protyle, textPlain);
scrollCenter(protyle);
};
@ -199,7 +199,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
// 转换为 md避免再次粘贴 ID 重复
const tempMd = protyle.lute.BlockDOM2StdMd(tempElement.innerHTML);
writeText(tempMd);
filterClipboardHint(protyle, tempMd)
filterClipboardHint(protyle, tempMd);
} else if (textHTML.endsWith(Constants.ZWSP)) {
// 编辑器内部粘贴
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1);
@ -213,7 +213,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
});
const tempInnerHTML = tempElement.innerHTML;
insertHTML(tempInnerHTML, protyle);
filterClipboardHint(protyle, tempInnerHTML)
filterClipboardHint(protyle, tempInnerHTML);
} else {
tempElement.innerHTML = textHTML;
tempElement.querySelectorAll("[style]").forEach((e) => {
@ -239,7 +239,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);
highlightRender(protyle.wysiwyg.element);
filterClipboardHint(protyle, response.data)
filterClipboardHint(protyle, response.data);
scrollCenter(protyle);
});
return;
@ -258,7 +258,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
}
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
insertHTML(textPlainDom, protyle);
filterClipboardHint(protyle, textPlainDom)
filterClipboardHint(protyle, textPlainDom);
}
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);