A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: move file link confirm dialog to native side
Abdullah Attaba0cfbf44a4f
diff --git a/apps/desktop/src/api/os-integration.ts b/apps/desktop/src/api/os-integration.tsindex 8e2db5936..73a3483e7 100644--- a/apps/desktop/src/api/os-integration.ts+++ b/apps/desktop/src/api/os-integration.ts@@ -164,10 +164,12 @@ export const osIntegrationRouter = t.router({const { type, link } = input;if (type !== "path") return;+ const path = decodeURIComponent(new URL(link).pathname);const resolvedPath = resolvePath(// remove leading slash from path on windows- platform() === "win32" ? link.slice(1) : link+ platform() === "win32" ? path.slice(1) : path);+if (!existsSync(resolvedPath)) {if (globalThis.window) {await dialog.showMessageBox(globalThis.window, {@@ -179,7 +181,15 @@ export const osIntegrationRouter = t.router({return;}- await shell.openPath(resolvedPath);+ const result = await dialog.showMessageBox(globalThis.window!, {+ message: strings.openingLocalFileDesc(resolvedPath),+ title: strings.openingLocalFile(),+ buttons: [strings.cancel(), strings.open()],+ defaultId: 1,+ cancelId: 0,+ type: "question"+ });+ result.response === 1 && (await shell.openPath(resolvedPath));}),bringToFront: t.procedure.query(() => bringToFront()),changeTheme: t.procedurediff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsxindex 410bc2b2b..20e3abb9a 100644--- a/apps/web/src/components/editor/tiptap.tsx+++ b/apps/web/src/components/editor/tiptap.tsx@@ -435,18 +435,9 @@ function TipTap(props: TipTapProps) {return;}- const path = new URL(url).pathname;- const ok = await ConfirmDialog.show({- title: strings.openingLocalFile(),- message: strings.openingLocalFileDesc(path),- positiveButtonText: strings.open(),- negativeButtonText: strings.cancel()- });- if (!ok) return;-await desktop?.integration.openPath.query({type: "path",- link: decodeURIComponent(path)+ link: url});} else window.open(url, "_blank");},