small improvements to text preview in file notes

This commit is contained in:
zadam
2020-08-04 22:06:25 +02:00
parent 8561201abc
commit 224fbdc8cd
3 changed files with 9 additions and 4 deletions

View File

@@ -17,8 +17,9 @@ async function getNote(req) {
if (note.isStringNote()) {
note.content = await note.getContent();
if (note.type === 'file') {
note.content = note.content.substr(0, 10000);
if (note.type === 'file' && note.content.length > 10000) {
note.content = note.content.substr(0, 10000)
+ `\r\n\r\n... and ${note.content.length - 10000} more characters.`;
}
}