mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-05-06 08:26:44 -03:00
Fix ComfyUI shortcut leaks in LayerForge
Technical details: - skip LayerForge canvas and panel shortcuts when focus is inside editable controls - patch ComfyUI ChangeTracker undoRedo so Ctrl/Cmd+Z does not leak to graph history while LayerForge owns the shortcut context - stop clipboard copy/cut/paste events from editable LayerForge UI from bubbling into ComfyUI node clipboard handlers - route widget-root Ctrl/Cmd+Z, Ctrl/Cmd+Y, and Ctrl/Cmd+Shift+Z through LayerForge canvas undo and redo when the widget is active
This commit is contained in:
@@ -94,6 +94,16 @@ export class CanvasInteractions {
|
||||
this.canvas.canvas.style.border = '';
|
||||
}
|
||||
}
|
||||
isEditableElement(target) {
|
||||
if (!(target instanceof HTMLElement)) {
|
||||
return false;
|
||||
}
|
||||
if (target.isContentEditable) {
|
||||
return true;
|
||||
}
|
||||
const editableSelector = 'input, textarea, select, [contenteditable="true"]';
|
||||
return !!target.closest(editableSelector);
|
||||
}
|
||||
setupEventListeners() {
|
||||
this.canvas.canvas.addEventListener('mousedown', this.onMouseDown);
|
||||
this.canvas.canvas.addEventListener('mousemove', this.onMouseMove);
|
||||
@@ -538,6 +548,9 @@ export class CanvasInteractions {
|
||||
this.interaction.isShiftPressed = true;
|
||||
if (e.key === 'Alt')
|
||||
this.interaction.isAltPressed = true;
|
||||
if (this.isEditableElement(e.target) || this.isEditableElement(document.activeElement)) {
|
||||
return;
|
||||
}
|
||||
// Check if canvas is focused before handling any shortcuts
|
||||
const shouldHandle = this.canvas.isMouseOver ||
|
||||
this.canvas.canvas.contains(document.activeElement) ||
|
||||
|
||||
Reference in New Issue
Block a user