chat: restore 'copied' notice on copy

Fixes #3326.
This commit is contained in:
Matilde Park 2020-08-18 18:39:43 -04:00
parent f769c89c3c
commit 65b3812191

View File

@ -60,6 +60,15 @@ const renderWithSigil = (props, timestamp) => {
name = cite(props.msg.author);
}
let nameSpan = null;
const copyNotice = (saveName) => {
nameSpan.innerText = 'Copied';
setTimeout(() => {
nameSpan.innerText = saveName;
}, 800);
};
return (
<div className="flex w-100">
<OverlaySigil
@ -80,8 +89,11 @@ const renderWithSigil = (props, timestamp) => {
'mw5 db truncate pointer ' +
(contact.nickname ? '' : 'mono')
}
ref={(e) => nameSpan = e}
onClick={() => {
const saveName = name;
writeText(props.msg.author);
copyNotice(saveName);
}}
title={`~${props.msg.author}`}
>