@@ -1082,13 +1082,21 @@ function Playground() {
10821082 let previewRef : HTMLDivElement | undefined
10831083 let pick : HTMLInputElement | undefined
10841084
1085+ const sample = ( ctrl : CSSControl ) => {
1086+ if ( ! ctrl . group . startsWith ( "Markdown" ) ) return ctrl . selector
1087+ return ctrl . selector . replace (
1088+ '[data-component="markdown"]' ,
1089+ '[data-component="text-part"] [data-component="markdown"]' ,
1090+ )
1091+ }
1092+
10851093 /** Read computed styles from the DOM to seed slider defaults */
10861094 const readDefaults = ( ) => {
10871095 const root = previewRef
10881096 if ( ! root ) return
10891097 const next : Record < string , string > = { }
10901098 for ( const ctrl of CSS_CONTROLS ) {
1091- const el = root . querySelector ( ctrl . selector ) as HTMLElement | null
1099+ const el = ( root . querySelector ( sample ( ctrl ) ) ?? root . querySelector ( ctrl . selector ) ) as HTMLElement | null
10921100 if ( ! el ) continue
10931101 const styles = getComputedStyle ( el )
10941102 // Use bracket access — getPropertyValue doesn't resolve shorthands
@@ -1439,9 +1447,14 @@ function Playground() {
14391447 }
14401448 setApplyResult ( lines . join ( "\n" ) )
14411449
1442- if ( ok > 0 ) {
1443- // Clear overrides — values are now in source CSS, Vite will HMR.
1444- resetCss ( )
1450+ if ( ok === edits . length ) {
1451+ batch ( ( ) => {
1452+ for ( const ctrl of controls ) {
1453+ setDefaults ( ctrl . key , css [ ctrl . key ] ! )
1454+ setCss ( ctrl . key , undefined as any )
1455+ }
1456+ } )
1457+ updateStyle ( )
14451458 // Wait for Vite HMR then re-read computed defaults
14461459 setTimeout ( readDefaults , 500 )
14471460 }
0 commit comments