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): add robust

tzhangchi52e0e3e794a4
diff --git a/libs/components/editor-blocks/src/blocks/code/index.ts b/libs/components/editor-blocks/src/blocks/code/index.ts
index a40fa5d584..d3114c6f57 100644
--- a/libs/components/editor-blocks/src/blocks/code/index.ts
+++ b/libs/components/editor-blocks/src/blocks/code/index.ts
@@ -36,7 +36,6 @@ export class CodeBlock extends BaseView {
}): Promise<HTML2BlockResult> {
// debugger;
if (element.tagName === 'CODE') {
- debugger;
return [
{
type: this.type,
@@ -50,7 +49,9 @@ export class CodeBlock extends BaseView {
},
],
},
- lang: element.classList[0].substr(9),
+ lang:
+ element.classList[0] &&
+ element.classList[0].substr(9),
},
children: [],
},