fix(indesign): exclude rich media blocks from export output#4614
Open
wil-gerken wants to merge 2 commits intotrunkfrom
Open
fix(indesign): exclude rich media blocks from export output#4614wil-gerken wants to merge 2 commits intotrunkfrom
wil-gerken wants to merge 2 commits intotrunkfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an InDesign export issue where rich media Gutenberg blocks (e.g., PDF file embeds and oEmbed content) leak raw HTML/URLs into the exported tagged-text output, causing InDesign import problems.
Changes:
- Add an exclusion list in the InDesign converter to skip
core/file,core/embed,core/video, andcore/audioblocks during block processing. - Add unit tests verifying
core/fileandcore/embedblocks do not contribute raw markup/URLs to the export output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| includes/optional-modules/indesign-export/class-indesign-converter.php | Skips specific rich media block types during process_blocks() to prevent raw markup/URLs from entering the export. |
| tests/unit-tests/indesign-exporter/indesign-exporter.php | Adds unit tests asserting core/file and core/embed content is excluded from exported output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
includes/optional-modules/indesign-export/class-indesign-converter.php
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All Submissions:
Changes proposed in this Pull Request:
When a post contains a
core/fileblock (PDF embed) orcore/embedblock (YouTube, etc.), the InDesign export was including raw HTML markup in the output — such as<object>tags, download link text, and bare embed URLs — instead of skipping those blocks entirely. This resulted in import errors and corrupted print output for publishers using the InDesign export tool.Rich media blocks have no print equivalent and should be excluded from the export. This fix adds an explicit exclusion list in
process_blocks()forcore/file,core/embed,core/video, andcore/audio.These blocks are now skipped before serialization, ensuring that only printable content is exported while leaving surrounding content intact.
Closes
NPPM-2677.How to test the changes in this Pull Request:
Reproduce the problem (without this PR):
wp newspack optional-modules enable indesign-exportcore/file), and another paragraph after it..txtfile — observe that<object>tags, the PDF filename, and "Download" text appear between the two paragraphs in the export output.Verify the fix (with this PR):
.txtfile — the two paragraphs should appear cleanly with no<object>tag, PDF filename, or "Download" text between them.core/embed) — the YouTube URL should not appear in the export.Other information: