Giter Club home page Giter Club logo

Comments (3)

brijeshb42 avatar brijeshb42 commented on May 28, 2024

This behavior is the default in draft js. One workaround can be to call toggleLink twice, once with the selection and the next with selection collapsed. Or maybe there's a better way.

from medium-draft.

codeKonami avatar codeKonami commented on May 28, 2024

Maybe the solution would be to do the same as for the bold and italic.

You create your link, if you continue to write right after link, the link expands.
If you select a part of the link, the toolbar shows up the link button is activated.
If you click on the link button, you unlink the section you've selected.

With this solution, you can't modify the URL once it has been created. You'll need to select the entire link, unlink it, and click again to create a new link. But I don't think it is too weird.

What do you think ?

from medium-draft.

brijeshb42 avatar brijeshb42 commented on May 28, 2024

But Bold, Italic also continues to be extended if it is at the last. If you make your last word B/I, and then continue writing in same or new line, new characters are also bold.

A solution could be to detect a space and toggle B I U, Link automatically or maybe toggle it anyway.

Current process is nothing but what draft docs state, RichUtils.toggleInlineStyle and RichUtils.toggleLink. But this needs to be modified so that new characters don't carry over the style just like I have modified RETURN presses so that new lines after header blocks are always unstyled.

from medium-draft.

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.