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
fix bacakspace in group first block
DiamondThreef490ad497b35
diff --git a/libs/components/editor-blocks/src/blocks/image/ImageView.tsx b/libs/components/editor-blocks/src/blocks/image/ImageView.tsxindex 36b446d790..a68292f022 100644--- a/libs/components/editor-blocks/src/blocks/image/ImageView.tsx+++ b/libs/components/editor-blocks/src/blocks/image/ImageView.tsx@@ -143,13 +143,13 @@ export const ImageView: FC<ImageView> = ({ block, editor }) => {type: 'link',});};- const handle_click = (e: React.MouseEvent<HTMLDivElement>) => {+ const handle_click = async (e: React.MouseEvent<HTMLDivElement>) => {//TODO clear active selection// document.getElementsByTagName('body')[0].click();e.stopPropagation();e.nativeEvent.stopPropagation();- editor.selectionManager.setSelectedNodesIds([block.id]);- editor.selectionManager.activeNodeByNodeId(block.id);+ await editor.selectionManager.setSelectedNodesIds([block.id]);+ await editor.selectionManager.activeNodeByNodeId(block.id, 'end');};const down_file = () => {if (down_ref) {diff --git a/libs/components/editor-blocks/src/blocks/text/TextView.tsx b/libs/components/editor-blocks/src/blocks/text/TextView.tsxindex ced1a8745d..64f10fc4f1 100644--- a/libs/components/editor-blocks/src/blocks/text/TextView.tsx+++ b/libs/components/editor-blocks/src/blocks/text/TextView.tsx@@ -99,7 +99,7 @@ export const TextView: FC<CreateTextView> = ({if (!parentBlock) {return false;}-+ let preParent = await parentBlock.previousSibling();if (Protocol.Block.Type.group === parentBlock.type) {const children = await block.children();const preNode = await block.physicallyPerviousSibling();@@ -129,34 +129,15 @@ export const TextView: FC<CreateTextView> = ({'start');if (block.blockProvider.isEmpty()) {- block.remove();- }- }- return true;- } else {- // TODO remove timing problem- const prevGroupBlock = await parentBlock.previousSibling();-- if (!prevGroupBlock) {- const childrenBlock = await parentBlock.children();- if (childrenBlock.length) {- if (children.length) {- await parentBlock.append(...children);- }await block.remove();- return true;+ let parentChild = await parentBlock.children();+ if (!parentChild.length) {+ await editor.selectionManager.setSelectedNodesIds(+ [preParent.id]+ );+ }}-- parentBlock.remove();- return true;}- if (prevGroupBlock.type !== Protocol.Block.Type.group) {- unwrapGroup(parentBlock);- return true;- }-- mergeGroup(prevGroupBlock, parentBlock);-return true;}}