Coder Social home page Coder Social logo

Comments (1)

hellendag avatar hellendag commented on April 23, 2024 1

Awesome screenshots. This looks really nice.

Since the browser can't maintain both cursor positions simultaneously, there's no native solution for this. In Notes, I have tried two different approaches:

  1. What you have here, which just moves the selection over to the flyout. Here, one would just hope that the user isn't too thrown off by the selection disappearing. This is what is currently in production on Notes. I basically punted on it since people didn't seem too confused when using it.
  2. My initial approach, which I replaced with the option above. Create a "fake" entity, either a "LINK_PLACEHOLDER" (or something like that) or a "LINK" with an empty href. In your decorator component, then you would check whether it's a fake link, and decorate it in some way to indicate that it is the target text. If you accept the link entry, replace the entity or merge in the data with the new href. If you reject the link entry, you'd just set the entity back to null on that range.

Inline styles could work there too. You'd just remove the style after accepting or canceling the link entry.

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.