mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
core: set default title if note has no title
This commit is contained in:
@@ -102,8 +102,16 @@ export class Notes implements ICollection {
|
||||
}
|
||||
|
||||
if (item.title) {
|
||||
item.title = this.getNoteTitle(item.title, headline);
|
||||
item.title = item.title.replace(NEWLINE_STRIP_REGEX, " ");
|
||||
dateEdited = Date.now();
|
||||
} else if (!isUpdating) {
|
||||
item.title = formatTitle(
|
||||
this.db.settings.getTitleFormat(),
|
||||
this.db.settings.getDateFormat(),
|
||||
this.db.settings.getTimeFormat(),
|
||||
headline.split(" ").splice(0, 10).join(" "),
|
||||
this.totalNotes
|
||||
);
|
||||
}
|
||||
|
||||
if (isUpdating) {
|
||||
@@ -390,20 +398,6 @@ export class Notes implements ICollection {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getNoteTitle(title: string, headline?: string) {
|
||||
if (title.trim().length > 0) {
|
||||
return title.replace(NEWLINE_STRIP_REGEX, " ");
|
||||
}
|
||||
|
||||
return formatTitle(
|
||||
this.db.settings.getTitleFormat(),
|
||||
this.db.settings.getDateFormat(),
|
||||
this.db.settings.getTimeFormat(),
|
||||
headline?.split(" ").splice(0, 10).join(" "),
|
||||
this.totalNotes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getNoteHeadline(content: Tiptap) {
|
||||
|
||||
Reference in New Issue
Block a user