mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge remote-tracking branch 'origin/stable'
# Conflicts: # src/public/app/dialogs/options/other.js
This commit is contained in:
commit
2ff6e50af4
@ -84,7 +84,7 @@ class Branch extends AbstractEntity {
|
|||||||
/** @returns {Note} */
|
/** @returns {Note} */
|
||||||
get childNote() {
|
get childNote() {
|
||||||
if (!(this.noteId in this.becca.notes)) {
|
if (!(this.noteId in this.becca.notes)) {
|
||||||
// entities can come out of order in sync, create skeleton which will be filled later
|
// entities can come out of order in sync/import, create skeleton which will be filled later
|
||||||
this.becca.addNote(this.noteId, new Note({noteId: this.noteId}));
|
this.becca.addNote(this.noteId, new Note({noteId: this.noteId}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class Branch extends AbstractEntity {
|
|||||||
/** @returns {Note} */
|
/** @returns {Note} */
|
||||||
get parentNote() {
|
get parentNote() {
|
||||||
if (!(this.parentNoteId in this.becca.notes)) {
|
if (!(this.parentNoteId in this.becca.notes)) {
|
||||||
// entities can come out of order in sync, create skeleton which will be filled later
|
// entities can come out of order in sync/import, create skeleton which will be filled later
|
||||||
this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId}));
|
this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ const TPL = `
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="image-jpeg-quality">JPEG quality (0 - worst quality, 100 best quality, 50 - 85 is recommended)</label>
|
<label for="image-jpeg-quality">JPEG quality (10 - worst quality, 100 best quality, 50 - 85 is recommended)</label>
|
||||||
<input class="form-control" id="image-jpeg-quality" min="0" max="100" type="number">
|
<input class="form-control" id="image-jpeg-quality" min="10" max="100" type="number">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +44,10 @@ export default class ButtonWidget extends NoteContextAwareWidget {
|
|||||||
this.$widget.tooltip({
|
this.$widget.tooltip({
|
||||||
html: true,
|
html: true,
|
||||||
title: () => {
|
title: () => {
|
||||||
const title = this.settings.title;
|
const title = typeof this.settings.title === "function"
|
||||||
|
? this.settings.title()
|
||||||
|
: this.settings.title;
|
||||||
|
|
||||||
const action = actions.find(act => act.actionName === this.settings.command);
|
const action = actions.find(act => act.actionName === this.settings.command);
|
||||||
|
|
||||||
if (action && action.effectiveShortcuts.length > 0) {
|
if (action && action.effectiveShortcuts.length > 0) {
|
||||||
|
@ -18,7 +18,12 @@ export default class OpenNoteButtonWidget extends ButtonWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.icon(note.getIcon());
|
this.icon(note.getIcon());
|
||||||
this.title(note.title);
|
this.title(() => {
|
||||||
|
const n = froca.getNoteFromCache(noteId);
|
||||||
|
|
||||||
|
// always fresh, always decoded (when protected session is available)
|
||||||
|
return n.title;
|
||||||
|
});
|
||||||
|
|
||||||
this.refreshIcon();
|
this.refreshIcon();
|
||||||
});
|
});
|
||||||
|
@ -50,7 +50,13 @@ function exportToZip(taskContext, branch, format, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDataFileName(note, baseFileName, existingFileNames) {
|
function getDataFileName(note, baseFileName, existingFileNames) {
|
||||||
const existingExtension = path.extname(baseFileName).toLowerCase();
|
let fileName = baseFileName;
|
||||||
|
|
||||||
|
if (fileName.length > 30) {
|
||||||
|
fileName = fileName.substr(0, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
let existingExtension = path.extname(fileName).toLowerCase();
|
||||||
let newExtension;
|
let newExtension;
|
||||||
|
|
||||||
// following two are handled specifically since we always want to have these extensions no matter the automatic detection
|
// following two are handled specifically since we always want to have these extensions no matter the automatic detection
|
||||||
@ -67,14 +73,13 @@ function exportToZip(taskContext, branch, format, res) {
|
|||||||
else if (existingExtension.length > 0) { // if the page already has an extension, then we'll just keep it
|
else if (existingExtension.length > 0) { // if the page already has an extension, then we'll just keep it
|
||||||
newExtension = null;
|
newExtension = null;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (note.mime?.toLowerCase()?.trim() === "image/jpg") {
|
||||||
|
newExtension = 'jpg';
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
newExtension = mimeTypes.extension(note.mime) || "dat";
|
newExtension = mimeTypes.extension(note.mime) || "dat";
|
||||||
}
|
}
|
||||||
|
|
||||||
let fileName = baseFileName;
|
|
||||||
|
|
||||||
if (fileName.length > 30) {
|
|
||||||
fileName = fileName.substr(0, 30);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the note is already named with extension (e.g. "jquery"), then it's silly to append exact same extension again
|
// if the note is already named with extension (e.g. "jquery"), then it's silly to append exact same extension again
|
||||||
|
@ -123,7 +123,11 @@ function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function shrinkImage(buffer, originalName) {
|
async function shrinkImage(buffer, originalName) {
|
||||||
const jpegQuality = optionService.getOptionInt('imageJpegQuality');
|
let jpegQuality = optionService.getOptionInt('imageJpegQuality');
|
||||||
|
|
||||||
|
if (jpegQuality < 10 || jpegQuality > 100) {
|
||||||
|
jpegQuality = 75;
|
||||||
|
}
|
||||||
|
|
||||||
let finalImageBuffer;
|
let finalImageBuffer;
|
||||||
try {
|
try {
|
||||||
|
@ -351,7 +351,19 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
|||||||
|
|
||||||
let note = becca.getNote(noteId);
|
let note = becca.getNote(noteId);
|
||||||
|
|
||||||
|
const isProtected = importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable();
|
||||||
|
|
||||||
if (note) {
|
if (note) {
|
||||||
|
// only skeleton was created because of altered order of cloned notes in ZIP, we need to update
|
||||||
|
// https://github.com/zadam/trilium/issues/2440
|
||||||
|
if (note.type === undefined) {
|
||||||
|
note.type = type;
|
||||||
|
note.mime = mime;
|
||||||
|
note.title = noteTitle;
|
||||||
|
note.isProtected = isProtected;
|
||||||
|
note.save();
|
||||||
|
}
|
||||||
|
|
||||||
note.setContent(content);
|
note.setContent(content);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -367,7 +379,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
|||||||
// root notePosition should be ignored since it relates to original document
|
// root notePosition should be ignored since it relates to original document
|
||||||
// now import root should be placed after existing notes into new parent
|
// now import root should be placed after existing notes into new parent
|
||||||
notePosition: (noteMeta && firstNote) ? noteMeta.notePosition : undefined,
|
notePosition: (noteMeta && firstNote) ? noteMeta.notePosition : undefined,
|
||||||
isProtected: importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
|
isProtected: isProtected,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
createdNoteIds[note.noteId] = true;
|
createdNoteIds[note.noteId] = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user