mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Composer: Trim attachement characters
This commit is contained in:
parent
47004d00c1
commit
09c09d5ea9
1 changed files with 7 additions and 7 deletions
|
@ -245,18 +245,18 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
range: NSRange(location: range.location, length: range.length))
|
||||
}
|
||||
|
||||
var attachmentsToRemove: [NSRange] = []
|
||||
statusText.enumerateAttribute(.attachment, in: range) { attachment, _, _ in
|
||||
var mediaAdded: Bool = false
|
||||
statusText.enumerateAttribute(.attachment, in: range) { attachment, range, _ in
|
||||
if let attachment = attachment as? NSTextAttachment, let image = attachment.image {
|
||||
attachmentsToRemove.append(range)
|
||||
mediasImages.append(.init(image: image, mediaAttachment: nil, error: nil))
|
||||
statusText.removeAttribute(.attachment, range: range)
|
||||
statusText.mutableString.deleteCharacters(in: range)
|
||||
mediaAdded = true
|
||||
}
|
||||
}
|
||||
if !attachmentsToRemove.isEmpty {
|
||||
|
||||
if mediaAdded {
|
||||
processMediasToUpload()
|
||||
for range in attachmentsToRemove {
|
||||
statusText.removeAttribute(.attachment, range: range)
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue