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

This commit is contained in:
Elian Doran 2025-12-07 20:16:34 +02:00
parent 5ad267fe1b
commit c600e8ef89
No known key found for this signature in database
2 changed files with 12 additions and 2 deletions

View File

@ -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.",

View File

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