@@ -124,6 +124,28 @@ export function Editor() {
124124 currentWorkflow . isSnapshotView
125125 )
126126
127+ /**
128+ * Partitions subBlocks into regular fields and standalone advanced-only fields.
129+ * Standalone advanced fields have mode 'advanced' and are not part of a canonical swap pair.
130+ */
131+ const { regularSubBlocks, advancedOnlySubBlocks } = useMemo ( ( ) => {
132+ const regular : typeof subBlocks = [ ]
133+ const advancedOnly : typeof subBlocks = [ ]
134+
135+ for ( const subBlock of subBlocks ) {
136+ const isStandaloneAdvanced =
137+ subBlock . mode === 'advanced' && ! canonicalIndex . canonicalIdBySubBlockId [ subBlock . id ]
138+
139+ if ( isStandaloneAdvanced ) {
140+ advancedOnly . push ( subBlock )
141+ } else {
142+ regular . push ( subBlock )
143+ }
144+ }
145+
146+ return { regularSubBlocks : regular , advancedOnlySubBlocks : advancedOnly }
147+ } , [ subBlocks , canonicalIndex . canonicalIdBySubBlockId ] )
148+
127149 // Get block connections
128150 const { incomingConnections, hasIncomingConnections } = useBlockConnections ( currentBlockId || '' )
129151
@@ -346,14 +368,14 @@ export function Editor() {
346368 ref = { subBlocksRef }
347369 className = 'subblocks-section flex flex-1 flex-col overflow-hidden'
348370 >
349- < div className = 'flex-1 overflow-y-auto overflow-x-hidden px-[8px] pt-[12px] pb-[8px]' >
371+ < div className = 'flex-1 overflow-y-auto overflow-x-hidden px-[8px] pt-[12px] pb-[8px] [overflow-anchor:none] ' >
350372 { subBlocks . length === 0 ? (
351373 < div className = 'flex h-full items-center justify-center text-center text-[#8D8D8D] text-[13px]' >
352374 This block has no subblocks
353375 </ div >
354376 ) : (
355377 < div className = 'flex flex-col' >
356- { subBlocks . map ( ( subBlock , index ) => {
378+ { regularSubBlocks . map ( ( subBlock , index ) => {
357379 const stableKey = getSubBlockStableKey (
358380 currentBlockId || '' ,
359381 subBlock ,
@@ -373,6 +395,10 @@ export function Editor() {
373395 )
374396 : undefined
375397
398+ const showDivider =
399+ index < regularSubBlocks . length - 1 ||
400+ ( ! hasAdvancedOnlyFields && index < subBlocks . length - 1 )
401+
376402 return (
377403 < div key = { stableKey } className = 'subblock-row' >
378404 < SubBlock
@@ -402,7 +428,7 @@ export function Editor() {
402428 : undefined
403429 }
404430 />
405- { index < subBlocks . length - 1 && (
431+ { showDivider && (
406432 < div className = 'subblock-divider px-[2px] pt-[16px] pb-[13px]' >
407433 < div
408434 className = 'h-[1.25px]'
@@ -416,30 +442,68 @@ export function Editor() {
416442 </ div >
417443 )
418444 } ) }
419- </ div >
420- ) }
421445
422- { /* Advanced Mode Toggle - Only show when block has standalone advanced-only fields */ }
423- { hasAdvancedOnlyFields && userPermissions . canEdit && (
424- < div className = 'flex items-center justify-center pt-[8px] pb-[4px]' >
425- < Button
426- variant = 'ghost'
427- size = 'sm'
428- onClick = { handleToggleAdvancedMode }
429- className = 'h-[28px] gap-[6px] px-[10px] text-[12px] text-[var(--text-secondary)] hover:text-[var(--text-primary)]'
430- >
431- { displayAdvancedOptions ? (
432- < >
433- < ChevronUp className = 'h-[14px] w-[14px]' />
434- Hide advanced fields
435- </ >
436- ) : (
437- < >
438- < ChevronDown className = 'h-[14px] w-[14px]' />
439- Show advanced fields
440- </ >
441- ) }
442- </ Button >
446+ { hasAdvancedOnlyFields && userPermissions . canEdit && (
447+ < div className = 'flex items-center gap-[10px] px-[2px] pt-[14px] pb-[12px]' >
448+ < div
449+ className = 'h-[1.25px] flex-1'
450+ style = { {
451+ backgroundImage :
452+ 'repeating-linear-gradient(to right, var(--border) 0px, var(--border) 6px, transparent 6px, transparent 12px)' ,
453+ } }
454+ />
455+ < button
456+ type = 'button'
457+ onClick = { handleToggleAdvancedMode }
458+ className = 'flex items-center gap-[6px] whitespace-nowrap font-medium text-[13px] text-[var(--text-secondary)] hover:text-[var(--text-primary)]'
459+ >
460+ { displayAdvancedOptions ? 'Hide advanced fields' : 'Show advanced fields' }
461+ < ChevronDown
462+ className = { `h-[14px] w-[14px] transition-transform duration-200 ${ displayAdvancedOptions ? 'rotate-180' : '' } ` }
463+ />
464+ </ button >
465+ < div
466+ className = 'h-[1.25px] flex-1'
467+ style = { {
468+ backgroundImage :
469+ 'repeating-linear-gradient(to right, var(--border) 0px, var(--border) 6px, transparent 6px, transparent 12px)' ,
470+ } }
471+ />
472+ </ div >
473+ ) }
474+
475+ { advancedOnlySubBlocks . map ( ( subBlock , index ) => {
476+ const stableKey = getSubBlockStableKey (
477+ currentBlockId || '' ,
478+ subBlock ,
479+ subBlockState
480+ )
481+
482+ return (
483+ < div key = { stableKey } className = 'subblock-row' >
484+ < SubBlock
485+ blockId = { currentBlockId }
486+ config = { subBlock }
487+ isPreview = { false }
488+ subBlockValues = { subBlockState }
489+ disabled = { ! userPermissions . canEdit }
490+ fieldDiffStatus = { undefined }
491+ allowExpandInPreview = { false }
492+ />
493+ { index < advancedOnlySubBlocks . length - 1 && (
494+ < div className = 'subblock-divider px-[2px] pt-[16px] pb-[13px]' >
495+ < div
496+ className = 'h-[1.25px]'
497+ style = { {
498+ backgroundImage :
499+ 'repeating-linear-gradient(to right, var(--border) 0px, var(--border) 6px, transparent 6px, transparent 12px)' ,
500+ } }
501+ />
502+ </ div >
503+ ) }
504+ </ div >
505+ )
506+ } ) }
443507 </ div >
444508 ) }
445509 </ div >
0 commit comments