Making Share Target functional

This commit is contained in:
Fabian
2019-06-03 16:51:11 +02:00
parent 7917a628ef
commit 31d9f99b77
13 changed files with 114 additions and 88 deletions

View File

@ -74,17 +74,30 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
}
}
const deleteNote = async () => {
Notes.delete(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) });
}).catch(err => {
Notifications.sendError(err);
})
}
let share;
if ((window.navigator as any).share) {
share = <button class="uk-button" onClick={() => shareNote()}>
share = <button class="uk-button" onClick={shareNote}>
share
</button>
let context = <ContextMenu event={evt} >
{share}
</ContextMenu>
this.setState({ context });
}
let context = <ContextMenu event={evt} >
{share}
<button class="uk-button" onClick={deleteNote}>delete</button>
</ContextMenu>
this.setState({ context });
return false;
}