From 9ad36303f6194b47b7b90b689632bcaaf97049ea Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 8 Dec 2025 18:52:31 -0800 Subject: [PATCH] [backport core/1.33] Fix copy not working when text is selected in dialogs (#7269) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Backport of #7166 to core/1.33 branch. - Fixes copy not working when text is selected in dialogs - Also includes workflow priority fix (workflow checked before parameters) ## Conflicts Resolved - `src/scripts/app.ts`: Accepted incoming changes for workflow priority logic ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7269-backport-core-1-33-Fix-copy-not-working-when-text-is-selected-in-dialogs-2c46d73d365081b690bfc9dc1548618e) by [Unito](https://www.unito.io) Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Co-authored-by: GitHub Action --- src/workbench/eventHelpers.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/workbench/eventHelpers.ts b/src/workbench/eventHelpers.ts index c6ffbac13..ab494a23d 100644 --- a/src/workbench/eventHelpers.ts +++ b/src/workbench/eventHelpers.ts @@ -3,6 +3,14 @@ import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' * Utility functions for handling workbench events */ +/** + * Check if there is selected text in the document. + */ +function hasTextSelection(): boolean { + const selection = window.getSelection() + return selection !== null && selection.toString().trim().length > 0 +} + /** * Used by clipboard handlers to determine if copy/paste events should be * intercepted for graph operations vs. allowing default browser behavior @@ -12,7 +20,7 @@ import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' * @returns true if copy paste events will be handled by target */ export function shouldIgnoreCopyPaste(target: EventTarget | null): boolean { - return ( + const isTextInput = target instanceof HTMLTextAreaElement || (target instanceof HTMLInputElement && ![ @@ -26,7 +34,6 @@ export function shouldIgnoreCopyPaste(target: EventTarget | null): boolean { 'reset', 'search', 'submit' - ].includes(target.type)) || - useCanvasStore().linearMode - ) + ].includes(target.type)) + return isTextInput || useCanvasStore().linearMode || hasTextSelection() }