mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
commit
fbc79eae62
@ -168,7 +168,6 @@ function trimMime(mime) {
|
||||
}
|
||||
|
||||
mimeCache[mime] = str;
|
||||
mimeCache[mime] = str;
|
||||
}
|
||||
|
||||
return mimeCache[mime];
|
||||
|
@ -20,7 +20,7 @@ function register(router) {
|
||||
const {date} = req.params;
|
||||
|
||||
if (!isValidDate(date)) {
|
||||
throw getDateInvalidError(res, date);
|
||||
throw getDateInvalidError(date);
|
||||
}
|
||||
|
||||
const note = specialNotesService.getInboxNote(date);
|
||||
@ -31,7 +31,7 @@ function register(router) {
|
||||
const {date} = req.params;
|
||||
|
||||
if (!isValidDate(date)) {
|
||||
throw getDateInvalidError(res, date);
|
||||
throw getDateInvalidError(date);
|
||||
}
|
||||
|
||||
const note = dateNotesService.getDayNote(date);
|
||||
@ -42,7 +42,7 @@ function register(router) {
|
||||
const {date} = req.params;
|
||||
|
||||
if (!isValidDate(date)) {
|
||||
throw getDateInvalidError(res, date);
|
||||
throw getDateInvalidError(date);
|
||||
}
|
||||
|
||||
const note = dateNotesService.getWeekNote(date);
|
||||
@ -53,7 +53,7 @@ function register(router) {
|
||||
const {month} = req.params;
|
||||
|
||||
if (!/[0-9]{4}-[0-9]{2}/.test(month)) {
|
||||
throw getMonthInvalidError(res, month);
|
||||
throw getMonthInvalidError(month);
|
||||
}
|
||||
|
||||
const note = dateNotesService.getMonthNote(month);
|
||||
@ -64,7 +64,7 @@ function register(router) {
|
||||
const {year} = req.params;
|
||||
|
||||
if (!/[0-9]{4}/.test(year)) {
|
||||
throw getYearInvalidError(res, year);
|
||||
throw getYearInvalidError(year);
|
||||
}
|
||||
|
||||
const note = dateNotesService.getYearNote(year);
|
||||
|
@ -10,7 +10,7 @@ async function moveBeforeBranch(branchIdsToMove, beforeBranchId) {
|
||||
branchIdsToMove = filterRootNote(branchIdsToMove);
|
||||
branchIdsToMove = filterSearchBranches(branchIdsToMove);
|
||||
|
||||
const beforeBranch = await froca.getBranch(beforeBranchId);
|
||||
const beforeBranch = froca.getBranch(beforeBranchId);
|
||||
|
||||
if (['root', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(beforeBranch.noteId)) {
|
||||
toastService.showError('Cannot move notes here.');
|
||||
@ -31,7 +31,7 @@ async function moveAfterBranch(branchIdsToMove, afterBranchId) {
|
||||
branchIdsToMove = filterRootNote(branchIdsToMove);
|
||||
branchIdsToMove = filterSearchBranches(branchIdsToMove);
|
||||
|
||||
const afterNote = await froca.getBranch(afterBranchId).getNote();
|
||||
const afterNote = froca.getBranch(afterBranchId).getNote();
|
||||
|
||||
const forbiddenNoteIds = [
|
||||
'root',
|
||||
@ -59,7 +59,7 @@ async function moveAfterBranch(branchIdsToMove, afterBranchId) {
|
||||
}
|
||||
|
||||
async function moveToParentNote(branchIdsToMove, newParentBranchId) {
|
||||
const newParentBranch = await froca.getBranch(newParentBranchId);
|
||||
const newParentBranch = froca.getBranch(newParentBranchId);
|
||||
|
||||
if (newParentBranch.noteId === '_lbRoot') {
|
||||
toastService.showError('Cannot move notes here.');
|
||||
|
@ -10,7 +10,6 @@ export async function uploadFiles(parentNoteId, files, options) {
|
||||
}
|
||||
|
||||
const taskId = utils.randomString(10);
|
||||
let noteId;
|
||||
let counter = 0;
|
||||
|
||||
for (const file of files) {
|
||||
@ -25,7 +24,7 @@ export async function uploadFiles(parentNoteId, files, options) {
|
||||
formData.append(key, options[key]);
|
||||
}
|
||||
|
||||
({noteId} = await $.ajax({
|
||||
await $.ajax({
|
||||
url: `${baseApiUrl}notes/${parentNoteId}/import`,
|
||||
headers: await server.getHeaders(),
|
||||
data: formData,
|
||||
@ -37,7 +36,7 @@ export async function uploadFiles(parentNoteId, files, options) {
|
||||
},
|
||||
contentType: false, // NEEDED, DON'T REMOVE THIS
|
||||
processData: false, // NEEDED, DON'T REMOVE THIS
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,4 +73,4 @@ ws.subscribeToMessages(async message => {
|
||||
|
||||
export default {
|
||||
uploadFiles
|
||||
}
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ function formatDateTime(date) {
|
||||
}
|
||||
|
||||
function localNowDateTime() {
|
||||
return dayjs().format('YYYY-MM-DD HH:mm:ss.SSSZZ')
|
||||
return dayjs().format('YYYY-MM-DD HH:mm:ss.SSSZZ');
|
||||
}
|
||||
|
||||
function now() {
|
||||
@ -101,7 +101,7 @@ async function stopWatch(what, func) {
|
||||
}
|
||||
|
||||
function formatValueWithWhitespace(val) {
|
||||
return /[^\w_-]/.test(val) ? `"${val}"` : val;
|
||||
return /[^\w-]/.test(val) ? `"${val}"` : val;
|
||||
}
|
||||
|
||||
function formatLabel(label) {
|
||||
@ -318,7 +318,7 @@ function initHelpDropdown($el) {
|
||||
initHelpButtons($dropdownMenu);
|
||||
}
|
||||
|
||||
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/"
|
||||
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
|
||||
|
||||
function openHelp(e) {
|
||||
window.open(wikiBaseUrl + $(e.target).attr("data-help-page"), '_blank');
|
||||
@ -329,7 +329,7 @@ function initHelpButtons($el) {
|
||||
// so we do it manually
|
||||
$el.on("click", e => {
|
||||
if ($(e.target).attr("data-help-page")) {
|
||||
openHelp(e)
|
||||
openHelp(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
"use strict"
|
||||
"use strict";
|
||||
|
||||
function formatAttrForSearch(attr, searchWithValue) {
|
||||
let searchStr = '';
|
||||
@ -28,7 +28,7 @@ function formatAttrForSearch(attr, searchWithValue) {
|
||||
}
|
||||
|
||||
function formatValue(val) {
|
||||
if (!/[^\w_]/.test(val)) {
|
||||
if (!/[^\w]/.test(val)) {
|
||||
return val;
|
||||
}
|
||||
else if (!val.includes('"')) {
|
||||
@ -47,4 +47,4 @@ function formatValue(val) {
|
||||
|
||||
module.exports = {
|
||||
formatAttrForSearch
|
||||
}
|
||||
};
|
||||
|
@ -122,7 +122,7 @@ function isAttributeType(type) {
|
||||
|
||||
function isAttributeDangerous(type, name) {
|
||||
return BUILTIN_ATTRIBUTES.some(attr =>
|
||||
attr.type === attr.type &&
|
||||
attr.type === type &&
|
||||
attr.name.toLowerCase() === name.trim().toLowerCase() &&
|
||||
attr.isDangerous
|
||||
);
|
||||
|
@ -389,7 +389,7 @@ function getExpression(tokens, searchContext, level = 0) {
|
||||
else if (token === 'note') {
|
||||
i++;
|
||||
|
||||
expressions.push(parseNoteProperty(tokens));
|
||||
expressions.push(parseNoteProperty());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ function searchNotesForAutocomplete(query) {
|
||||
noteTitle: beccaService.getNoteTitle(result.noteId),
|
||||
notePathTitle: result.notePathTitle,
|
||||
highlightedNotePathTitle: result.highlightedNotePathTitle
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ function formatAttribute(attr) {
|
||||
let label = `#${utils.escapeHtml(attr.name)}`;
|
||||
|
||||
if (attr.value) {
|
||||
const val = /[^\w_-]/.test(attr.value) ? `"${attr.value}"` : attr.value;
|
||||
const val = /[^\w-]/.test(attr.value) ? `"${attr.value}"` : attr.value;
|
||||
|
||||
label += `=${utils.escapeHtml(val)}`;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ function wrap(query, func) {
|
||||
// in these cases error should be simply ignored.
|
||||
console.log(e.message);
|
||||
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
throw e;
|
||||
@ -281,7 +281,7 @@ function fillParamList(paramIds, truncate = true) {
|
||||
}
|
||||
|
||||
// doing it manually to avoid this showing up on the sloq query list
|
||||
const s = stmt(`INSERT INTO param_list VALUES ${paramIds.map(paramId => `(?)`).join(',')}`, paramIds);
|
||||
const s = stmt(`INSERT INTO param_list VALUES ${paramIds.map(paramId => `(?)`).join(',')}`);
|
||||
|
||||
s.run(paramIds);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user