Git Product home page Git Product logo

Comments (3)

joepio avatar joepio commented on June 22, 2024

I don't think this is a bug, since the current behavior is what most users will expect. The Draft.js team at Facebook chose this behavior, since most text editors (such as Microsoft Word and Pages) use it as well.

I suggest adding an optional resetOnNewline setting that defaults to the current behavior.

from react-rte.

sstur avatar sstur commented on June 22, 2024

I've found this is what some users expect but others expect the opposite. Especially with some inline styles, like code/monospace, users expect insertion of a new block to signify they are done writing that snippet of code.

In my own research, I've found that editors who treat a return more like a line break (Word, Pages, Draft demo) do not tend to reset inline styles. But editors which have clear paragraph blocks, like Quip, give you a fresh start when you start a fresh block. When using Quip users find this behavior intuitive, but admittedly this is far less common than the MSWord behavior.

It sounds reasonable to make an option for this, but I'd like, by default, to reset inline styles for a new block for a few reasons:

  • I can think of far less use cases where you'd want to keep the inline styles of your previous block, and far more cases where you'd want to start a fresh block in a normal state. I think it's important in UX to do what users expect, but equally important to make the user's life easy by requiring less clicks for the most common cases.
  • There are well-known keystrokes for some inline styles (bold/italic) that users might use to manually turn off the style when they don't want it in a new block. But others (inline code) do not have well-known keyboard shortcuts so it would require the user to reach for the mouse in the more common case of wanting a clean new block.
  • When thinking about Word, Pages and Quip from a UX perspective, I'm far more inclined to model my work after Quip, which I think is amazing and modern, than the more traditional products of the last decade.

From a technical standpoint, I've checked into it and there are some complications that will make this a little difficult to solve. But I do think solving it is the right thing to do.

from react-rte.

joepio avatar joepio commented on June 22, 2024

I must say you make a compelling argument, and I personally find the reset on newline behavior preferable.

FYI: There has been some discussion on this topic in the Draft.js repo as well, where somebody suggested using a handleReturn prop function.

from react-rte.

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.