@@ -1931,50 +1931,7 @@ const WorkflowContent = React.memo(() => {
19311931 const [ displayNodes , setDisplayNodes ] = useState < Node [ ] > ( [ ] )
19321932
19331933 useEffect ( ( ) => {
1934- const handleKeyDown = ( e : KeyboardEvent ) => {
1935- if ( e . key === 'Shift' ) setIsShiftPressed ( true )
1936- }
1937- const handleKeyUp = ( e : KeyboardEvent ) => {
1938- if ( e . key === 'Shift' ) setIsShiftPressed ( false )
1939- }
1940- const handleFocusLoss = ( ) => {
1941- setIsShiftPressed ( false )
1942- }
1943- const handleVisibilityChange = ( ) => {
1944- if ( document . hidden ) {
1945- handleFocusLoss ( )
1946- }
1947- }
1948-
1949- window . addEventListener ( 'keydown' , handleKeyDown )
1950- window . addEventListener ( 'keyup' , handleKeyUp )
1951- window . addEventListener ( 'blur' , handleFocusLoss )
1952- document . addEventListener ( 'visibilitychange' , handleVisibilityChange )
1953-
1954- return ( ) => {
1955- window . removeEventListener ( 'keydown' , handleKeyDown )
1956- window . removeEventListener ( 'keyup' , handleKeyUp )
1957- window . removeEventListener ( 'blur' , handleFocusLoss )
1958- document . removeEventListener ( 'visibilitychange' , handleVisibilityChange )
1959- }
1960- } , [ ] )
1961-
1962- useEffect ( ( ) => {
1963- if ( isShiftPressed ) {
1964- document . body . style . userSelect = 'none'
1965- } else {
1966- document . body . style . userSelect = ''
1967- }
1968- return ( ) => {
1969- document . body . style . userSelect = ''
1970- }
1971- } , [ isShiftPressed ] )
1972-
1973- useEffect ( ( ) => {
1974- // Check for pending selection (from paste/duplicate), otherwise preserve existing selection
1975- const pendingSelection = pendingSelectionRef . current
1976- pendingSelectionRef . current = null
1977-
1934+ // Preserve selection state when syncing from derivedNodes
19781935 setDisplayNodes ( ( currentNodes ) => {
19791936 if ( pendingSelection ) {
19801937 // Apply pending selection and resolve parent-child conflicts
0 commit comments