mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-ts: Address some review comments
This commit is contained in:
parent
a420129631
commit
d4c8d24d50
@ -51,9 +51,7 @@ class SearchResult {
|
|||||||
addScoreForStrings(tokens: string[], str: string, factor: number) {
|
addScoreForStrings(tokens: string[], str: string, factor: number) {
|
||||||
const chunks = str.toLowerCase().split(" ");
|
const chunks = str.toLowerCase().split(" ");
|
||||||
|
|
||||||
if (!this.score) {
|
this.score = 0;
|
||||||
this.score = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const chunk of chunks) {
|
for (const chunk of chunks) {
|
||||||
for (const token of tokens) {
|
for (const token of tokens) {
|
||||||
|
@ -113,7 +113,7 @@ class ValueExtractor {
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
const attr = cursor.getAttributeCaseInsensitive('relation', cur());
|
const attr = cursor.getAttributeCaseInsensitive('relation', cur());
|
||||||
cursor = (attr ? attr.targetNote || null : null);
|
cursor = attr?.targetNote || null;
|
||||||
}
|
}
|
||||||
else if (cur() === 'parents') {
|
else if (cur() === 'parents') {
|
||||||
cursor = cursor.parents[0];
|
cursor = cursor.parents[0];
|
||||||
|
@ -3,11 +3,7 @@ import path = require('path');
|
|||||||
import windowService = require('./window');
|
import windowService = require('./window');
|
||||||
import optionService = require('./options');
|
import optionService = require('./options');
|
||||||
|
|
||||||
const UPDATE_TRAY_EVENTS = [
|
let tray: Tray;
|
||||||
'minimize', 'maximize', 'show', 'hide'
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
let tray: Tray | null = null;
|
|
||||||
// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
|
// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
|
||||||
// is minimized
|
// is minimized
|
||||||
let isVisible = true;
|
let isVisible = true;
|
||||||
@ -42,14 +38,15 @@ const registerVisibilityListener = () => {
|
|||||||
// They need to be registered before the tray updater is registered
|
// They need to be registered before the tray updater is registered
|
||||||
mainWindow.on('show', () => {
|
mainWindow.on('show', () => {
|
||||||
isVisible = true;
|
isVisible = true;
|
||||||
|
updateTrayMenu();
|
||||||
});
|
});
|
||||||
mainWindow.on('hide', () => {
|
mainWindow.on('hide', () => {
|
||||||
isVisible = false;
|
isVisible = false;
|
||||||
|
updateTrayMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
UPDATE_TRAY_EVENTS.forEach((eventName) => {
|
mainWindow.on("minimize", updateTrayMenu);
|
||||||
mainWindow.on(eventName as any, updateTrayMenu)
|
mainWindow.on("maximize", updateTrayMenu);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateTrayMenu = () => {
|
const updateTrayMenu = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user