mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 05:58:56 +08:00
205cd7a86d
Closes: BS-2946
25 lines
681 B
TypeScript
25 lines
681 B
TypeScript
import type { 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 {
|
|
const edgeless = this.std.view.getBlock(this.std.store.root!.id);
|
|
|
|
this.on('dblclick', () => {
|
|
if (edgeless && !this.model.isLocked()) {
|
|
mountShapeTextEditor(this.model, edgeless);
|
|
}
|
|
});
|
|
}
|
|
}
|