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

This commit is contained in:
Elian Doran 2025-12-07 20:40:29 +02:00
parent 522f3ae0a1
commit f779108b6c
No known key found for this signature in database
2 changed files with 20 additions and 3 deletions

View File

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

View File

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