Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HideMentions() not called when pasting text. #84

Closed
Footjy opened this issue Sep 17, 2018 · 3 comments
Closed

HideMentions() not called when pasting text. #84

Footjy opened this issue Sep 17, 2018 · 3 comments
Assignees

Comments

@Footjy
Copy link

Footjy commented Sep 17, 2018

Hey thank you for the lib,

When you type in @ the showMentionsList() method is called, so the list of possible mentions is displayed. But when pasting (or adding an emoji) there is no call to hideMentions() so the list remains.

I suggest calling hideMentions() in func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String).

Thanks,

@szweier
Copy link
Owner

szweier commented Oct 12, 2018

@Footjy I'm not sure I follow, if you were to paste or enter text after an@ it should keep the mention list opened and filter it by the test following the @. Then, depending on whether or not searchSpaces is enabled hideMentions should be called if a space was in that text. If you could elaborate on the steps taken or point out what I'm missing then I'll dive deeper into this. Apologies for the long delay in responding.

@szweier szweier self-assigned this Oct 12, 2018
@Footjy
Copy link
Author

Footjy commented Oct 25, 2018

@szweier Sorry for the late reply too I was away for a while.

I will explain more precisely the problem I see because reading myself again I admit it's not clear at all:

  • If I type in "@h"
  • Then I have some mentions displayed matching the "h" text
  • Then if I paste "abc" when my cursor is right after "h"
  • I get "@h abc" with my cursor after "abc"
  • I'm not sure what the problem is here, but I would expect showMentionsListWithString to be called with "h abc" but it's not and the list of suggested mentions remains
  • So then I tap one of the suggested mentions, let's say "henry"
    => the full name is inserted before the pasted text so I get "henry abc" and the cursor is after "henry ", and before " abc"

I hope you see the problem. I can reproduce these steps using your example app so I guess I'm using the lib correctly. Let me know if I can be of any help.

@szweier
Copy link
Owner

szweier commented Oct 28, 2018

@Footjy please try this branch #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants