Skip to content

fix: enable OpenProcessing sketch embeds on detail pages#1310

Open
rushdarshan wants to merge 3 commits intoprocessing:mainfrom
rushdarshan:fix/openprocessing-embed-rendering
Open

fix: enable OpenProcessing sketch embeds on detail pages#1310
rushdarshan wants to merge 3 commits intoprocessing:mainfrom
rushdarshan:fix/openprocessing-embed-rendering

Conversation

@rushdarshan
Copy link
Copy Markdown

Description

OpenProcessing sketch embeds on sketch detail pages failing to render due to missing iframe security attributes.

Root Cause

iframe elements lacked \sandbox\ and \�llow\ attributes, blocking OpenProcessing embed scripts from executing.

Solution

Added proper iframe security and permission attributes:

  • sandbox="allow-scripts allow-popups allow-modals allow-forms allow-same-origin"
  • allow="fullscreen; clipboard-write"
  • loading="lazy"

Files Changed

  • src/components/ScalingIframe/index.tsx - Added sandbox/allow attributes and error handling
  • src/layouts/SketchLayout.astro - Added sandbox/allow attributes to fallback iframe

Testing

Verified both code paths render with proper attributes on sketch detail pages.

Fixes processing#674

The regex in normalizeP5ReferenceLinks() was capturing the 'p5'
prefix in the capture group, causing duplicate 'p5' in URLs.

Before: #/p5/rectMode -> /reference/p5/p5/rectMode/ (broken)
After:  #/p5/rectMode -> /reference/p5/rectMode/ (fixed)

Updated regex to exclude 'p5' from capture group while still
handling both dot notation (#/p5.Element) and slash notation
(#/p5/rectMode) patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant