mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge branch 'stable'
This commit is contained in:
commit
5d52498da1
4
libraries/ckeditor/ckeditor.js
vendored
4
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1174,14 +1174,8 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
|
|
||||||
/** @returns {BAttachment} */
|
/** @returns {BAttachment} */
|
||||||
getAttachmentByTitle(title) {
|
getAttachmentByTitle(title) {
|
||||||
return sql.getRows(`
|
// cannot use SQL to filter by title since it can be encrypted
|
||||||
SELECT attachments.*
|
return this.getAttachments().filter(attachment => attachment.title === title)[0];
|
||||||
FROM attachments
|
|
||||||
WHERE ownerId = ?
|
|
||||||
AND title = ?
|
|
||||||
AND isDeleted = 0
|
|
||||||
ORDER BY position`, [this.noteId, title])
|
|
||||||
.map(row => new BAttachment(row))[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,14 +157,8 @@ class BRevision extends AbstractBeccaEntity {
|
|||||||
|
|
||||||
/** @returns {BAttachment} */
|
/** @returns {BAttachment} */
|
||||||
getAttachmentByTitle(title) {
|
getAttachmentByTitle(title) {
|
||||||
return sql.getRows(`
|
// cannot use SQL to filter by title since it can be encrypted
|
||||||
SELECT attachments.*
|
return this.getAttachments().filter(attachment => attachment.title === title)[0];
|
||||||
FROM attachments
|
|
||||||
WHERE ownerId = ?
|
|
||||||
AND title = ?
|
|
||||||
AND isDeleted = 0
|
|
||||||
ORDER BY position`, [this.revisionId, title])
|
|
||||||
.map(row => new BAttachment(row))[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeSaving() {
|
beforeSaving() {
|
||||||
|
@ -268,7 +268,9 @@ function linkContextMenu(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadReferenceLinkTitle($el, href = null) {
|
async function loadReferenceLinkTitle($el, href = null) {
|
||||||
href = href || $el.find("a").attr("href");
|
const $link = $el[0].tagName === 'A' ? $el : $el.find("a");
|
||||||
|
|
||||||
|
href = href || $link.attr("href");
|
||||||
if (!href) {
|
if (!href) {
|
||||||
console.warn("Empty URL for parsing: " + $el[0].outerHTML);
|
console.warn("Empty URL for parsing: " + $el[0].outerHTML);
|
||||||
return;
|
return;
|
||||||
@ -286,7 +288,7 @@ async function loadReferenceLinkTitle($el, href = null) {
|
|||||||
|
|
||||||
if (note) {
|
if (note) {
|
||||||
const icon = await getLinkIcon(noteId, viewScope.viewMode);
|
const icon = await getLinkIcon(noteId, viewScope.viewMode);
|
||||||
|
k
|
||||||
$el.prepend($("<span>").addClass(icon));
|
$el.prepend($("<span>").addClass(icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,15 +75,14 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)
|
|||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
function getDataFileName(type, mime, baseFileName, existingFileNames) {
|
function getDataFileName(type, mime, baseFileName, existingFileNames) {
|
||||||
let fileName = baseFileName;
|
let fileName = baseFileName.trim();
|
||||||
|
if (fileName.length > 30) {
|
||||||
|
fileName = fileName.substr(0, 30).trim();
|
||||||
|
}
|
||||||
|
|
||||||
let existingExtension = path.extname(fileName).toLowerCase();
|
let existingExtension = path.extname(fileName).toLowerCase();
|
||||||
let newExtension;
|
let newExtension;
|
||||||
|
|
||||||
if (fileName.length > 30) {
|
|
||||||
fileName = fileName.substr(0, 30);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
|
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
|
||||||
// and/or existing detected extensions in the note name
|
// and/or existing detected extensions in the note name
|
||||||
if (type === 'text' && format === 'markdown') {
|
if (type === 'text' && format === 'markdown') {
|
||||||
@ -108,7 +107,7 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the note is already named with extension (e.g. "jquery"), then it's silly to append the exact same extension again
|
// if the note is already named with the extension (e.g. "image.jpg"), then it's silly to append the exact same extension again
|
||||||
if (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) {
|
if (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) {
|
||||||
fileName += `.${newExtension}`;
|
fileName += `.${newExtension}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user