mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
small improvements to text preview in file notes
This commit is contained in:
parent
8561201abc
commit
224fbdc8cd
@ -121,7 +121,7 @@ export default class FileTypeWidget extends TypeWidget {
|
|||||||
this.$pdfPreview.attr('src', '').empty().hide();
|
this.$pdfPreview.attr('src', '').empty().hide();
|
||||||
|
|
||||||
if (noteComplement.content) {
|
if (noteComplement.content) {
|
||||||
this.$previewContent.show();
|
this.$previewContent.show().scrollTop(0);
|
||||||
this.$previewContent.text(noteComplement.content);
|
this.$previewContent.text(noteComplement.content);
|
||||||
}
|
}
|
||||||
else if (note.mime === 'application/pdf' && utils.isElectron()) {
|
else if (note.mime === 'application/pdf' && utils.isElectron()) {
|
||||||
|
@ -17,8 +17,9 @@ async function getNote(req) {
|
|||||||
if (note.isStringNote()) {
|
if (note.isStringNote()) {
|
||||||
note.content = await note.getContent();
|
note.content = await note.getContent();
|
||||||
|
|
||||||
if (note.type === 'file') {
|
if (note.type === 'file' && note.content.length > 10000) {
|
||||||
note.content = note.content.substr(0, 10000);
|
note.content = note.content.substr(0, 10000)
|
||||||
|
+ `\r\n\r\n... and ${note.content.length - 10000} more characters.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,11 @@ function getContentDisposition(filename) {
|
|||||||
return `file; filename="${sanitizedFilename}"; filename*=UTF-8''${sanitizedFilename}`;
|
return `file; filename="${sanitizedFilename}"; filename*=UTF-8''${sanitizedFilename}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const STRING_MIME_TYPES = ["application/x-javascript", "image/svg+xml"];
|
const STRING_MIME_TYPES = [
|
||||||
|
"application/javascript",
|
||||||
|
"application/x-javascript",
|
||||||
|
"image/svg+xml"
|
||||||
|
];
|
||||||
|
|
||||||
function isStringNote(type, mime) {
|
function isStringNote(type, mime) {
|
||||||
return ["text", "code", "relation-map", "search"].includes(type)
|
return ["text", "code", "relation-map", "search"].includes(type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user