Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions Telegram-Mac/InAppLinks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -347,31 +347,24 @@ var globalLinkExecutor:TextViewInteractions {
}

//modified.removeAttribute(TextInputAttributes.quote, range: modified.range)
modified.removeAttribute(TextInputAttributes.code, range: modified.range)
modified.removeAttribute(TextInputAttributes.monospace, range: modified.range)

let input = ChatTextInputState(attributedText: modified, selectionRange: 0 ..< modified.length)

if !modified.string.isEmpty {
pb.clearContents()
let rtf = try? modified.data(from: modified.range, documentAttributes: [NSAttributedString.DocumentAttributeKey.documentType : NSAttributedString.DocumentType.rtf])


pb.declareTypes([.rtf, .kInApp], owner: nil)

pb.declareTypes([.rtf, .kInApp, .string], owner: nil)
let encoder = AdaptedPostboxEncoder()
let encoded = try? encoder.encode(input)

if let data = encoded {
if let data = try? encoder.encode(input) {
pb.setData(data, forType: .kInApp)
}
if let rtf = rtf {
pb.setData(rtf, forType: .rtf)
pb.setString(modified.string, forType: .string)
return true
}
pb.setString(modified.string, forType: .string)
return true
}

return false
}, translate: { text, window in
let language = Translate.detectLanguage(for: text)
Expand Down