WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Font Files do not export/import properly via XML/WXR exporter. #59109

Open peterwilsoncc opened 9 months ago

peterwilsoncc commented 9 months ago

Description

When exporting and importing content via the WordPress Importer font faces are not imported to the new domain correctly.

This can result in broken designs as the templates imported from the original site are referring to font files on the old site.

When imported with the Download and import file attachments option checked the font files should be:

For clarity, this is referring to the XML/WXR exporter available via the WP Dashboard's Tools > Export menu.

Step-by-step reproduction instructions

  1. Create multiple sites running WordPress trunk (one for export, one for import)
  2. On the exporter site:
    1. Edit the 2024 home page
    2. Download Open Sans from Google Fonts (ie, visit the site and download them to your computer)
    3. Open the style editor > typography > Manage Fonts > Upload
    4. Upload the Open Sans files (standard will do, don't worry about condensed, etc)
    5. Close the model once upload is complete
    6. Go through each of the element types and change the font to Open Sans
    7. Use the Yoast Faker CLI tool to create some fake content (this will include attachments)
    8. Visit Tools > Export and download all content
    9. Keep this site running for the next step
  3. On the importer site:
    1. Install and activate the WordPress Importer plugin
    2. Note: For localhosts you may need to change this line to use wp_remote_get()
    3. Visit Tools > Import > WordPress > Run Importer
    4. Check the box to import attachments at the bottom of the screen
    5. Shut down the exporter site
    6. Visit the importer site's front end
    7. Observe the fonts use system defaults
    8. In the browser network tools observe the fonts are trying to make request to the exporter site
    9. Open the style editor > typography > Manage Fonts
    10. Observe the Open Sans fonts are marked as installed locally via uploads
    11. When looking at the content created, you'll notice the media file URLs have been updated in the content to refer to the importer site's URL

Screenshots, screen recording, code snippet

Screenshot from localhost (importer site), notice font face URLs refer to wp-dev.local (exporter site)

Screen Shot 2024-02-16 at 1 05 03 pm

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

matiasbenedetto commented 9 months ago

Hi, thanks for testing and reporting this issue.

The export of the installed fonts is not implemented yet. It's being discussed in this ticket: https://github.com/WordPress/gutenberg/issues/54226

Closing this one as duplicated of https://github.com/WordPress/gutenberg/issues/54226

matiasbenedetto commented 9 months ago

Thinking twice, this is not about the theme exporter but the site exporter, so I'm re-opening the ticket.

peterwilsoncc commented 9 months ago

Thanks Matias, I've updated the ticket's title and description to make it clearer the context is the WordPress post exporter rather than the theme folder exporter in the site editor.

matiasbenedetto commented 8 months ago

I've started working on this here: https://github.com/WordPress/wordpress-develop/pull/6173

priethor commented 8 months ago

What's the status of this, considering the core PR is closed?

matiasbenedetto commented 8 months ago

What's the status of this, considering the core PR is closed?

The PR around exporting the data is needed because the data is exported by default. No changes to the WordPress core repo are needed. The only change needed is the addition of font assets import capabilities in the WordPress-importer plugin and there's a PR in progress for that: https://github.com/WordPress/wordpress-importer/pull/160

getdave commented 7 months ago

As this is not an Editor specific task but rather Importer I'm now removing it from the Editor board.

Thank you for all the work on this @matiasbenedetto and let's hope it gets merged to the Importers repo soon.