Skip to content

Build your personal knowledge base with Trilium Notes

feat(ckeditor/watchdog): add a more details button

Elian Doranf779108b6ca9
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 6ee80e4736..54f1500c8b 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 335a753bac..f7bbd51f74 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(<>
+ <p>{t("editable_text.editor_crashed_details_intro")}</p>
+ <h3>{t("editable_text.editor_crashed_details_title")}</h3>
+ <pre>{formattedCrash}</pre>
+ </>);
+ }
+ }
+ ]
+ // timeout: 20_000
})
} else if (currentState === "crashedPermanently") {
dialog.info(t("editable-text.keeps-crashing"));