Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export tool turns var() into unicode characters #37671

Closed
TeBenachi opened this issue Dec 30, 2021 · 7 comments
Closed

Export tool turns var() into unicode characters #37671

TeBenachi opened this issue Dec 30, 2021 · 7 comments
Assignees
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended

Comments

@TeBenachi
Copy link
Contributor

TeBenachi commented Dec 30, 2021

Description

Issue

When template files use variable var(), export tool turns the variable into Unicode characters.

For example, Page template in Twenty Twenty-Two uses
var(--wp--custom--spacing--medium, 6rem) on the line 5.

screenshot-TT2

After exporting, the variable turns into
var(\u002d\u002dwp\u002d\u002dcustom\u002d\u002dspacing\u002d\u002dmedium, 6rem).

screenshot-Export

Step-by-step reproduction instructions

  1. Install Twenty Twenty-Two
  2. Go to Editor < Templates < Page
  3. Click on the 3 dots on the top right corner to open the Tools panel
  4. On the Tools panel, click Export to download templates and templates parts files
  5. Check the line 5 on Page template file

Environment info

I tested on 5.9-beta4 using Gutenberg v12.2.0 on Firefox / macOS.

@TeBenachi TeBenachi changed the title Export tool turns var() into strange values Export tool turns var() into unicode characters Dec 30, 2021
@annezazu annezazu added [Type] Bug An existing feature does not function as intended Needs Technical Feedback Needs testing from a developer perspective. labels Dec 31, 2021
@annezazu
Copy link
Contributor

cc @Mamaduka perhaps since you've done work around exporting items: #36619

@Mamaduka
Copy link
Member

Thanks for the ping, @annezazu. Assing this issue to myself and will have a look next week.

@Mamaduka Mamaduka self-assigned this Dec 31, 2021
@chthonic-ds
Copy link
Contributor

I believe this is happening for any instance of --, not just for CSS variables.

For example, wp-block-query--cards becomes wp-block-query\u002d\u002dcards when exported.

@Mamaduka
Copy link
Member

Hi, @scruffian

Since you worked on recent export updates, do you remember if this is still an issue?

@scruffian
Copy link
Contributor

We decided that this is the correct behaviour, see #39576

@Mamaduka
Copy link
Member

Thank you, @scruffian.

@tcmulder
Copy link

I'm confused, does this mean we're unable to use BEM class names for blocks? I have a select box that lets the user select multiple classes to apply to their block, which it saves as an array of class names, and right now my client is getting the "attempt block recovery" warning because classes like carousel--dark get converted to carousel\u002d\u002ddark in the save function but not in the post body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants