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) {
|
||||
const chunks = str.toLowerCase().split(" ");
|
||||
|
||||
if (!this.score) {
|
||||
this.score = 0;
|
||||
}
|
||||
this.score = 0;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
for (const token of tokens) {
|
||||
|
@ -113,7 +113,7 @@ class ValueExtractor {
|
||||
i++;
|
||||
|
||||
const attr = cursor.getAttributeCaseInsensitive('relation', cur());
|
||||
cursor = (attr ? attr.targetNote || null : null);
|
||||
cursor = attr?.targetNote || null;
|
||||
}
|
||||
else if (cur() === 'parents') {
|
||||
cursor = cursor.parents[0];
|
||||
|
@ -3,11 +3,7 @@ import path = require('path');
|
||||
import windowService = require('./window');
|
||||
import optionService = require('./options');
|
||||
|
||||
const UPDATE_TRAY_EVENTS = [
|
||||
'minimize', 'maximize', 'show', 'hide'
|
||||
] as const;
|
||||
|
||||
let tray: Tray | null = null;
|
||||
let tray: Tray;
|
||||
// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
|
||||
// is minimized
|
||||
let isVisible = true;
|
||||
@ -42,14 +38,15 @@ const registerVisibilityListener = () => {
|
||||
// They need to be registered before the tray updater is registered
|
||||
mainWindow.on('show', () => {
|
||||
isVisible = true;
|
||||
updateTrayMenu();
|
||||
});
|
||||
mainWindow.on('hide', () => {
|
||||
isVisible = false;
|
||||
updateTrayMenu();
|
||||
});
|
||||
|
||||
UPDATE_TRAY_EVENTS.forEach((eventName) => {
|
||||
mainWindow.on(eventName as any, updateTrayMenu)
|
||||
});
|
||||
mainWindow.on("minimize", updateTrayMenu);
|
||||
mainWindow.on("maximize", updateTrayMenu);
|
||||
}
|
||||
|
||||
const updateTrayMenu = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user