From 65b38121915ac7eeb0e014f714309b2dcb6c77da Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 18 Aug 2020 18:39:43 -0400 Subject: [PATCH] chat: restore 'copied' notice on copy Fixes #3326. --- .../src/views/apps/chat/components/lib/message.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/interface/src/views/apps/chat/components/lib/message.js b/pkg/interface/src/views/apps/chat/components/lib/message.js index 461423db7..c47d3f2ab 100644 --- a/pkg/interface/src/views/apps/chat/components/lib/message.js +++ b/pkg/interface/src/views/apps/chat/components/lib/message.js @@ -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 (
{ '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}`} >