GithubHelp home page GithubHelp logo

Comments (7)

hellendag avatar hellendag commented on April 27, 2024

For hashtags, you don't need to create entities at all, since there is no metadata -- there is just text. You can just use a decorator strategy/component pair, without needing to use findEntityRanges. This is what we do for hashtags in Facebook inputs.

from draft-js.

ben-davis avatar ben-davis commented on April 27, 2024

That's what I initially was doing, but the component in the pair just receives the text as a component in its children. I could read React.Children.only(this.props.children).props.text, but reading into the props of an undocumented API seems reckless. I should mention I need to read the text of the tag for routing and other functionality.

from draft-js.

hellendag avatar hellendag commented on April 27, 2024

Ahh, interesting. I think it would be fine to make a change to pass the full decorated text as a prop to the decorator component.

I can't think of any reason not to, and am a little surprised I hadn't already. :)

from draft-js.

hellendag avatar hellendag commented on April 27, 2024

Do you want to create a PR to add this?

from draft-js.

ben-davis avatar ben-davis commented on April 27, 2024

Yeah for sure, been trying to find time to do it. This weekend hopefully.

from draft-js.

hellendag avatar hellendag commented on April 27, 2024

Sorry @ben-davis, wanted to go ahead and get a PR out there now that we have another issue open on it. :)

from draft-js.

hellendag avatar hellendag commented on April 27, 2024

Resolved by #144.

from draft-js.

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.