Compare commits

...

2 Commits

Author SHA1 Message Date
Fabian
32094f3a79 Version Bump 2019-06-03 18:20:57 +02:00
Fabian
d46223c96a Adding Copy function 2019-06-03 18:20:35 +02:00
2 changed files with 15 additions and 2 deletions

View File

@ -65,7 +65,7 @@ export class Footer extends Component<{}, { synced: boolean, syncing: boolean }>
Welcome <b>{Notes.name}</b> Welcome <b>{Notes.name}</b>
</span> </span>
<span style="color: lightgrey;"> <span style="color: lightgrey;">
v1.2 v1.3
</span> </span>
</footer> </footer>
} }

View File

@ -84,7 +84,7 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
} }
const deleteNote = async () => { const deleteNote = async () => {
Notes.delete(note._id).then(() => { this.vault.deleteNote(note._id).then(() => {
Notifications.sendSuccess("Deleted") Notifications.sendSuccess("Deleted")
this.rawNotes = this.rawNotes.filter(e => e._id !== note._id); this.rawNotes = this.rawNotes.filter(e => e._id !== note._id);
this.setState({ notes: this.state.notes.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<IVault> }, { 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; let share;
if ((window.navigator as any).share) { if ((window.navigator as any).share) {
share = <button class="uk-button" onClick={shareNote}> share = <button class="uk-button" onClick={shareNote}>
@ -103,6 +115,7 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
let context = <ContextMenu event={evt} > let context = <ContextMenu event={evt} >
{share} {share}
<button class="uk-button" onClick={deleteNote}>delete</button> <button class="uk-button" onClick={deleteNote}>delete</button>
<button class="uk-button" onClick={copyNote}>copy</button>
</ContextMenu> </ContextMenu>
this.setState({ context }); this.setState({ context });