question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If any of the styled(e.g <b>, <a>) HTML tags are used in default state, the continuing text comes under those tags only.

See original GitHub issue

If the state has <b>hello/<b> and then we type into the ContentEdittable, then all of the new text comes into the <b>hello new text</>. For new text to come out of the <b> the state should have some text written outside the <b>. E.g <b>hello/<b>.

Here is a codesandbox https://codesandbox.io/s/polished-hooks-xxkxj?file=/src/App.js:0-906

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lovasoacommented, Apr 20, 2020

Hello. I don’t think this is an issue with react-contenteditable. This is just how contenteditable works in the browser. It’s your application’s responsibility to handle that case.

0reactions
im-amircommented, Oct 6, 2022

I think a lucky day for me. 😃 Adding a contenteditable="false" to the custom HTML added will bring the continuing text out of this custom HTML. setMessage(`${message}<span class="variable-text" contenteditable="false">${variable}</span>`) image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tags used in HTML
This is a list of tags used in the HTML language. Each tag starts with a tag opener (a less than sign) and...
Read more >
HTML elements reference - HTML: HyperText Markup Language
It only contains text; tags within the element are ignored. ... until styled in some way using CSS (e.g. styling is directly applied...
Read more >
WebD2: Common HTML Tags - University of Washington
Tags in HTML are not case sensitive, but in XHTML all tags must be in lower case. Even when coding in HTML, you...
Read more >
HTML pre tag - W3Schools
The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces...
Read more >
Quick guide to modernize HTML formatting tags in your survey
Below is an example that recently came my way. Note how the HTML tags used to center the text (<center>) and to enlarge...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found