Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client/ts): port services/glob
Elian Doran14dd3a00214b
diff --git a/src/public/app/services/glob.js b/src/public/app/services/glob.tssimilarity index 98%rename from src/public/app/services/glob.jsrename to src/public/app/services/glob.tsindex f523a677e2..e5f9e744d4 100644--- a/src/public/app/services/glob.js+++ b/src/public/app/services/glob.ts@@ -27,7 +27,7 @@ function setupGlobs() {window.glob.importMarkdownInline = async () => appContext.triggerCommand("importMarkdownInline");window.onerror = function (msg, url, lineNo, columnNo, error) {- const string = msg.toLowerCase();+ const string = String(msg).toLowerCase();let message = "Uncaught error: ";diff --git a/src/public/app/services/utils.ts b/src/public/app/services/utils.tsindex 6e2937beb9..47bc2c1e94 100644--- a/src/public/app/services/utils.ts+++ b/src/public/app/services/utils.ts@@ -350,7 +350,7 @@ function openHelp($button: JQuery<HTMLElement>) {}}-function initHelpButtons($el: JQuery<HTMLElement>) {+function initHelpButtons($el: JQuery<HTMLElement> | JQuery<Window>) {// for some reason, the .on(event, listener, handler) does not work here (e.g. Options -> Sync -> Help button)// so we do it manually$el.on("click", e => {diff --git a/src/public/app/types.d.ts b/src/public/app/types.d.tsindex 14cc2c19a2..6e2f57ccf0 100644--- a/src/public/app/types.d.ts+++ b/src/public/app/types.d.ts@@ -3,6 +3,9 @@ import type { BackendModule, i18n } from "i18next";import type { Froca } from "./services/froca-interface";import type { HttpBackendOptions } from "i18next-http-backend";import { Suggestion } from "./services/note_autocomplete.ts";+import utils from "./services/utils.ts";+import appContext from "./components/app_context.ts";+import server from "./services/server.ts";interface ElectronProcess {type: string;@@ -10,11 +13,11 @@ interface ElectronProcess {}interface CustomGlobals {- isDesktop: boolean;- isMobile: boolean;+ isDesktop: typeof utils.isDesktop;+ isMobile: typeof utils.isMobile;device: "mobile" | "desktop";- getComponentsByEl: (el: unknown) => unknown;- getHeaders: Promise<Record<string, string>>;+ getComponentByEl: typeof appContext.getComponentByEl;+ getHeaders: typeof server.getHeaders;getReferenceLinkTitle: (href: string) => Promise<string>;getReferenceLinkTitleSync: (href: string) => string;getActiveContextNote: FNote;@@ -36,6 +39,7 @@ interface CustomGlobals {maxEntityChangeSyncIdAtLoad: number;assetPath: string;instanceName: string;+ appCssNoteIds: string[];}type RequireMethod = (moduleName: string) => any;