CodeViewer
CodeViewer copied to clipboard
Fix font size and add line height
What's this PR do?
- [x] Fix font size by set viewport, that means we set point as font size.
- [x] Add line height, then we can calculate the code viewer's total height.
Here is an example, how set CodeViewer height:
CodeViewer(content: .constant(code), mode: CodeWebView.Mode(rawValue: configuration.language ?? "") ?? .text, darkTheme: .tomorrow_night_eighties, lightTheme: .tomorrow, isReadOnly: true, fontSize: 14, lineHeight: 1.3)
.frame(height: CGFloat(code.components(separatedBy: .newlines).count) * 14 * 1.3)