refactor(editor): separate the element renders (#11461)

This commit is contained in:
Saul-Mirone
2025-04-04 13:09:46 +00:00
parent 5a1106fb88
commit 2a1306c58c
70 changed files with 390 additions and 330 deletions
@@ -2,7 +2,6 @@ import {
CanvasElementType,
EdgelessCRUDIdentifier,
type IModelCoord,
TextUtils,
} from '@blocksuite/affine-block-surface';
import { TextElementModel } from '@blocksuite/affine-model';
import { Bound } from '@blocksuite/global/gfx';
@@ -11,6 +10,7 @@ import { GfxControllerIdentifier } from '@blocksuite/std/gfx';
import * as Y from 'yjs';
import { EdgelessTextEditor } from './edgeless-text-editor';
import { getCursorByCoord } from './element-renderer/utils';
export function mountTextElementEditor(
textElement: TextElementModel,
@@ -20,7 +20,7 @@ export function mountTextElementEditor(
let cursorIndex = textElement.text.length;
if (focusCoord) {
cursorIndex = Math.min(
TextUtils.getCursorByCoord(textElement, focusCoord),
getCursorByCoord(textElement, focusCoord),
cursorIndex
);
}