Skip to content

Build your personal knowledge base with Trilium Notes

feat(client/bundle): add button to open script note

Elian Doranc55825545078
diff --git a/apps/client/src/services/toast.ts b/apps/client/src/services/toast.ts
index 4ab4f1efb3..09aa8454b0 100644
--- a/apps/client/src/services/toast.ts
+++ b/apps/client/src/services/toast.ts
@@ -1,6 +1,8 @@
import { signal } from "@preact/signals";
+import appContext from "../components/app_context.js";
import froca from "./froca.js";
+import { t } from "./i18n.js";
import utils from "./utils.js";
export interface ToastOptions {
@@ -69,7 +71,13 @@ export async function showErrorForScriptNote(noteId: string, message: string) {
title: note?.title ?? "",
icon: note?.getIcon() ?? "bx bx-error-circle",
message,
- timeout: 15_000
+ timeout: 15_000,
+ buttons: [
+ {
+ text: t("toast.open-script-note"),
+ onClick: () => appContext.tabManager.openInNewTab(noteId, null, true)
+ }
+ ]
});
}
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 648fe747ab..261f4e018d 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -29,7 +29,8 @@
"widget-render-error": {
"title": "Failed to render a custom React widget"
},
- "widget-missing-parent": "Custom widget does not have mandatory 'parentWidget' property defined."
+ "widget-missing-parent": "Custom widget does not have mandatory 'parentWidget' property defined.",
+ "open-script-note": "Open script note"
},
"add_link": {
"add_link": "Add link",