-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Unify mobile typography tokens across the app #3162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| included: | ||
| - ios/T3Code | ||
| - modules/t3-composer-editor/ios | ||
| - modules/t3-terminal/ios | ||
| - modules/t3-review-diff/ios | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,8 +275,8 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate { | |
| fileTint: "#737373" | ||
| ) | ||
| private var fontFamily = "DMSans_400Regular" | ||
| private var fontSize: CGFloat = 15 | ||
| private var lineHeight: CGFloat = 22 | ||
| private var fontSize: CGFloat = 14 | ||
| private var lineHeight: CGFloat = 20 | ||
| private var contentInsetVertical: CGFloat = 0 | ||
| private var shouldAutoFocus = false | ||
| private var didAutoFocus = false | ||
|
|
@@ -460,9 +460,19 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate { | |
| guard !isApplyingControlledValue else { | ||
| return | ||
| } | ||
| restoreBaseTypingAttributes() | ||
| emitSelection() | ||
| } | ||
|
|
||
| public func textView( | ||
| _ textView: UITextView, | ||
| shouldChangeTextIn range: NSRange, | ||
| replacementText text: String | ||
| ) -> Bool { | ||
| restoreBaseTypingAttributes() | ||
| return true | ||
| } | ||
|
|
||
| public func textViewDidBeginEditing(_ textView: UITextView) { | ||
| onComposerFocus() | ||
| } | ||
|
|
@@ -484,6 +494,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate { | |
| let targetSelection = requestedSelection ?? previousSelection | ||
| requestedSelection = nil | ||
| textView.selectedRange = displayRange(for: targetSelection) | ||
| restoreBaseTypingAttributes() | ||
| isApplyingControlledValue = false | ||
| updatePlaceholderVisibility() | ||
| emitContentSizeIfNeeded() | ||
|
|
@@ -556,7 +567,12 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate { | |
| size: image.size, | ||
| baselineOffset: baselineOffset | ||
| ) | ||
| return NSAttributedString(attachment: attachment) | ||
| let attributedAttachment = NSMutableAttributedString(attachment: attachment) | ||
| attributedAttachment.addAttributes( | ||
| baseAttributes(), | ||
| range: NSRange(location: 0, length: attributedAttachment.length) | ||
| ) | ||
| return attributedAttachment | ||
| } | ||
|
|
||
| private func renderChip( | ||
|
|
@@ -660,11 +676,18 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate { | |
| let font = UIFont(name: fontFamily, size: fontSize) | ||
| ?? UIFont.systemFont(ofSize: fontSize) | ||
| textView.font = font | ||
| textView.typingAttributes = baseAttributes() | ||
| restoreBaseTypingAttributes() | ||
| placeholderLabel.font = font | ||
| setNeedsLayout() | ||
| } | ||
|
|
||
| private func restoreBaseTypingAttributes() { | ||
| guard textView.markedTextRange == nil else { | ||
| return | ||
| } | ||
| textView.typingAttributes = baseAttributes() | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Selection sync skips typing restoreMedium Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 124e471. Configure here. |
||
| private func applyTheme() { | ||
| textView.textColor = UIColor(composerHex: theme.text) ?? .label | ||
| placeholderLabel.textColor = UIColor(composerHex: theme.placeholder) ?? .placeholderText | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline chips clip line height
Medium Severity
Applying
baseAttributes()to inline attachments inmakeAttachmentStringforces a 20pt line height on token glyphs. This conflicts withrenderChipstill drawing 24pt tall chip images, causing file/skill chips to clip or misalign in the composer.Reviewed by Cursor Bugbot for commit 124e471. Configure here.