From 5ee6ba8cb08d70dfbb7b723148551db244cbcdab Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 4 Jan 2025 16:56:26 +0200 Subject: [PATCH] fix(electron): pasting non-existing file crashes the editor (closes #881) --- src/public/app/widgets/type_widgets/editable_text.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.js index be74bea3a..87141b342 100644 --- a/src/public/app/widgets/type_widgets/editable_text.js +++ b/src/public/app/widgets/type_widgets/editable_text.js @@ -12,6 +12,7 @@ import appContext from "../../components/app_context.js"; import dialogService from "../../services/dialog.js"; import { initSyntaxHighlighting } from "./ckeditor/syntax_highlight.js"; import options from "../../services/options.js"; +import toast from "../../services/toast.js"; const ENABLE_INSPECTOR = false; @@ -194,6 +195,12 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { } }); + const notificationsPlugin = editor.plugins.get("Notification"); + notificationsPlugin.on("show:warning", (evt, data) => { + toast.showErrorTitleAndMessage(data.title, data.message.message); + evt.stop(); + }); + await initSyntaxHighlighting(editor); if (isClassicEditor) {