Skip to content

Build your personal knowledge base with Trilium Notes

feat(ckeditor/watchdog): add a toast to indicate the error

Elian Doranc600e8ef89bd
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");
}