fixe code scrolling

This commit is contained in:
Ryan Nystrom
2017-06-26 21:36:18 -07:00
parent 2149a141ad
commit df3763434e
4 changed files with 9 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ final class IssueCommentCodeBlockCell: UICollectionViewCell, ListBindable, Colla
func bindViewModel(_ viewModel: Any) {
guard let viewModel = viewModel as? IssueCommentCodeBlockModel else { return }
let contentSize = viewModel.code.textViewSize(contentView.bounds.width)
let contentSize = viewModel.contentSize
scrollView.contentSize = contentSize
label.attributedText = viewModel.code.attributedText

View File

@@ -22,6 +22,12 @@ final class IssueCommentCodeBlockModel: NSObject, ListDiffable {
self.language = language
}
// MARK: Public API
var contentSize: CGSize {
return code.textViewSize(0)
}
// MARK: ListDiffable
func diffIdentifier() -> NSObjectProtocol {

View File

@@ -13,7 +13,7 @@ func bodyHeight(viewModel: Any, width: CGFloat) -> CGFloat {
return viewModel.textViewSize(width).height
} else if let viewModel = viewModel as? IssueCommentCodeBlockModel {
let inset = IssueCommentCodeBlockCell.scrollViewInset
return viewModel.code.textViewSize(0).height + inset.top + inset.bottom
return viewModel.contentSize.height + inset.top + inset.bottom
} else if viewModel is IssueCommentImageModel {
return 200.0
} else if viewModel is IssueCommentReactionViewModel {

View File

@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>88</string>
<string>89</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>org-appextension-feature-password-management</string>