1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Various changes

This commit is contained in:
Laurent Cozic
2017-09-10 17:57:06 +01:00
parent 7aaf4fb491
commit 8e54404d28
7 changed files with 102 additions and 12 deletions

View File

@@ -269,7 +269,10 @@ class NoteScreenComponent extends BaseScreenComponent {
return new Promise((resolve, reject) => {
DocumentPicker.show({ filetype: [DocumentPickerUtil.images()] }, (error,res) => {
if (error) {
reject(error);
// Also returns an error if the user doesn't pick a file
// so just resolve with null.
console.info('pickDocument error:', error);
resolve(null);
return;
}
@@ -288,6 +291,7 @@ class NoteScreenComponent extends BaseScreenComponent {
async attachFile_onPress() {
const res = await this.pickDocument();
if (!res) return;
const localFilePath = res.uri;
@@ -368,14 +372,23 @@ class NoteScreenComponent extends BaseScreenComponent {
menuOptions() {
const note = this.state.note;
const isTodo = note && !!note.is_todo;
return [
{ title: _('Attach file'), onPress: () => { this.attachFile_onPress(); } },
{ title: _('Delete note'), onPress: () => { this.deleteNote_onPress(); } },
{ title: note && !!note.is_todo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } },
{ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } },
{ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } },
];
let output = [];
output.push({ title: _('Attach file'), onPress: () => { this.attachFile_onPress(); } });
output.push({ title: _('Delete note'), onPress: () => { this.deleteNote_onPress(); } });
// if (isTodo) {
// let text = note.todo_due ? _('Edit/Clear alarm') : _('Set an alarm');
// output.push({ title: text, onPress: () => { this.setAlarm_onPress(); } });
// }
output.push({ title: isTodo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } });
output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
output.push({ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } });
return output;
}
async todoCheckbox_change(checked) {