fix: profile bio line break get trimmed issue. resolve #311

This commit is contained in:
CMK 2022-05-07 15:12:00 +08:00
parent b3c591dc33
commit 7380d28d74
2 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,10 @@ extension ProfileHeaderViewModel {
extension ProfileHeaderViewModel {
static func normalize(note: String?) -> String? {
guard let note = note?.trimmingCharacters(in: .whitespacesAndNewlines),!note.isEmpty else {
let _note = note?.replacingOccurrences(of: "<br>|<br />", with: "\u{2028}", options: .regularExpression, range: nil)
.replacingOccurrences(of: "</p>", with: "</p>\u{2029}", range: nil)
.trimmingCharacters(in: .whitespacesAndNewlines)
guard let note = _note, !note.isEmpty else {
return nil
}

View File

@ -953,6 +953,7 @@ extension ProfileViewController: ProfileHeaderViewDelegate {
viewModel.isUpdating.value = true
Task {
do {
// TODO: handle error
_ = try await viewModel.updateProfileInfo(
headerProfileInfo: profileHeaderViewModel.editProfileInfo,
aboutProfileInfo: profileAboutViewModel.editProfileInfo