Comments (3)
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.
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.
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)
- Option to always use hard line breaks HOT 1
- Appending custom html in the editor
- Warning: componentWillUpdate has been renamed HOT 2
- read the length of value
- How can I update the paste value while pasting it on rich text editor.
- converting between HTML and MD
- Is there any documentation for this?
- Add React 18.x.x HOT 4
- Show URL link on links hover
- Autofocus not working as expected with React hook forms
- How to get WYSIWYG when images are used
- Many newlines causes editor to go into an infinite loop
- Command for new line
- Size of the bullet points has not changed along with texts font sizes
- Not working on JSX
- Jumping cursor on mobile HOT 1
- ReferenceError: window is not defined HOT 1
- Window is not defined error when run from Next HOT 2
- react-rte dependency issue with [email protected] HOT 2
- Not working react-rte HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-rte.