Merge remote-tracking branch 'origin/develop' into port/client_ts

This commit is contained in:
Elian Doran
2025-02-24 10:10:34 +02:00
309 changed files with 8308 additions and 3085 deletions

View File

@@ -8,6 +8,20 @@ function reloadFrontendApp(reason?: string) {
window.location.reload();
}
/**
* Triggers the system tray to update its menu items, i.e. after a change in dynamic content such as bookmarks or recent notes.
*
* On any other platform than Electron, nothing happens.
*/
function reloadTray() {
if (!isElectron()) {
return;
}
const { ipcRenderer } = dynamicRequire("electron");
ipcRenderer.send("reload-tray");
}
function parseDate(str: string) {
try {
return new Date(Date.parse(str));
@@ -124,6 +138,10 @@ function escapeHtml(str: string) {
return str.replace(/[&<>"'`=\/]/g, (s) => entityMap[s]);
}
export function escapeQuotes(value: string) {
return value.replaceAll("\"", "&quot;");
}
function formatSize(size: number) {
size = Math.max(Math.round(size / 1024), 1);
@@ -588,7 +606,10 @@ function compareVersions(v1: string, v2: string): number {
/**
* Compares two semantic version strings and returns `true` if the latest version is greater than the current version.
*/
function isUpdateAvailable(latestVersion: string, currentVersion: string): boolean {
function isUpdateAvailable(latestVersion: string | null | undefined, currentVersion: string): boolean {
if (!latestVersion) {
return false;
}
return compareVersions(latestVersion, currentVersion) > 0;
}
@@ -598,6 +619,7 @@ function isLaunchBarConfig(noteId: string) {
export default {
reloadFrontendApp,
reloadTray,
parseDate,
formatDateISO,
formatDateTime,