feat: support code copy (#901)

* feat: support code copy

* update
This commit is contained in:
Zeng1998
2023-01-03 23:05:00 +08:00
committed by GitHub
parent 62f53888ba
commit 92a8a4ac0c
6 changed files with 19 additions and 4 deletions

View File

@ -143,6 +143,9 @@ const Memo: React.FC<Props> = (props: Props) => {
if (imgUrl) {
showPreviewImageDialog([imgUrl], 0);
}
} else if (targetEl.tagName === "BUTTON" && targetEl.className === "codeblock-copy-btn") {
copy(targetEl.parentElement?.children[1].textContent ?? "");
toastHelper.success(t("message.succeed-copy-code"));
}
};