From 56b278f40b2aa992ba25d0ad72e778d20eadf5bc Mon Sep 17 00:00:00 2001 From: tzhangchi Date: Thu, 15 Sep 2022 19:42:43 +0800 Subject: [PATCH] fix(code): langs[lang] is not a function --- libs/components/editor-blocks/src/blocks/code/CodeView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/editor-blocks/src/blocks/code/CodeView.tsx b/libs/components/editor-blocks/src/blocks/code/CodeView.tsx index a6a47e261c..68fb528f41 100644 --- a/libs/components/editor-blocks/src/blocks/code/CodeView.tsx +++ b/libs/components/editor-blocks/src/blocks/code/CodeView.tsx @@ -160,7 +160,7 @@ export const CodeView = ({ block, editor }: CreateCodeView) => { }; const handleLangChange = (lang: string) => { block.setProperty('lang', lang); - setExtensions([langs[lang]()]); + langs[lang] && setExtensions([langs[lang]()]); }; useEffect(() => { handleLangChange(langType ? langType : DEFAULT_LANG);