feat(markdown): add double-click → edit mode via SelectionManager callback

This commit is contained in:
Hiren Kangad
2026-03-13 11:21:27 +05:30
parent 02597abc9d
commit 2d5396ef09
2 changed files with 16 additions and 0 deletions
+8
View File
@@ -85,6 +85,7 @@ export class SelectionManager {
private _onDoubleClickText: ((item: SceneItem) => void) | null = null;
private _onDoubleClickImage: ((item: SceneItem) => void) | null = null;
private _onDoubleClickMarkdown: ((item: SceneItem) => void) | null = null;
private _enabled = true;
@@ -168,6 +169,11 @@ export class SelectionManager {
this._onDoubleClickImage = fn;
}
/** Called on double-click of a markdown item (for edit mode). */
set onDoubleClickMarkdown(fn: (item: SceneItem) => void) {
this._onDoubleClickMarkdown = fn;
}
/** Select only this item, deselecting everything else. */
selectOnly(id: string): void {
this.selectedIds.clear();
@@ -393,6 +399,8 @@ export class SelectionManager {
this._onDoubleClickText?.(item);
} else if (item.type === 'image' || item.type === 'drawing') {
this._onDoubleClickImage?.(item);
} else if (item.type === 'markdown') {
this._onDoubleClickMarkdown?.(item);
}
this._lastClickTime = 0;
this._lastClickItemId = null;