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:
diodiogod
2026-03-18 00:32:31 -03:00
parent 835d94a11d
commit 1edde25d75
6 changed files with 331 additions and 2 deletions

View File

@@ -118,7 +118,19 @@ export class CanvasLayersPanel {
this.setupControlButtons();
this.setupMasterVisibilityToggle();
// Dodaj listener dla klawiatury, aby usuwanie działało z panelu
const isEditableTarget = (target) => {
if (!(target instanceof HTMLElement)) {
return false;
}
if (target.isContentEditable) {
return true;
}
return !!target.closest('input, textarea, select, [contenteditable="true"]');
};
this.container.addEventListener('keydown', (e) => {
if (isEditableTarget(e.target)) {
return;
}
if (e.key === 'Delete' || e.key === 'Backspace') {
e.preventDefault();
e.stopPropagation();