File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 71
71
name: ' padding' ,
72
72
unit: ' px'
73
73
},
74
- fontSize: {
75
- name: ' font-size' ,
76
- unit: ' rem'
77
- },
78
74
fontWeight: {
79
75
name: ' font-weight' ,
80
76
unit: ' '
129
125
}
130
126
})
131
127
);
128
+ onDestroy (
129
+ settings .subscribe ([' fontSize' ], function (_key : string ) {
130
+ const remFontSize = settings .data .fontSize .value as number ;
131
+
132
+ const rootFontSize = parseFloat (getComputedStyle (document .documentElement ).fontSize );
133
+ const pixelValue = remFontSize * rootFontSize ;
134
+ const roundedPixelValue = Math .round (pixelValue ); // Round to nearest px
135
+ const roundedRemFontSize = roundedPixelValue / rootFontSize ;
136
+
137
+ document .body .style .setProperty (' --font-size' , roundedRemFontSize + " rem" );
138
+ })
139
+ )
132
140
onDestroy (
133
141
settings .subscribe (Object .keys (cssVarIndex ), function (key : string ) {
134
142
const name = cssVarIndex [key ].name ;
Original file line number Diff line number Diff line change 276
276
}
277
277
}
278
278
279
+ function fixScroll(event : Event ) {
280
+ const el = event .currentTarget as HTMLDivElement ;
281
+ if (el .scrollTop !== 0 ) {
282
+ el .scrollTop = 0 ;
283
+ }
284
+ }
285
+
279
286
// TODO:
280
287
// add custom background color
281
288
// add command K
350
357
<div class =" box-control" >
351
358
<BoxControl flowId ={$selectedFlowId } />
352
359
</div >
353
- <div class ="flow" class:customScrollbar ={settings .data .customScrollbar .value }>
360
+ <div class ="flow" class:customScrollbar ={settings .data .customScrollbar .value } on:scroll ={ fixScroll } >
354
361
<Flow on:focusFlow ={focusFlow } flowId ={$selectedFlowId } />
355
362
</div >
356
363
{/ key }
You can’t perform that action at this time.
0 commit comments