mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-24 14:02:11 -03:00
Add ESC key support to close fullscreen editor
Implemented an ESC key handler to allow users to close the fullscreen editor mode using the Escape key. Updated the editor button tooltip and the shortcuts documentation to reflect this new shortcut.
This commit is contained in:
@@ -799,6 +799,9 @@ async function createCanvasWidget(node: ComfyNode, widget: any, app: ComfyApp):
|
||||
openEditorBtn.textContent = "⛶";
|
||||
openEditorBtn.title = "Open in Editor";
|
||||
|
||||
// Remove ESC key listener when editor closes
|
||||
document.removeEventListener('keydown', handleEscKey);
|
||||
|
||||
setTimeout(() => {
|
||||
canvas.render();
|
||||
if (node.onResize) {
|
||||
@@ -807,6 +810,16 @@ async function createCanvasWidget(node: ComfyNode, widget: any, app: ComfyApp):
|
||||
}, 0);
|
||||
};
|
||||
|
||||
// ESC key handler for closing fullscreen editor
|
||||
const handleEscKey = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape' && isEditorOpen) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
closeEditor();
|
||||
log.info("Fullscreen editor closed via ESC key");
|
||||
}
|
||||
};
|
||||
|
||||
openEditorBtn.onclick = () => {
|
||||
if (isEditorOpen) {
|
||||
closeEditor();
|
||||
@@ -828,7 +841,10 @@ async function createCanvasWidget(node: ComfyNode, widget: any, app: ComfyApp):
|
||||
|
||||
isEditorOpen = true;
|
||||
openEditorBtn.textContent = "X";
|
||||
openEditorBtn.title = "Close Editor";
|
||||
openEditorBtn.title = "Close Editor (ESC)";
|
||||
|
||||
// Add ESC key listener when editor opens
|
||||
document.addEventListener('keydown', handleEscKey);
|
||||
|
||||
setTimeout(() => {
|
||||
canvas.render();
|
||||
|
||||
Reference in New Issue
Block a user