Skip to content

Build your personal knowledge base with Trilium Notes

fix(electron): pasting non-existing file crashes the editor (closes #881)

Elian Doran5ee6ba8cb08d
diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.js
index be74bea3a0..87141b3423 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) {