Skip to content

Commit

Permalink
🐛 Fix LuminareTextEditor wrongly consumed space
Browse files Browse the repository at this point in the history
  • Loading branch information
KrLite committed Dec 18, 2024
1 parent 4f5cae5 commit 19cbe69
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/Luminare/Components/LuminareTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public struct LuminareTextEditor: View {
@Environment(\.isEnabled) private var isEnabled
@Environment(\.font) private var font
@Environment(\.luminareAnimationFast) private var animationFast
@Environment(\.luminareMinHeight) private var minHeight
@Environment(\.luminareHorizontalPadding) private var horizontalPadding

// MARK: Fields
Expand All @@ -23,6 +24,7 @@ public struct LuminareTextEditor: View {
@Binding private var selection: Any? // Handle os versions below macOS 15.0

@State private var isHovering: Bool = false
@State private var containerSize: CGSize = .zero

// MARK: Initializers

Expand Down Expand Up @@ -65,15 +67,21 @@ public struct LuminareTextEditor: View {
TextEditor(text: $text)
}
}
.fixedSize(horizontal: false, vertical: true)
.scrollDisabled(true)
.padding(.horizontal, horizontalPadding)
.padding(.vertical, 14)
.frame(minHeight: max(minHeight, containerSize.height))
}
.scrollContentBackground(.hidden)
.font(font ?? .body)
.modifier(LuminareHoverable())
.luminareAspectRatio(unapplying: true)
.luminareHorizontalPadding(0)
.onGeometryChange(for: CGSize.self) { proxy in
proxy.size
} action: { newValue in
containerSize = newValue
}
}

@available(macOS 15.0, *)
Expand Down

0 comments on commit 19cbe69

Please sign in to comment.