mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Set the post editor font in the updateUIView method (#237)
* Wrap becomeFirstResponder in async dispatch This fixes issues when we’re updating the responder chain every time SwiftUI refreshes the view, which can have unpredictable side effects. * Set the font in the updateUIView method * Bump build number and update change log
This commit is contained in:
parent
1361ff7586
commit
d46eb639ad
@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- [Mac] Fixed a bug where alerts weren't presented for login errors.
|
- [Mac] Fixed a bug where alerts weren't presented for login errors.
|
||||||
- [Mac] Fixed some build warnings in the project.
|
- [Mac] Fixed some build warnings in the project.
|
||||||
- [Mac] Bumped WriteFreely package to v0.3.6 to handle decoding of fractional seconds in dates.
|
- [Mac] Bumped WriteFreely package to v0.3.6 to handle decoding of fractional seconds in dates.
|
||||||
|
- [iOS] Fixed a bug where posts were always shown in serif, even if the post was published with another font.
|
||||||
|
|
||||||
## [1.0.13-ios] - 2022-11-13
|
## [1.0.13-ios] - 2022-11-13
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@
|
|||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||||
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
|
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 691;
|
CURRENT_PROJECT_VERSION = 693;
|
||||||
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
|
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
|
||||||
@ -1081,7 +1081,7 @@
|
|||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||||
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
|
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 691;
|
CURRENT_PROJECT_VERSION = 693;
|
||||||
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
|
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
|
||||||
@ -1224,7 +1224,7 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
|
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 691;
|
CURRENT_PROJECT_VERSION = 693;
|
||||||
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
INFOPLIST_FILE = iOS/Info.plist;
|
INFOPLIST_FILE = iOS/Info.plist;
|
||||||
@ -1250,7 +1250,7 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
|
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 691;
|
CURRENT_PROJECT_VERSION = 693;
|
||||||
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
DEVELOPMENT_TEAM = TPPAB4YBA6;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
INFOPLIST_FILE = iOS/Info.plist;
|
INFOPLIST_FILE = iOS/Info.plist;
|
||||||
|
@ -17,17 +17,12 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
textField.delegate = context.coordinator
|
textField.delegate = context.coordinator
|
||||||
|
|
||||||
textField.isEditable = true
|
textField.isEditable = true
|
||||||
textField.font = UIFont.preferredFont(forTextStyle: .body)
|
|
||||||
textField.isSelectable = true
|
textField.isSelectable = true
|
||||||
textField.isUserInteractionEnabled = true
|
textField.isUserInteractionEnabled = true
|
||||||
textField.isScrollEnabled = false
|
textField.isScrollEnabled = false
|
||||||
textField.backgroundColor = UIColor.clear
|
textField.backgroundColor = UIColor.clear
|
||||||
textField.smartDashesType = .no
|
textField.smartDashesType = .no
|
||||||
|
|
||||||
let font = textStyle
|
|
||||||
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
|
||||||
textField.font = fontMetrics.scaledFont(for: font)
|
|
||||||
|
|
||||||
if nil != onDone {
|
if nil != onDone {
|
||||||
textField.returnKeyType = .next
|
textField.returnKeyType = .next
|
||||||
}
|
}
|
||||||
@ -41,8 +36,14 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
uiView.text = self.text
|
uiView.text = self.text
|
||||||
}
|
}
|
||||||
|
|
||||||
if uiView.window != nil, isEditing {
|
let font = textStyle
|
||||||
uiView.becomeFirstResponder()
|
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
||||||
|
uiView.font = fontMetrics.scaledFont(for: font)
|
||||||
|
|
||||||
|
if uiView.window != nil && isEditing {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
uiView.becomeFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UITextViewWrapper.recalculateHeight(view: uiView, result: $calculatedHeight)
|
UITextViewWrapper.recalculateHeight(view: uiView, result: $calculatedHeight)
|
||||||
|
Loading…
Reference in New Issue
Block a user