@@ -382,6 +382,8 @@ struct ContentView: View {
382382 return colorScheme == . light ? Color . primary : Color . white
383383 }
384384
385+ @State private var viewHeight : CGFloat = 0
386+
385387 var body : some View {
386388 let buttonBackground = colorScheme == . light ? Color . white : Color . black
387389 let navHeight : CGFloat = 68
@@ -394,24 +396,27 @@ struct ContentView: View {
394396 Color ( colorScheme == . light ? . white : . black)
395397 . ignoresSafeArea ( )
396398
397- TextEditor ( text: Binding (
398- get: { text } ,
399- set: { newValue in
400- // Ensure the text always starts with two newlines
401- if !newValue. hasPrefix ( " \n \n " ) {
402- text = " \n \n " + newValue. trimmingCharacters ( in: . newlines)
403- } else {
404- text = newValue
399+
400+ TextEditor ( text: Binding (
401+ get: { text } ,
402+ set: { newValue in
403+ // Ensure the text always starts with two newlines
404+ if !newValue. hasPrefix ( " \n \n " ) {
405+ text = " \n \n " + newValue. trimmingCharacters ( in: . newlines)
406+ } else {
407+ text = newValue
408+ }
405409 }
406- }
407- ) )
410+ ) )
408411 . background ( Color ( colorScheme == . light ? . white : . black) )
409412 . font ( . custom( selectedFont, size: fontSize) )
410413 . foregroundColor ( colorScheme == . light ? Color ( red: 0.20 , green: 0.20 , blue: 0.20 ) : Color ( red: 0.9 , green: 0.9 , blue: 0.9 ) )
411414 . scrollContentBackground ( . hidden)
412415 . scrollIndicators ( . never)
413416 . lineSpacing ( lineHeight)
414417 . frame ( maxWidth: 650 )
418+
419+
415420 . id ( " \( selectedFont) - \( fontSize) - \( colorScheme) " )
416421 . padding ( . bottom, bottomNavOpacity > 0 ? navHeight : 0 )
417422 . ignoresSafeArea ( )
@@ -426,13 +431,20 @@ struct ContentView: View {
426431 Text ( placeholderText)
427432 . font ( . custom( selectedFont, size: fontSize) )
428433 . foregroundColor ( colorScheme == . light ? . gray. opacity ( 0.5 ) : . gray. opacity ( 0.6 ) )
429- // .padding(.top, 8)
430- // .padding(.leading, 8)
434+ // .padding(.top, 8)
435+ // .padding(.leading, 8)
431436 . allowsHitTesting ( false )
432437 . offset ( x: 5 , y: placeholderOffset)
433438 }
434439 } , alignment: . topLeading
435440 )
441+ . onGeometryChange ( for: CGFloat . self) { proxy in
442+ proxy. size. height
443+ } action: { height in
444+ viewHeight = height
445+ }
446+ . contentMargins ( . bottom, viewHeight / 4 )
447+
436448
437449 VStack {
438450 Spacer ( )
@@ -1399,4 +1411,4 @@ extension NSView {
13991411
14001412#Preview {
14011413 ContentView ( )
1402- }
1414+ }
0 commit comments