mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
continue #10824 ### Changed - Moved double-click-to-edit behavior from the default tool to individual model views - Introduced `onSelected` callback interface in gfx view components to allows developers to override default selection logic
25 lines
692 B
TypeScript
25 lines
692 B
TypeScript
import type { GroupElementModel } from '@blocksuite/affine-model';
|
|
import { GfxElementModelView } from '@blocksuite/block-std/gfx';
|
|
|
|
import { mountGroupTitleEditor } from './text/edgeless-group-title-editor';
|
|
|
|
export class GroupElementView extends GfxElementModelView<GroupElementModel> {
|
|
static override type: string = 'group';
|
|
|
|
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()) {
|
|
mountGroupTitleEditor(this.model, edgeless);
|
|
}
|
|
});
|
|
}
|
|
}
|