diff --git a/libs/components/editor-blocks/src/blocks/text/TextView.tsx b/libs/components/editor-blocks/src/blocks/text/TextView.tsx index 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 = ({ 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.tsx index 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) => { 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;