From 332e93fdb82bc466cfb2421420eeea91d637f3a4 Mon Sep 17 00:00:00 2001 From: KW Kwan Date: Thu, 28 Dec 2023 16:42:57 +0800 Subject: [PATCH] Fix TypeError: Cannot read properties of undefined (reading 'getSrcToShow') --- src/features/image/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/image/schema.ts b/src/features/image/schema.ts index e6eac91..18ca274 100644 --- a/src/features/image/schema.ts +++ b/src/features/image/schema.ts @@ -35,7 +35,7 @@ export default function getFeature(opts: FeatureOptions) { }], toDOM(node) { const { alt, src } = node.attrs; - const parsedSrc = opts.getSrcToShow(src); + const parsedSrc = opts ? opts.getSrcToShow(src) : false; // If `getSrcToShow()` is async, we can’t show a proper image. // Which is OK in case of editor GUI, where it can notice the promise // and resolve show proper image after it resolves,