Skip to content

Commit 876712f

Browse files
authored
Attachment selection reset (#293)
* Moved code to deleteAttachments after textStorage editing has ended * Reset selected range when attachment selectionView is removed via hitTest
1 parent 71a0d89 commit 876712f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: Proton/Sources/Swift/Attachment/Attachment.swift

+5
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ open class Attachment: NSTextAttachment, BoundsObserving {
322322
self.isAsyncRendered = true
323323
self.containerEditorView?.asyncAttachmentRenderingDelegate?.didRenderAttachment(self, in: containerEditorView)
324324
}
325+
selectionView.onRemoveFromSuperview = { [weak self] in
326+
guard let self,
327+
let range = rangeInContainer()?.nextPosition else { return }
328+
self.containerEditorView?.selectedRange = range
329+
}
325330
}
326331

327332
private func setup(image: AttachmentImage) {

0 commit comments

Comments
 (0)