mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix finding single note by label with mixed case
This commit is contained in:
parent
a08690b123
commit
20696aa0ab
@ -29,7 +29,13 @@ class Becca {
|
||||
|
||||
/** @return {Attribute[]} */
|
||||
findAttributes(type, name) {
|
||||
return this.attributeIndex[`${type}-${name.toLowerCase()}`] || [];
|
||||
name = name.trim().toLowerCase();
|
||||
|
||||
if (name.startsWith('#') || name.startsWith('~')) {
|
||||
name = name.substr(1);
|
||||
}
|
||||
|
||||
return this.attributeIndex[`${type}-${name}`] || [];
|
||||
}
|
||||
|
||||
/** @return {Attribute[]} */
|
||||
|
@ -33,7 +33,8 @@ export default class EditedNotesWidget extends CollapsibleWidget {
|
||||
getTitle() {
|
||||
return {
|
||||
show: this.isEnabled(),
|
||||
activate: true,
|
||||
// promoted attributes have priority over edited notes
|
||||
activate: this.note.getPromotedDefinitionAttributes().length === 0,
|
||||
title: 'Edited Notes',
|
||||
icon: 'bx bx-calendar-edit'
|
||||
};
|
||||
|
@ -75,8 +75,14 @@ function getNoteWithLabel(name, value) {
|
||||
// optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes
|
||||
const attrs = becca.findAttributes('label', name);
|
||||
|
||||
if (value === undefined) {
|
||||
return attrs[0]?.getNote();
|
||||
}
|
||||
|
||||
value = value?.toLowerCase();
|
||||
|
||||
for (const attr of attrs) {
|
||||
if (attr.value === value) {
|
||||
if (attr.value.toLowerCase() === value) {
|
||||
return attr.getNote();
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ function getNoteStartingWith(parentNoteId, startsWith) {
|
||||
|
||||
/** @return {Note} */
|
||||
function getRootCalendarNote() {
|
||||
// some caching here could be useful (e.g. in CLS)
|
||||
let rootNote = attributeService.getNoteWithLabel(CALENDAR_ROOT_LABEL);
|
||||
|
||||
if (!rootNote) {
|
||||
|
@ -19,7 +19,7 @@ class LabelComparisonExp extends Expression {
|
||||
|
||||
for (const attr of attrs) {
|
||||
const note = attr.note;
|
||||
const value = attr.value ? attr.value.toLowerCase() : attr.value;
|
||||
const value = attr.value?.toLowerCase();
|
||||
|
||||
if (inputNoteSet.hasNoteId(note.noteId) && this.comparator(value)) {
|
||||
if (attr.isInheritable) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user