mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post-menu): await clipboard copy before closing menu
This commit is contained in:
@@ -21,9 +21,14 @@ const CopyLinkButton = ({ cid, subplebbitAddress, linkType, onClose }: { cid?: s
|
|||||||
const boardIdentifier = getBoardPath(subplebbitAddress, defaultSubplebbits);
|
const boardIdentifier = getBoardPath(subplebbitAddress, defaultSubplebbits);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
copyShareLinkToClipboard(boardIdentifier, linkType, cid);
|
try {
|
||||||
onClose();
|
await copyShareLinkToClipboard(boardIdentifier, linkType, cid);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to copy share link', error);
|
||||||
|
} finally {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.postMenuItem}>{t('copy_link')}</div>
|
<div className={styles.postMenuItem}>{t('copy_link')}</div>
|
||||||
@@ -35,9 +40,14 @@ const CopyContentIdButton = ({ cid, onClose }: { cid: string; onClose: () => voi
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
copyToClipboard(cid);
|
try {
|
||||||
onClose();
|
await copyToClipboard(cid);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to copy content id', error);
|
||||||
|
} finally {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.postMenuItem}>{t('copy_content_id')}</div>
|
<div className={styles.postMenuItem}>{t('copy_content_id')}</div>
|
||||||
|
|||||||
@@ -29,9 +29,14 @@ const CopyLinkButton = ({ cid, subplebbitAddress, linkType, onClose }: { cid?: s
|
|||||||
const boardIdentifier = getBoardPath(subplebbitAddress, defaultSubplebbits);
|
const boardIdentifier = getBoardPath(subplebbitAddress, defaultSubplebbits);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
copyShareLinkToClipboard(boardIdentifier, linkType, cid);
|
try {
|
||||||
onClose();
|
await copyShareLinkToClipboard(boardIdentifier, linkType, cid);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to copy share link', error);
|
||||||
|
} finally {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.postMenuItem}>{t('copy_link')}</div>
|
<div className={styles.postMenuItem}>{t('copy_link')}</div>
|
||||||
@@ -43,9 +48,14 @@ const CopyContentIdButton = ({ cid, onClose }: { cid: string; onClose: () => voi
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
copyToClipboard(cid);
|
try {
|
||||||
onClose();
|
await copyToClipboard(cid);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to copy content id', error);
|
||||||
|
} finally {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.postMenuItem}>{t('copy_content_id')}</div>
|
<div className={styles.postMenuItem}>{t('copy_content_id')}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user