From c600e8ef89bdedb8eccf3d5a2fb23454ec43651e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 7 Dec 2025 20:16:34 +0200 Subject: [PATCH] feat(ckeditor/watchdog): add a toast to indicate the error --- apps/client/src/translations/en/translation.json | 4 +++- .../src/widgets/type_widgets/text/EditableText.tsx | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index d4619c96a0..6ee80e4736 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -987,7 +987,9 @@ "placeholder": "Type the content of your code note here..." }, "editable_text": { - "placeholder": "Type the content of your note here..." + "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." }, "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 c23443b73c..335a753bac 100644 --- a/apps/client/src/widgets/type_widgets/text/EditableText.tsx +++ b/apps/client/src/widgets/type_widgets/text/EditableText.tsx @@ -295,7 +295,15 @@ function useWatchdogCrashHandling() { hasCrashed.current = true; logError(`CKEditor crash logs: ${JSON.stringify(watchdog.crashes, null, 4)}`); - if (currentState === "crashedPermanently") { + if (currentState === "crashed") { + toast.showPersistent({ + id: "editor-crashed", + icon: "bx bx-bug", + title: t("editable_text.editor_crashed_title"), + message: t("editable_text.editor_crashed_content"), + timeout: 20_000 + }) + } else if (currentState === "crashedPermanently") { dialog.info(t("editable-text.keeps-crashing")); watchdog.editor?.enableReadOnlyMode("crashed-editor"); }