Giter VIP home page Giter VIP logo

Comments (4)

BasThomas avatar BasThomas commented on September 22, 2024 2

Is this completely done in #15? If so, we can close this :)

from messageviewcontroller.

nathantannar4 avatar nathantannar4 commented on September 22, 2024 1

I've been playing around off and on with different ideas. With my autocomplete solution I primarily rely on attributed strings, so I can add color and what not. I did initially run into your problem you mentioned but resolved it by always forcing the typingAttributes to be reset to a default before text is changed. But now the problem of [@highlighted][some other stuff] was present.

Looking at Facebook, WhatsApp, etc. it appears that when a user try to delete @mention text the entire autocomplete text is deleted. So that is the same approach I took.

Rather than keeping track of the prefix inserted like you mentioned I overcame this by applying a custom NSAttributedStringKey attribute to autocompleted text. This mean that if a range with that attribute ever is about to be removed, delete the entire substring.

Still a few bugs to work on but its working with this approach. Any problems you foresee with this?

demo

from messageviewcontroller.

rnystrom avatar rnystrom commented on September 22, 2024

@nathantannar4 love the idea! Practically though, I think it'll be pretty difficult to pull off b/c what would happen if you autocomplete something but then go back and edit it. Imagine:

  • Search for @
  • Tap "rnystrom", inserting "@rnystrom "
  • Then backspace to "@rnyst"
  • Type "abc" to have "@rnystabc"

You'd expect the full string to apply the prefix style, right?

Also needing to track when the prefix isn't inserted.

If you've got ideas on how to tackle this, I'm all ears! I think it'd be really slick šŸ˜Ž

from messageviewcontroller.

rnystrom avatar rnystrom commented on September 22, 2024

Super cool! Iā€™d love this.

Sent with GitHawk

from messageviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.