1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-04 19:16:07 +02:00

Electron: Resolves #298: Removed extraneous first characters from auto-title

This commit is contained in:
Laurent Cozic 2018-03-14 17:37:47 +00:00
parent 694672859a
commit 26331f61e1

View File

@ -81,7 +81,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');