mirror of
https://github.com/usememos/memos.git
synced 2025-01-31 17:48:12 +08:00
chore: add memo uid
This commit is contained in:
parent
ddcf1d669d
commit
777ed899a3
2 changed files with 14 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { Divider } from "@mui/joy";
|
||||||
import { BaseProps } from "./types";
|
import { BaseProps } from "./types";
|
||||||
|
|
||||||
interface Props extends BaseProps {
|
interface Props extends BaseProps {
|
||||||
|
@ -5,7 +6,7 @@ interface Props extends BaseProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const HorizontalRule: React.FC<Props> = () => {
|
const HorizontalRule: React.FC<Props> = () => {
|
||||||
return <hr />;
|
return <Divider className="!my-3" />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default HorizontalRule;
|
export default HorizontalRule;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Divider, Tooltip } from "@mui/joy";
|
import { Divider, Tooltip } from "@mui/joy";
|
||||||
|
import copy from "copy-to-clipboard";
|
||||||
import { memo, useEffect, useRef, useState } from "react";
|
import { memo, useEffect, useRef, useState } from "react";
|
||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
@ -148,6 +149,11 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCopyMemoId = () => {
|
||||||
|
copy(String(memo.id));
|
||||||
|
toast.success("Copied to clipboard!");
|
||||||
|
};
|
||||||
|
|
||||||
const handleMemoContentClick = async (e: React.MouseEvent) => {
|
const handleMemoContentClick = async (e: React.MouseEvent) => {
|
||||||
const targetEl = e.target as HTMLElement;
|
const targetEl = e.target as HTMLElement;
|
||||||
|
|
||||||
|
@ -245,6 +251,12 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
||||||
<Icon.Trash className="w-4 h-auto mr-2" />
|
<Icon.Trash className="w-4 h-auto mr-2" />
|
||||||
{t("common.delete")}
|
{t("common.delete")}
|
||||||
</span>
|
</span>
|
||||||
|
<Divider className="!my-1" />
|
||||||
|
<div className="w-full px-3 text-xs text-gray-400">
|
||||||
|
<span className="cursor-pointer" onClick={handleCopyMemoId}>
|
||||||
|
ID: <span className="font-mono">{memo.id}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue