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

Content load fails if number passed as fontSizeSlug #32719

Closed
glendaviesnz opened this issue Jun 16, 2021 · 2 comments
Closed

Content load fails if number passed as fontSizeSlug #32719

glendaviesnz opened this issue Jun 16, 2021 · 2 comments
Assignees
Labels
[Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Comments

@glendaviesnz
Copy link
Contributor

Description

With Gutenberg 10.8.1 block content fails to load in the editor if a number is passed to getFontSizeClass instead of a string. Previously lodash kebabCase was forgiving of this misdemeanor.

Step-by-step reproduction instructions

Run jetpack blocks in local env with 10.8.1
Insert following code into code view of editor

<!-- wp:jetpack/subscriptions {"customButtonBackgroundColor":"#151516","fontSize":16,"customFontSize":16,"borderRadius":3,"borderColor":"#ffffff","customBorderColor":"#ffffff"} -->
<div class="wp-block-jetpack-subscriptions wp-block-jetpack-subscriptions__supports-newline">[jetpack_subscription_form show_subscribers_total="false" button_on_newline="false" custom_background_button_color="#151516" custom_font_size="16" custom_border_radius="3" custom_border_weight="1" custom_border_color="#ffffff" custom_padding="15" custom_spacing="10" submit_button_classes="has-16-font-size has-ffffff-border-color" email_field_classes="has-16-font-size has-ffffff-border-color" show_only_email_and_button="true"]</div>
<!-- /wp:jetpack/subscriptions -->

Switch back to editor view and
The content will not show in the editor, and the following error will show in the console:

Uncaught TypeError: fontSizeSlug.replace is not a function
    getFontSizeClass utils.js:69
    save editor-beta.js:31
    getSaveElement serializer.js:119
    getSaveContent serializer.js:184
    addParsedDifference custom-class-name.js:162

Expected behaviour

This method will continue to accept numbers as fontSizeSlug for those blocks that have been expecting it to work.

@glendaviesnz glendaviesnz added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor labels Jun 16, 2021
@glendaviesnz glendaviesnz self-assigned this Jun 16, 2021
@edwinho89
Copy link

Initially reported on #21259015-hc

@oandregal
Copy link
Member

Closed by #32742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants