Add ellipsis to auto-generated titles with >4 words and truncate titles >120 chars
This commit is contained in:
@@ -613,6 +613,15 @@
|
|||||||
const words = noteText.split(/\s+/).filter(w => w.length > 0);
|
const words = noteText.split(/\s+/).filter(w => w.length > 0);
|
||||||
const firstFour = words.slice(0, 4).join(' ');
|
const firstFour = words.slice(0, 4).join(' ');
|
||||||
noteTitle = 'Untitled: ' + (firstFour || 'note');
|
noteTitle = 'Untitled: ' + (firstFour || 'note');
|
||||||
|
// Add ellipsis if note has more than 4 words
|
||||||
|
if (words.length > 4) {
|
||||||
|
noteTitle += '...';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Truncate title if it exceeds 120 characters
|
||||||
|
if (noteTitle.length > 120) {
|
||||||
|
noteTitle = noteTitle.substring(0, 120) + '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user