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.

Merge remote-tracking branch 'origin/develop' into fix/autofocus-board-editor

alt0faf654fbc53a
diff --cc libs/components/board-shapes/src/editor-util/EditorUtil.tsx
index 0855310081,cb6e56275a..805ada0623
--- a/libs/components/board-shapes/src/editor-util/EditorUtil.tsx
+++ b/libs/components/board-shapes/src/editor-util/EditorUtil.tsx
@@@ -8,10 -8,9 +8,10 @@@ import
TDShapeType,
TransformInfo,
} from '@toeverything/components/board-types';
+import type { BlockEditor } from '@toeverything/components/editor-core';
import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
- import type { SyntheticEvent } from 'react';
+ import type { MouseEvent, SyntheticEvent } from 'react';
import { memo, useCallback, useEffect, useRef } from 'react';
import {
defaultTextStyle,
@@@ -137,18 -135,15 +137,27 @@@ export class EditorUtil extends TDShape
}
}, [app, state, shape.id, editingText, editingId]);
+ useEffect(() => {
+ (async () => {
+ if (isEditing) {
+ const lastBlock =
+ await editorRef.current.getLastBlock();
+ editorRef.current.selectionManager.activeNodeByNodeId(
+ lastBlock.id
+ );
+ }
+ })();
+ }, [isEditing]);
+
+ const onMouseDown = useCallback(
+ (e: MouseEvent) => {
+ if (e.detail === 2) {
+ app.setEditingText(shape.id);
+ }
+ },
+ [app, shape.id]
+ );
+
return (
<HTMLContainer ref={ref} {...events}>
<Container