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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat: fix backspeace
SaikaSakura8183552011d0
diff --git a/libs/components/editor-blocks/src/blocks/text/TextView.tsx b/libs/components/editor-blocks/src/blocks/text/TextView.tsxindex cb408cb189..8d1726a9a9 100644--- a/libs/components/editor-blocks/src/blocks/text/TextView.tsx+++ b/libs/components/editor-blocks/src/blocks/text/TextView.tsx@@ -112,13 +112,18 @@ export const TextView: FC<CreateTextView> = ({block.id,'end');- const value = [- ...preNode.getProperty('text').value,- ...block.getProperty('text').value,- ];- await preNode.setProperty('text', {- value,- });+ if (+ block.getProperty('text').value[0] &&+ block.getProperty('text').value[0]?.text !== ''+ ) {+ const value = [+ ...preNode.getProperty('text').value,+ ...block.getProperty('text').value,+ ];+ await preNode.setProperty('text', {+ value,+ });+ }await preNode.append(...children);await block.remove();editor.suspend(false);diff --git a/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx b/libs/components/editor-plugins/src/menu/command-menu/Menu.tsxindex b6d174e513..fc5583a2ee 100644--- a/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx+++ b/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx@@ -83,6 +83,9 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => {async (event: React.KeyboardEvent<HTMLDivElement>) => {const { type, anchorNode } = editor.selection.currentSelectInfo;// console.log(await editor.getBlockById(anchorNode.id));+ if (!anchorNode?.id) {+ return;+ }const activeBlock = await editor.getBlockById(anchorNode.id);if (activeBlock.type === Protocol.Block.Type.page) {return;