Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(code): langs[lang] is not a function

tzhangchi56b278f40b2a
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);