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: slate cannot get the start point in the node at path [0]

lawvs64952806b918
diff --git a/libs/components/common/src/lib/text/slate-utils.ts b/libs/components/common/src/lib/text/slate-utils.ts
index 43a47ad85f..ec7e219810 100644
--- a/libs/components/common/src/lib/text/slate-utils.ts
+++ b/libs/components/common/src/lib/text/slate-utils.ts
@@ -605,6 +605,11 @@ class SlateUtils {
}
textChildren.push(child);
}
+ // If nothing, should preserve empty string
+ // Fix Slate Cannot get the start point in the node at path [0] because it has no start text node.
+ if (!textChildren.length) {
+ textChildren.push({ text: '' });
+ }
return textChildren;
}