How to emulate an input tag?
See original GitHub issueThis may be considered a feature request but it’s more of a question really.
As discussed on Slack, I’d like to make an Editor
behave like an input
tag.
I think a lot of that boils down to having the content continually scroll to right, and not wrapping.
I’ve tried draft-js-single-line-plugin
but the text still wraps on long lines.
I initially tried creating a decorator which didn’t quite work as I wanted, and later got a bit closer with the following CSS:
.public-DraftEditor-content {
height: 40px;
overflow: scroll;
padding-bottom: 10px; /* hide the scrollbar */
}
.public-DraftStyleDefault-block > span {
white-space: nowrap;
}
This still isn’t quite right and I don’t feel good about styling these elements, but besides that it just seems like there must be a better way.
This could be considered a duplicated of #397, but hopefully this is a more comprehensive report.
Thanks in advance.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to Simulate Typing in an Input Box with Javascript?
You can use setTimeout and add one character each time like this : var input = document.querySelectorAll("input")[1]; input.select(); // you ...
Read more >Simulate an input() dialog box - Brython
In this example, we use a generic function dialog() that handles the entry of an integer value in an INPUT tag. It loops...
Read more >How to simulate pressing enter in HTML text input with Selenium
How to simulate pressing enter in HTML text input with Selenium ? · Import webdriver from selenium · Initialize webdriver path · Open...
Read more >Input Field Interaction using Interactive Components in Figma
A detailed video showing how to create an input field or text box using ... Tags : Input Field using Interactive Components in...
Read more >HTMLElement: input event - Web APIs | MDN
For <textarea> and <input> elements that accept text input ( type=text , type=tel , etc.), the interface is InputEvent ; for others, the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jisaacks Not sure if that’s still relevant for you but I managed to make it scroll on paste. Here’s the fiddle for it: https://jsfiddle.net/orir/m6z0xn4r/317/
@stopachka I used your solution, but this had unexpected consequences in IE.
overflow: hidden
causes something calledhasLayout
which is specific to IE that adds resize handles and border to the element.I know this is a stretch, but is there any other way you might think of to achieve this also in IE?
Edit: A working fiddle in IE - https://jsfiddle.net/m6z0xn4r/319/ to anyone wishing to investigate/experiment
Here’s one with the scrollbar hidden. I realize it’s an old version of draft.js. https://jsfiddle.net/ufa2hyp9/