Embed block - add allowed tag and attributes #931
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The GenericEmbed block was stripping essential attributes needed for third-party widgets like Donorbox. DOMPurify's sanitization was removing the custom
<dbox-widget>tag and critical attributes (async,campaign,enable-auto-scroll) required for the widget to function properly.This PR updates the
DOMPurifyconfiguration to whitelist these tags and attributes, allowing Donorbox and similar custom element-based embeds to work correctly.Related Issues
Fixes #816
Key Changes
dbox-widgettoADD_TAGSinDOMPurifyconfig to allow custom widget elementsasyncattributes to support asynchronous script loadingcampaignandenable-auto-scrollattributes for Donorbox widget configurationADD_ATTRarray for better maintainabilityHow to test
GenericEmbed blockdbox-widgetelementScreenshots / Demo video
https://www.loom.com/share/fa3cb08b237240268b2a88c5afc13698
Future enhancements / Questions
Monitor whether other third-party widgets require additional whitelisted attributes
Evaluate if the iframe approach has limitations for certain widgets (some may require page-level script loading)