mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
refactor(editor): reduce dependency to doc collection (#9492)
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
pointInPolygon,
|
||||
polygonNearestPoint,
|
||||
} from '@blocksuite/global/utils';
|
||||
import { DocCollection, type Y } from '@blocksuite/store';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
import {
|
||||
FontFamily,
|
||||
@@ -31,8 +31,8 @@ export class TextElementModel extends GfxPrimitiveElementModel<TextElementProps>
|
||||
}
|
||||
|
||||
static override propsToY(props: Record<string, unknown>) {
|
||||
if (props.text && !(props.text instanceof DocCollection.Y.Text)) {
|
||||
props.text = new DocCollection.Y.Text(props.text as string);
|
||||
if (props.text && !(props.text instanceof Y.Text)) {
|
||||
props.text = new Y.Text(props.text as string);
|
||||
}
|
||||
|
||||
return props;
|
||||
@@ -82,7 +82,7 @@ export class TextElementModel extends GfxPrimitiveElementModel<TextElementProps>
|
||||
accessor rotate: number = 0;
|
||||
|
||||
@field()
|
||||
accessor text: Y.Text = new DocCollection.Y.Text();
|
||||
accessor text: Y.Text = new Y.Text();
|
||||
|
||||
@field()
|
||||
accessor textAlign: TextAlign = TextAlign.Center;
|
||||
|
||||
Reference in New Issue
Block a user