1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Various improvements

This commit is contained in:
Laurent Cozic
2017-08-21 22:46:31 +02:00
parent 1da06734f1
commit 67b812cab0
8 changed files with 155 additions and 25 deletions

View File

@@ -41,6 +41,17 @@ class Note extends BaseItem {
return super.serialize(note, 'note', fieldNames);
}
static defaultTitle(note) {
if (note.title && note.title.length) return note.title;
if (note.body && note.body.length) {
const lines = note.body.trim().split("\n");
return lines[0].trim().substr(0, 80).trim();
}
return _('Untitled');
}
static geolocationUrl(note) {
if (!('latitude' in note) || !('longitude' in note)) throw new Error('Latitude or longitude is missing');
if (!Number(note.latitude) && !Number(note.longitude)) throw new Error(_('This note does not have geolocation information.'));