Make the text selectable (for copying and lookup), after description is shown

This commit is contained in:
2024-02-25 11:42:45 +01:00
parent c81eb49364
commit 2bebe1e167

View File

@@ -14,20 +14,26 @@ struct WordView: View {
@EnvironmentObject var model: WordAXModelView
@Environment(\.colorScheme) var colorScheme
var body: some View {
let wordText = Text(word.name)
.font(.title)
.bold()
VStack {
Text(word.name)
.font(.title)
.bold()
if word.shown && word.lastSeenOn != nil {
Text(model.getDateFormatter().string(from: word.lastSeenOn!))
}
if showDescription {
wordText
.textSelection(.enabled)
Divider()
.background(colorScheme == .light ? Color.black : Color.white)
.padding(.horizontal)
Text(word.description)
.multilineTextAlignment(.center)
} else {
wordText
}
}
.padding([.horizontal, .top])