diff --git a/libs/components/board-shapes/src/editor-util/EditorUtil.tsx b/libs/components/board-shapes/src/editor-util/EditorUtil.tsx index 0855310081..805ada0623 100644 --- a/libs/components/board-shapes/src/editor-util/EditorUtil.tsx +++ b/libs/components/board-shapes/src/editor-util/EditorUtil.tsx @@ -11,7 +11,7 @@ import { 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, @@ -149,6 +149,15 @@ export class EditorUtil extends TDShapeUtil { })(); }, [isEditing]); + const onMouseDown = useCallback( + (e: MouseEvent) => { + if (e.detail === 2) { + app.setEditingText(shape.id); + } + }, + [app, shape.id] + ); + return ( { onPointerDown={stopPropagation} onMouseEnter={activateIfEditing} onDragEnter={activateIfEditing} + onMouseDown={onMouseDown} > >({ - max: 8192, - ttl: 1000 * 60 * 30, - }); + private _cacheManager = new Map>(); public mouseManager = new MouseManager(this); public selectionManager = new SelectionManager(this); public keyboardManager = new KeyboardManager(this); @@ -234,7 +230,12 @@ export class Editor implements Virgo { return await services.api.editorBlock.update(patches); }, remove: async ({ workspace, id }: WorkspaceAndBlockId) => { - return await services.api.editorBlock.delete({ workspace, id }); + const ret = await services.api.editorBlock.delete({ + workspace, + id, + }); + this._cacheManager.delete(id); + return ret; }, observe: async ( { workspace, id }: WorkspaceAndBlockId,