1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-03 08:35:29 +02:00

Mobile: Fixes #856: Add option to open source url (#872)

* Mobile: Fixes #856: Add option to open source url

* Mobile: Fixes #856: Change menu wording for opening source url
This commit is contained in:
ebayer 2018-10-12 21:30:00 +03:00 committed by Laurent Cozic
parent ffd03bf34c
commit 70e71cbc2a

View File

@ -463,6 +463,17 @@ class NoteScreenComponent extends BaseScreenComponent {
}
}
async showSource_onPress() {
if (!this.state.note.id) return;
let note = await Note.load(this.state.note.id);
try {
Linking.openURL(note.source_url);
} catch (error) {
await dialogs.error(this, error.message);
}
}
copyMarkdownLink_onPress() {
const note = this.state.note;
Clipboard.setString(Note.markdownTag(note));
@ -472,6 +483,7 @@ class NoteScreenComponent extends BaseScreenComponent {
const note = this.state.note;
const isTodo = note && !!note.is_todo;
const isSaved = note && note.id;
const hasSource = note && note.source_url;
let output = [];
@ -496,6 +508,7 @@ class NoteScreenComponent extends BaseScreenComponent {
output.push({ isDivider: true });
if (this.props.showAdvancedOptions) output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
output.push({ title: _('View on map'), onPress: () => { this.showOnMap_onPress(); } });
if (hasSource) output.push({ title: _('Go to source URL'), onPress: () => { this.showSource_onPress(); } });
output.push({ isDivider: true });
output.push({ title: _('Delete'), onPress: () => { this.deleteNote_onPress(); } });