1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Merge branch 'master' into resource_cleanup

This commit is contained in:
Laurent Cozic
2018-03-14 17:41:06 +00:00
46 changed files with 624 additions and 517 deletions

View File

@ -82,7 +82,17 @@ class Note extends BaseItem {
static defaultTitle(note) {
if (note.body && note.body.length) {
const lines = note.body.trim().split("\n");
return lines[0].trim().substr(0, 80).trim();
let output = lines[0].trim();
// Remove the first #, *, etc.
while (output.length) {
const c = output[0];
if (['#', ' ', "\n", "\t", '*', '`', '-'].indexOf(c) >= 0) {
output = output.substr(1);
} else {
break;
}
}
return output.substr(0, 80).trim();
}
return _('Untitled');