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.

Overlapping styles and entities in convertToHTML not working when intersecting no style

See original GitHub issue

I just noticed the release of #43 which is super cool. Unfortunately, it does not work for intersections situations, which is problematic.

Here is my code:

convertToHTML({
    blockToHTML: { // I put this here to have <div> in my output instead of <p>
        unstyled: {
            start: '<div>',
            end: '</div>',
            empty: '<br>',
        }
    },
    entityToHTML: (entity, originalText) => {
        if (entity.type === 'link') {
            return {
                start: `<a href="${entity.data.url}" target="_blank">`,
                end: '</a>',
            }
        }
        return originalText
    }
})(contentState)

Overlapping styles

1. Add link

screen shot 2017-02-22 at 11 49 21

2. Add bold intersecting link

screen shot 2017-02-22 at 11 49 29

3. Result

<div>t<strong>e<</strong>a href="http://google.com" target="_blank">st test</a></div>

4. Render

screen shot 2017-02-22 at 11 51 33

Situation

  1. Style strictly inside link ✅ screen shot 2017-02-22 at 11 58 18

  2. Style over link ✅ screen shot 2017-02-22 at 11 58 11

  3. Style outside link ✅ screen shot 2017-02-22 at 11 58 21

  4. Style intersecting link 🔴

Intersect start

screen shot 2017-02-22 at 12 01 41

Result:

screen shot 2017-02-22 at 12 01 44

Code:

<div>t<strong>e<</strong>a href="http://google.com" target="_blank">st test te</a>st</div>

Intersect end

screen shot 2017-02-22 at 11 56 14

Result:

screen shot 2017-02-22 at 11 58 14

Code:

<div>te<a href="http://google.com" target="_blank">st test t<strong>e<</strong>/a>st</div>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:13

github_iconTop GitHub Comments

1reaction
benbriggscommented, Apr 27, 2017

Fix is landed in 1.4.6 - thanks so much for your help @liyantang!

1reaction
benbriggscommented, Apr 20, 2017

closed via #57 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elements overlapping each other in html page and external ...
I'm new to html and css and i'm having trouble with a lot of elements. The elements in my page keep overlapping each...
Read more >
How to Fix Web Pages That Have Overlapping Boxes
In most cases, a quick and easy change to your website's style sheet will fix the problem. 1. Add a margin if the...
Read more >
Developing with Oracle WebCenter Sites
11 Working with the WebCenter Sites Database. Types of Database Tables ... Using Methods and Tags to Program Data Management in Non-Asset Tables....
Read more >
B2H User's Guide (HTML 3 version) - FTP Directory Listing - IBM
Try running B2H again, this time using different options to vary the output format. For example, specify your own title and do not...
Read more >
LAMMPS Users Manual
6.4 Running multiple simulations from one input script. ... 6.12 Triclinic (non-orthogonal) simulation boxes. ... (atom style command).
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