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.

Text content not always editable

See original GitHub issue

Hi @artf,

I’ve noticed that if I add a component that contains a combination of text and an <a> tag, the text is not editable like it normally is. If I replace the <a> tag with a <span>, then I can edit the text just fine. Here’s something to illustrate what I mean (note the last 2 lines of code to toggle between a broken example and a working example): https://jsfiddle.net/wycrpkay/3/. This may be happening with tags other than <a>, but that’s the only one I’ve noticed to be problematic so far.

It looks to me like the component is getting parsed as the default component type instead of a text component, but I cannot figure out why the presence of the <a> tag (and not other tags) would cause this to happen. I saw that ComponentText.js does not have an isComponent function, so I’m not quite understanding how that distinction is made. I’m going to keep looking into this, but would appreciate any thoughts you may have on why this would be happening.

Thanks!

EDIT: So I found ParserHtml.parseNode()…adding comp.type != 'link' to the if statement starting on line 183 seems to do what I want: if(comp.type != 'text' && comp.type != 'textnode' && comp.type != 'link' && c.textTags.indexOf(comp.tagName) < 0 ){ I don’t feel great about that change though. I feel like I want those checks to just see if all of the children are editable (comp.get("editable")) instead of all the text/textnode/link checks, but that doesn’t seem possible here since we just have simple component objects (looks like it’s just whatever is returned from the isComponent functions). Not sure what to do…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
artfcommented, Dec 1, 2017

Thanks Daniel, I agree with you and will take care of your suggestions. I just would like to point out, for the 4th case, that you can also indicate explicitly to the editor where is a text component

<div data-gjs-type="text">
     Some textnode
     <div>Text to edit</div>
     <ul>...</ul>
</div>
2reactions
artfcommented, Dec 1, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Make the Text Input Non-Editable - W3docs
In this snippet, you can find two methods of making a text input non-editable. Use either the HTML “readonly” attribute or add the...
Read more >
contenteditable - HTML: HyperText Markup Language | MDN
Chrome Edge contenteditable Full support. ChromeYes. Toggle history Full suppo... contenteditable="caret". Experimental Full support. ChromeYes. Toggle history Full suppo... contenteditable="events". Experimental Full support. ChromeYes. Toggle history...
Read more >
Not able to edit content in textbox when it is derived from this ...
This is normal because when you provide value props in react. The textarea will gain the value your provided after each render.
Read more >
Unable to edit text in a text layer?!? - Adobe Support Community
Hi Cocobug123,. It appears that you are trying to control Legacy Text with the Essential Graphics panel. That won't work. Please recreate the...
Read more >
Text Elements Suddenly Not Editable - Bugs - Forum | Webflow
(3) It may be helpful to disable the browser cache so that updated files are always downloaded instead of pulling old content from...
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