Compare commits

...

1 Commits

Author SHA1 Message Date
CodeRabbit Fixer
084d6ff9ed fix: Refactor: Normalize graph-canvas targetElementId at keybinding registration time (#9497)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:48:41 +01:00
3 changed files with 10 additions and 11 deletions

View File

@@ -96,7 +96,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
alt: true alt: true
}, },
commandId: 'Comfy.Canvas.ZoomIn', commandId: 'Comfy.Canvas.ZoomIn',
targetElementId: 'graph-canvas' targetElementId: 'graph-canvas-container'
}, },
{ {
combo: { combo: {
@@ -105,7 +105,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
shift: true shift: true
}, },
commandId: 'Comfy.Canvas.ZoomIn', commandId: 'Comfy.Canvas.ZoomIn',
targetElementId: 'graph-canvas' targetElementId: 'graph-canvas-container'
}, },
{ {
combo: { combo: {
@@ -113,7 +113,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
alt: true alt: true
}, },
commandId: 'Comfy.Canvas.ZoomIn', commandId: 'Comfy.Canvas.ZoomIn',
targetElementId: 'graph-canvas' targetElementId: 'graph-canvas-container'
}, },
{ {
combo: { combo: {
@@ -121,7 +121,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
alt: true alt: true
}, },
commandId: 'Comfy.Canvas.ZoomOut', commandId: 'Comfy.Canvas.ZoomOut',
targetElementId: 'graph-canvas' targetElementId: 'graph-canvas-container'
}, },
{ {
combo: { combo: {

View File

@@ -11,7 +11,10 @@ export class KeybindingImpl implements Keybinding {
constructor(obj: Keybinding) { constructor(obj: Keybinding) {
this.commandId = obj.commandId this.commandId = obj.commandId
this.combo = new KeyComboImpl(obj.combo) this.combo = new KeyComboImpl(obj.combo)
this.targetElementId = obj.targetElementId this.targetElementId =
obj.targetElementId === 'graph-canvas'
? 'graph-canvas-container'
: obj.targetElementId
} }
equals(other: unknown): boolean { equals(other: unknown): boolean {

View File

@@ -34,12 +34,8 @@ export function useKeybindingService() {
const keybinding = keybindingStore.getKeybinding(keyCombo) const keybinding = keybindingStore.getKeybinding(keyCombo)
if (keybinding) { if (keybinding) {
const targetElementId = if (keybinding.targetElementId) {
keybinding.targetElementId === 'graph-canvas' const container = document.getElementById(keybinding.targetElementId)
? 'graph-canvas-container'
: keybinding.targetElementId
if (targetElementId) {
const container = document.getElementById(targetElementId)
if (!container?.contains(target)) { if (!container?.contains(target)) {
return return
} }