• EditorsKit prevents the preview of non standard blocks in the page editor screen.

    Block previews work fine when EditorsKit is disabled. When EditorsKit is enabled and all its features disabled block previews still do not show. Plugins I know to be affected include WP Recipe Maker and Tasty Links.

    Editor requests that are blocked when EditorsKit is enabled look like this (we can change wp-recipe-maker to any other plugin’s request path and the result is the same):

    /wp-json/wp/v2/block-renderer/wp-recipe-maker/recipe?context=edit&attributes%5Bid%5D=8622&attributes%5Btemplate%5D=&attributes%5Bupdated%5D=1580499186151&attributes%5Beditorskit%5D%5Bdevices%5D=false&attributes%5Beditorskit%5D%5Bdesktop%5D=true&attributes%5Beditorskit%5D%5Btablet%5D=true&attributes%5Beditorskit%5D%5Bmobile%5D=true&attributes%5Beditorskit%5D%5Bloggedin%5D=true&attributes%5Beditorskit%5D%5Bloggedout%5D=true&attributes%5Beditorskit%5D%5Bacf_visibility%5D=&attributes%5Beditorskit%5D%5Bacf_field%5D=&attributes%5Beditorskit%5D%5Bacf_condition%5D=&attributes%5Beditorskit%5D%5Bacf_value%5D=&attributes%5Beditorskit%5D%5Bmigrated%5D=false&attributes%5Beditorskit%5D%5Bunit_test%5D=false&attributes%5BhasAlignmentOption%5D=true&post_id=6524&_locale=user

    The network response looks like this:

    {"code":"rest_invalid_param","message":"Par\u00e1metro(s) no v\u00e1lido(s): attributes","data":{"status":400,"params":{"attributes":"hasAlignmentOption no es una propiedad v\u00e1lida del objeto."}}}

    Affected blocks show the following text:

    Error loading block: Invalid parameter(s): attributes

    I tested with and without the Gutenberg feature plugin enabled. The problem is present in both cases.

    There are no EditorsKit related error messages logged in the WordPress file space (error_logs), by the web server (as far as I can see) or sent to me via Fatal Error Notify (a WordPress error monitor plugin).

    I see there is another support request about block previews from 4 weeks ago and an earlier support request that mentions an issue with the ‘Alignment’ property. Maybe the same issue is in play. The network response in my case points toward an issue with hasAlignmentOption.

    Hope we can solve this one quickly. Let me know if you want me to run any tests.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Developer of WP Recipe Maker here. I’ve been doing some debugging as a few of our customers were contacting our support because of this problem.

    I’ve been able to replicate the issue on a clean install with only EditorsKit active so it’s not a plugin compatibility issue.

    Basically just creating a new post and adding the default WordPress “Latest Comments” block gets the same error in the fetch response:

    {
        "code": "rest_invalid_param",
        "message": "Invalid parameter(s): attributes",
        "data": {
            "status": 400,
            "params": {
                "attributes": "hasAlignmentOption is not a valid property of Object."
            }
        }
    }

    It’s a bit hard to debug things because of the build files but it’s related to this code on line 164 in the /src/extensions/attributes/index.js file:

    settings.attributes = Object.assign( settings.attributes, {
    	hasAlignmentOption: {
    		type: 'boolean',
    		default: true,
    	},
    } );

    Just removing that section from the index.js build file fixed the problem.

    @leehodson @brechtvds Thanks a lot for the help and reporting this issue. I’ve found the issue and I hope you can confirm that this fixes of mine are working.

    Could you replace block-options/includes/class-editorskit-post-meta.php with this one https://github.com/phpbits/block-options/blob/fix/block-preview-issue/includes/class-editorskit-post-meta.php and check if it’s working on your end as well.

    Again, thanks a lot!

    Thanks for the fast response! This change does fix things for my test cases.

    @brechtvds Awesome! Thank you too for checking the issue with your WP Recipe Maker plugin. I’ve tested the issue and working on my end as well. Thanks again!

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    @phpbits I do confirm that the new post-meta file resolves the issue.

    @phpbits and @brechtvds thank you both for your help with this.

    @leehodson You are very welcome! I’ll be adding this fixes on the next minor update. Thanks a lot!

    @leehodson I’ve uploaded the fixes on the latest version. Thanks again for reporting this issue and let me know if in any case you encounter any other issues in the future.

    @brechtvds I really appreciate the help. If you need any integration for EditorsKit and your plugin please do not hesitate to let me know. I’ll be very happy to add support to your plugins.

    Thanks,
    Jeffrey

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘JSON Error Prevents Block Previews’ is closed to new replies.