code-hike / codehike

Marvellous code walkthroughs
https://codehike.org
MIT License
4.39k stars 135 forks source link

Permissions on preset Iframe #320

Open yairhaimo opened 1 year ago

yairhaimo commented 1 year ago

Hi,

Is there a way to add permissions to the preset iframe? Like the example from codesandbox:

<iframe
  src="https://codesandbox.io/embed/new?codemirror=1"
  style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
  allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
  sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
></iframe>

If not, would you be open to a PR?

Amazing library btw!

yairhaimo commented 1 year ago

FYI - Sandpack added the allow attribute to their iframe a week ago but they have an open issue where it doesnt work: Sandpack preview's iframe is not setting allow with domain

yairhaimo commented 1 year ago

They fixed the issue but didnt publish a new version yet. I tested with latest main - they seem to have an error with the latest bundler (1.20.6) but if you change it to 1.20.1 it works correctly and asks for permissions.

Just FYI i guess