@@ -390,6 +390,10 @@ export function NodeContent<CONTENT_PROPS = any>({
390390 flowVersionCheck === "legacy" ? ( [ ] as NodeContentHandleLegacyProps [ ] ) : ( [ ] as NodeContentHandleNextProps [ ] ) ;
391391
392392 const saveOriginalSize = ( ) => {
393+ const currentClassNames = nodeContentRef . current . classList ;
394+ if ( currentClassNames . contains ( "was-resized" ) && ! width && ! height ) {
395+ currentClassNames . remove ( "was-resized" ) ;
396+ }
393397 originalSize . current . width = nodeContentRef . current . offsetWidth as number ;
394398 originalSize . current . height = nodeContentRef . current . offsetHeight as number ;
395399 }
@@ -435,17 +439,17 @@ export function NodeContent<CONTENT_PROPS = any>({
435439
436440 if ( isResizable && ! resizingActive ) {
437441 if ( currentClassNames . contains ( "is-resizable-horizontal" ) ) {
438- nodeContentRef . current . classList . remove ( "is-resizable-horizontal" ) ;
442+ currentClassNames . remove ( "is-resizable-horizontal" ) ;
439443 }
440444 if ( currentClassNames . contains ( "is-resizable-vertical" ) ) {
441- nodeContentRef . current . classList . remove ( "is-resizable-vertical" ) ;
445+ currentClassNames . remove ( "is-resizable-vertical" ) ;
442446 }
443-
447+
444448 if ( resizeDirections . right ) {
445- nodeContentRef . current . classList . add ( "is-resizable-horizontal" ) ;
449+ currentClassNames . add ( "is-resizable-horizontal" ) ;
446450 }
447451 if ( resizeDirections . bottom ) {
448- nodeContentRef . current . classList . add ( "is-resizable-vertical" ) ;
452+ currentClassNames . add ( "is-resizable-vertical" ) ;
449453 }
450454 }
451455 } ) ; // need to be done everytime a property is changed and the element is re-rendered, otherwise the resizing class is lost
@@ -701,6 +705,10 @@ export function NodeContent<CONTENT_PROPS = any>({
701705 const nextHeight = resizeDirections . bottom
702706 ? ( height ?? originalSize . current . height ?? 0 ) + d . height
703707 : undefined ;
708+ if ( nextWidth || nextHeight ) {
709+ const currentClassNames = nodeContentRef . current . classList ;
710+ currentClassNames . add ( "was-resized" ) ;
711+ }
704712 if ( nextWidth ) {
705713 nodeContentRef . current . style . width = `${ nextWidth } px` ;
706714 }
0 commit comments