You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @szweier , Awesome library you have made. I have integrated it in my code. Working fine. But just one feature I want, that is to remove mention in just one stroke while backspacing. I just tried the following code,
above code is working fine, when we tried to remove mention from last. But if we tried to remove it from the middle then app crashed.
Example. Suppose I have a note like this,
test @abc and @pqr
1] Now if I start to remove mention @pqr first, then it will remove in one stroke
2] But when I start to remove mention @abc first, then app crashes. Please help if anyone is having the solution for this
The text was updated successfully, but these errors were encountered:
Hi @szweier , Awesome library you have made. I have integrated it in my code. Working fine. But just one feature I want, that is to remove mention in just one stroke while backspacing. I just tried the following code,
if let mention = mentions |> mentionBeingEdited(at: range) {
mention |> clearMention()
/* let str = mentionsTextView.attributedText.string
let replaceStr = NSAttributedString(string:str.replacingOccurrences(of: mention.object.display, with: ""))
print("NAME ",mention.object.display)
print("RANGE ",range)
let str = mentionsTextView.attributedText.string
let replacedNameString = str.replacingOccurrences(of: mention.object.display, with: "")O
print("NAME AFTER REPLACE ",replacedNameString)
let (text, selectedRange) = mentionsTextView.attributedText
|> replace(charactersIn: NSRange(str.startIndex..., in: str), with: replacedNameString)
print("TEXT ",text.string)
print("selectedRange ",selectedRange)*/
// mentionsTextView.selectedRange = NSRange(mention.object.display.startIndex..., in: mention.object.display)
self.mentionsTextView.text = self.mentionsTextView.text.replacingOccurrences(of: mention.object.display, with: "")
print("self.mentionsTextView.text ",self.mentionsTextView.text)
print("mentionsTextView.attributedText ",mentionsTextView.attributedText)
print("RANGE ",NSRange(self.mentionsTextView.text.startIndex..., in: self.mentionsTextView.text))
print(mentions.count)
let (text, selectedRange) = mentionsTextView.attributedText
|> replace(charactersIn: NSRange(self.mentionsTextView.text.startIndex..., in: self.mentionsTextView.text), with: self.mentionsTextView.text)
/let (text, selectedRange) = mentionsTextView.attributedText
|> replace(charactersIn: range, with: text)/
mentionsTextView.attributedText = text
mentionsTextView.selectedRange = selectedRange
shouldChangeText = false
above code is working fine, when we tried to remove mention from last. But if we tried to remove it from the middle then app crashed.
Example. Suppose I have a note like this,
test @abc and @pqr
1] Now if I start to remove mention @pqr first, then it will remove in one stroke
2] But when I start to remove mention @abc first, then app crashes. Please help if anyone is having the solution for this
The text was updated successfully, but these errors were encountered: