mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-21 03:51:45 +08:00
bc0530a708
Closes: BS-3211
29 lines
753 B
TypeScript
29 lines
753 B
TypeScript
import { ShapeElementModel } from '@blocksuite/affine-model';
|
|
import { GfxElementModelView } from '@blocksuite/std/gfx';
|
|
|
|
import { mountShapeTextEditor } from './text/edgeless-shape-text-editor';
|
|
|
|
export class ShapeElementView extends GfxElementModelView<ShapeElementModel> {
|
|
static override type: string = 'shape';
|
|
|
|
override onCreated(): void {
|
|
super.onCreated();
|
|
|
|
this._initDblClickToEdit();
|
|
}
|
|
|
|
private _initDblClickToEdit(): void {
|
|
this.on('dblclick', () => {
|
|
const edgeless = this.std.view.getBlock(this.std.store.root!.id);
|
|
|
|
if (
|
|
edgeless &&
|
|
!this.model.isLocked() &&
|
|
this.model instanceof ShapeElementModel
|
|
) {
|
|
mountShapeTextEditor(this.model, edgeless);
|
|
}
|
|
});
|
|
}
|
|
}
|