diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 6ee80e473..54f1500c8 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -989,7 +989,10 @@ "editable_text": { "placeholder": "Type the content of your note here...", "editor_crashed_title": "The text editor crashed", - "editor_crashed_content": "Your content was recovered successfully, but a few of your most recent changes may not have been saved." + "editor_crashed_content": "Your content was recovered successfully, but a few of your most recent changes may not have been saved.", + "editor_crashed_details_button": "View more details...", + "editor_crashed_details_intro": "If you experience this error several times, consider reporting it on GitHub by pasting the information below.", + "editor_crashed_details_title": "Technical information" }, "empty": { "open_note_instruction": "Open a note by typing the note's title into the input below or choose a note in the tree.", diff --git a/apps/client/src/widgets/type_widgets/text/EditableText.tsx b/apps/client/src/widgets/type_widgets/text/EditableText.tsx index 335a753ba..f7bbd51f7 100644 --- a/apps/client/src/widgets/type_widgets/text/EditableText.tsx +++ b/apps/client/src/widgets/type_widgets/text/EditableText.tsx @@ -293,7 +293,8 @@ function useWatchdogCrashHandling() { } hasCrashed.current = true; - logError(`CKEditor crash logs: ${JSON.stringify(watchdog.crashes, null, 4)}`); + const formattedCrash = JSON.stringify(watchdog.crashes, null, 4); + logError(`CKEditor crash logs: ${formattedCrash}`); if (currentState === "crashed") { toast.showPersistent({ @@ -301,7 +302,20 @@ function useWatchdogCrashHandling() { icon: "bx bx-bug", title: t("editable_text.editor_crashed_title"), message: t("editable_text.editor_crashed_content"), - timeout: 20_000 + buttons: [ + { + text: t("editable_text.editor_crashed_details_button"), + onClick: ({ dismissToast }) => { + dismissToast(); + dialog.info(<> +

{t("editable_text.editor_crashed_details_intro")}

+

{t("editable_text.editor_crashed_details_title")}

+
{formattedCrash}
+ ); + } + } + ] + // timeout: 20_000 }) } else if (currentState === "crashedPermanently") { dialog.info(t("editable-text.keeps-crashing"));