|
@@ -2846,7 +2846,24 @@ extension EditorPersonal: UIDocumentPickerDelegate, DocumentPickerDelegate, QLPr
|
|
|
|
|
|
//ETV
|
|
//ETV
|
|
extension EditorPersonal: UITextViewDelegate {
|
|
extension EditorPersonal: UITextViewDelegate {
|
|
- public func textViewDidChange(_ textView: UITextView) {
|
|
|
|
|
|
+ public func textViewDidChangeSelection(_ textView: UITextView) {
|
|
|
|
+ let cursorPosition = textView.caretRect(for: self.textFieldSend.selectedTextRange!.start).origin
|
|
|
|
+ let currentLine = Int(cursorPosition.y / self.textFieldSend.font!.lineHeight)
|
|
|
|
+ UIView.animate(withDuration: 0.3) {
|
|
|
|
+ print("MEME \(self.heightTextFieldSend.constant)")
|
|
|
|
+ if self.heightTextFieldSend.constant < 95.0 && currentLine >= 4 {
|
|
|
|
+ self.heightTextFieldSend.constant = 95.0
|
|
|
|
+ }
|
|
|
|
+ if currentLine < 4 && self.heightTextFieldSend.constant < 95.0 {
|
|
|
|
+ if (self.textFieldSend.text.count > 0) {
|
|
|
|
+ self.heightTextFieldSend.constant = self.textFieldSend.contentSize.height
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let countBreakLine = textView.text.split(separator: "\n").count
|
|
|
|
+ if countBreakLine > 1 && self.heightTextFieldSend.constant != CGFloat(40 + (countBreakLine * 18)) {
|
|
|
|
+ self.heightTextFieldSend.constant = CGFloat(40 + (countBreakLine * 18))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if allowTyping {
|
|
if allowTyping {
|
|
allowTyping = false
|
|
allowTyping = false
|
|
if isContactCenter && !fPinContacCenter.isEmpty {
|
|
if isContactCenter && !fPinContacCenter.isEmpty {
|
|
@@ -3101,11 +3118,6 @@ extension EditorPersonal: UITextViewDelegate {
|
|
if currentLine == 0 && text != "\n" {
|
|
if currentLine == 0 && text != "\n" {
|
|
self.heightTextFieldSend.constant = 40
|
|
self.heightTextFieldSend.constant = 40
|
|
} else if currentLine < 4 {
|
|
} else if currentLine < 4 {
|
|
-// DispatchQueue.main.async {
|
|
|
|
-// if (self.currentIndexpath != nil) {
|
|
|
|
-// self.tableChatView.scrollToRow(at: IndexPath(row: self.currentIndexpath!.row, section: self.currentIndexpath!.section), at: .none, animated: false)
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
if (text == "\n" && self.textFieldSend.text.count > 0) {
|
|
if (text == "\n" && self.textFieldSend.text.count > 0) {
|
|
self.heightTextFieldSend.constant = self.textFieldSend.contentSize.height + 18
|
|
self.heightTextFieldSend.constant = self.textFieldSend.contentSize.height + 18
|
|
}
|
|
}
|
|
@@ -3123,7 +3135,7 @@ extension EditorPersonal: UITextViewDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let countBreakLine = text.split(separator: "\n").count
|
|
|
|
|
|
+ let countBreakLine = textView.text.split(separator: "\n").count
|
|
if countBreakLine > 1 && self.heightTextFieldSend.constant != CGFloat(40 + (countBreakLine * 18)) {
|
|
if countBreakLine > 1 && self.heightTextFieldSend.constant != CGFloat(40 + (countBreakLine * 18)) {
|
|
self.heightTextFieldSend.constant = CGFloat(40 + (countBreakLine * 18))
|
|
self.heightTextFieldSend.constant = CGFloat(40 + (countBreakLine * 18))
|
|
}
|
|
}
|