From d46223c96a10463d9fe27848f161a330a35ccfb3 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 3 Jun 2019 18:20:35 +0200 Subject: [PATCH] Adding Copy function --- src/components/routes/vault/EntryList.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/routes/vault/EntryList.tsx b/src/components/routes/vault/EntryList.tsx index 98c66ba..ce45264 100755 --- a/src/components/routes/vault/EntryList.tsx +++ b/src/components/routes/vault/EntryList.tsx @@ -84,7 +84,7 @@ export default class EntryList extends Component<{ vault: Promise }, { n } const deleteNote = async () => { - Notes.delete(note._id).then(() => { + this.vault.deleteNote(note._id).then(() => { Notifications.sendSuccess("Deleted") this.rawNotes = this.rawNotes.filter(e => e._id !== note._id); this.setState({ notes: this.state.notes.filter(e => e._id !== note._id) }); @@ -93,6 +93,18 @@ export default class EntryList extends Component<{ vault: Promise }, { n }) } + const copyNote = async () => { + this.vault.getNote(note._id).then(note => { + const el = document.createElement('textarea'); + el.value = note.__value; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + Notifications.sendSuccess("Copied"); + }) + } + let share; if ((window.navigator as any).share) { share = + this.setState({ context });