• Resolved hamarkhis

    (@hamarkhis)


    Hi there,

    I’m using the Stripe Payments plugin and noticed that the block defined in admin/assets/js/blocks/product-block.js is currently causing future issues with WordPress Gutenberg because it does not use apiVersion 3. Specifically, I get the following message:

    Block with API version 2 or lower is deprecated since version 6.9. See: https://developer.ww.wp.xz.cn/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/ Note: The block “stripe-payments/product-block” is registered with API version 1. This means that the post editor may work as a non-iframe editor. Since all editors are planned to work as iframes in the future, set the apiVersion field to 3 and test the block inside the iframe editor.

    It seems that the block is still structured for API v1/2, which works but is not fully compatible with the newer Gutenberg standards.

    Could you please update the Product Block so that it is compatible with API v3?
    This would ensure full compatibility with modern versions of WordPress and prevent the editor messages currently appearing.

    Thank you for your work on this plugin, and I hope this can be addressed in a future update.

    Best regards

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Ruhul

    (@tips-and-tricks-hq)

    Thank you. We will look into it.

    Plugin Contributor Ruhul

    (@tips-and-tricks-hq)

    We have completed this work in the newly released version of the plugin. Let me know if you see any issues.

    Thread Starter hamarkhis

    (@hamarkhis)

    Hello,

    I noticed that after activating your plugin, the theme’s styles in the Gutenberg editor are lost. To resolve this issue, I had to add the following code to my theme:

    function restore_theme_editor_styles() : void {
    add_theme_support('editor-styles');
    add_editor_style('style.css');
    global $wp_styles;
    if ( isset($wp_styles->registered['accept-stripe-payments-editor-style']) ) {
    wp_dequeue_style('accept-stripe-payments-editor-style');
    }
    }

    add_action('after_setup_theme', 'restore_theme_editor_styles' );

    This ensures that the theme styles are correctly loaded in Gutenberg and prevents the plugin from overriding them. Without this addition, the editor loses all theme styling when the plugin is active, and the styles remain broken even when the plugin is disabled.

    It seems the plugin’s editor CSS is currently overriding the theme’s styles, and implementing a solution like this would help maintain compatibility with themes.

    Could you please update the plugin so that it doesn’t override theme styles in the Gutenberg editor? Implementing a solution would help ensure compatibility with themes without requiring custom code.

    Thank you!

    Plugin Contributor Ruhul

    (@tips-and-tricks-hq)

    I am not sure where that editor style is coming from. We don’t register any plugin or theme specific styles. There is nothing with the following string in our plugin:

    accept-stripe-payments-editor-style

    Is this something that you may have created for a customization for your site?

    I have searched our following GitHub repository for this editor style string and I can’t find anything in our codebase:

    https://github.com/Arsenal21/stripe-payments

    So I am trying to understand where does it get registered in the first place?

    Is this something caused by the the product block API v3 change?

    Thread Starter hamarkhis

    (@hamarkhis)

    Thanks for your response. Using only this :
    function restore_theme_editor_styles() : void {
    add_theme_support('editor-styles');
    add_editor_style('style.css');
    }

    works for restoring some lost styles, but not all of them.

    So I made a strict copy of my site to a staging environment to try to understand what can be wrong, ans surprisingly, the styles are not lost in the staging environment. So I really don’t understand what’s going up.

    My provider has been contacted, all caches are disabled, transcients too… I have no explanation for now.

    Thread Starter hamarkhis

    (@hamarkhis)

    Hello,

    I wanted to let you know that with the v3 update of your block, the way Gutenberg handles theme-loaded styles has changed. This caused a latent issue related to style loading from my theme. I found that one important .css file was not loaded anymore.
    I was able to identify and resolve this on my end, but it might be useful to take this into account in future updates to prevent other users from encountering the same problem, so that the plugin can be more robust.

    Thank you for your work on the plugin!

    Plugin Contributor Ruhul

    (@tips-and-tricks-hq)

    Thank you for the update. I’ll check whether there’s anything we can improve on the plugin side to enhance this.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.