Carbon: Snippet Embed Feature Requests (iframe)

Created on 9 Jun 2020  ·  13Comments  ·  Source: carbon-app/carbon

It would really nice if we had settings options to turn off line wrapping for iframe embeds as well as auto height to be the height of the content (code), instead of a fixed width.

This would be nice for blogs articles & write ups etc.

Most helpful comment

No worries! Thanks for clarifying, @GraphicOwls. I opened a PR already that does exactly what you are describing (#1041), but wanted to be 100% before merging. 🙂

All 13 comments

@GraphicOwls have you tried disabled "Auto-adjust width" in the Settings? You can just the ?wa= query param to adjust this setting in your iFrame URL

As for the width of your iFrame, I believe that is controlled in user-land. You can set the width of the iFrame yourself like:

<iframe src="<carbon url goes here>" width="800" height="200"></iframe>

Can you say more what you mean?

@GraphicOwls going to close mark this to be closed, but feel free to chime in if I haven't answered your question.

⚠️ This has been marked to be closed in 7 days.

I was talking about height and you're talking about width. It didn't answer my question.

Here is a video to make it easier and quicker @mfix22 :
http://cloud.graphicowls.com/hFjZ2TV

@GraphicOwls have you tried disabled "Auto-adjust width" in the Settings? You can just the ?wa= query param to adjust this setting in your iFrame URL

I am not sure what you mean here either..

@GraphicOwls I just had a chance to watch the screen recording. Are you asking that the Copy iFrame button set the height according to the height of the container? If so, I'd be happy to accept a PR to do that — right now these values are hard coded (https://github.com/carbon-app/carbon/blob/main/components/CopyMenu.js#L14).

The reason it is hard coded as 473px right now is to make it obvious that developers need to adjust this value themselves, but I would be happy to adjust them according to Carbon container size at time of copy.

That said, if you are asking for a dynamic height capability, iframes are not capable of that — they must be provided a static height property (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe).

@mfix22 Yes that's exactly right! Would be awesome if it could set the height according to the height of the container at the time of copy. Thanks a lot! :)

@mfix22 By the way Im still a noob with Javascript. Not too comfortable on doing that yet lol.

No worries! Thanks for clarifying, @GraphicOwls. I opened a PR already that does exactly what you are describing (#1041), but wanted to be 100% before merging. 🙂

Any updates to this? (just curious)

It's done!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qw-in picture qw-in  ·  3Comments

jgierer12 picture jgierer12  ·  5Comments

JoeCodesStuff picture JoeCodesStuff  ·  5Comments

jakedex picture jakedex  ·  5Comments

chrispetrou picture chrispetrou  ·  3Comments