refactor: return jsx element instead of string in marked (#910)

* refactor: return jsx element instead of string in marked

* chore: update
This commit is contained in:
boojack
2023-01-07 00:13:49 +08:00
committed by GitHub
parent 491859bbf6
commit 0f8ce3dd16
42 changed files with 417 additions and 637 deletions

View File

@ -15,7 +15,6 @@ import "../less/memo.less";
interface Props {
memo: Memo;
highlightWord?: string;
}
export const getFormatedMemoTimeStr = (time: number, locale = "en"): string => {
@ -27,7 +26,7 @@ export const getFormatedMemoTimeStr = (time: number, locale = "en"): string => {
};
const Memo: React.FC<Props> = (props: Props) => {
const { memo, highlightWord } = props;
const { memo } = props;
const { t, i18n } = useTranslation();
const navigate = useNavigate();
const editorStore = useEditorStore();
@ -143,9 +142,6 @@ 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"));
}
};
@ -228,7 +224,6 @@ const Memo: React.FC<Props> = (props: Props) => {
</div>
<MemoContent
content={memo.content}
highlightWord={highlightWord}
onMemoContentClick={handleMemoContentClick}
onMemoContentDoubleClick={handleMemoContentDoubleClick}
/>