mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
redesign of search input. Saved search is now saved under active note and doesn't need page reload
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
const utils = require('./utils');
|
||||
|
||||
const VIRTUAL_ATTRIBUTES = ["dateCreated", "dateCreated", "dateModified", "utcDateCreated", "utcDateModified", "isProtected", "title", "content", "type", "mime", "text"];
|
||||
const VIRTUAL_ATTRIBUTES = [
|
||||
"dateCreated",
|
||||
"dateModified",
|
||||
"utcDateCreated",
|
||||
"utcDateModified",
|
||||
"isProtected",
|
||||
"title",
|
||||
"content",
|
||||
"type",
|
||||
"mime",
|
||||
"text"
|
||||
];
|
||||
|
||||
module.exports = function(filters, selectedColumns = 'notes.*') {
|
||||
// alias => join
|
||||
@@ -106,7 +117,7 @@ module.exports = function(filters, selectedColumns = 'notes.*') {
|
||||
else if (filter.operator === '=*' || filter.operator === '!=*') {
|
||||
where += `${accessor}`
|
||||
+ (filter.operator.includes('!') ? ' NOT' : '')
|
||||
+ ` LIKE '` + utils.prepareSqlForLike('', filter.value, '%');
|
||||
+ ` LIKE ` + utils.prepareSqlForLike('', filter.value, '%');
|
||||
}
|
||||
else if (filter.operator === '*=*' || filter.operator === '!*=*') {
|
||||
where += `${accessor}`
|
||||
@@ -149,8 +160,5 @@ module.exports = function(filters, selectedColumns = 'notes.*') {
|
||||
GROUP BY notes.noteId
|
||||
ORDER BY ${orderBy.join(", ")}`;
|
||||
|
||||
console.log(query);
|
||||
console.log(params);
|
||||
|
||||
return { query, params };
|
||||
};
|
||||
|
||||
@@ -77,6 +77,18 @@ async function createNewNote(parentNoteId, noteData) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!noteData.mime) {
|
||||
if (noteData.type === 'text') {
|
||||
noteData.mime = 'text/html';
|
||||
}
|
||||
else if (noteData.type === 'code') {
|
||||
noteData.mime = 'text/plain';
|
||||
}
|
||||
else if (noteData.type === 'relation-map' || noteData.type === 'search') {
|
||||
noteData.mime = 'application/json';
|
||||
}
|
||||
}
|
||||
|
||||
noteData.type = noteData.type || parentNote.type;
|
||||
noteData.mime = noteData.mime || parentNote.mime;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const dayjs = require("dayjs");
|
||||
|
||||
const filterRegex = /(\b(AND|OR)\s+)?@(!?)([\w_]+|"[^"]+")\s*((=|!=|<|<=|>|>=|!?\*=|!?=\*|!?\*=\*)\s*([\w_-]+|"[^"]+"))?/ig;
|
||||
const filterRegex = /(\b(AND|OR)\s+)?@(!?)([\w_]+|"[^"]+")\s*((=|!=|<|<=|>|>=|!?\*=|!?=\*|!?\*=\*)\s*([\w_/-]+|"[^"]+"))?/ig;
|
||||
const smartValueRegex = /^(NOW|TODAY|WEEK|MONTH|YEAR) *([+\-] *\d+)?$/i;
|
||||
|
||||
function calculateSmartValue(v) {
|
||||
|
||||
Reference in New Issue
Block a user