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

View File

@@ -11,7 +11,10 @@ export class KeybindingImpl implements Keybinding {
constructor(obj: Keybinding) {
this.commandId = obj.commandId
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 {

View File

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