WordPress / gutenberg

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

Version 6.5 `block.json` schema missing the `viewScriptModule` field #62780

Closed wongjn closed 2 months ago

wongjn commented 3 months ago

Description

The JSON schema for block.json for WordPress version 6.5 is missing the viewScriptModule field that was introduced in WordPress 6.5. As of note, the WP 6.6 version does have this field included.

Step-by-step reproduction instructions

  1. Go to https://schemas.wp.org/wp/6.5/block.json
  2. See there is no viewScriptModule property specified.

Screenshots, screen recording, code snippet

image

{
    "$schema": "https://schemas.wp.org/wp/6.5/block.json",
    "apiVersion": 3,
    "name": "foo/bar",
    "title": "Foo Bar",
    "category": "theme",
    "viewScriptModule": "file:./view.module.js"
}

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

cbravobernal commented 3 months ago

I couldn't find viewScriptModule but I could find the Interactivity one.

Screenshot 2024-06-24 at 18 51 20

wongjn commented 3 months ago

Thank you for pointing that out, updated.

t-hamano commented 3 months ago

Thanks for the report.

@ajlende To fix an issue like this, would it be enough to just submit a PR to that branch adding the missing field?

ajlende commented 3 months ago

@t-hamano, yes. The versioned schemas are sourced directly from the wp branches here.

t-hamano commented 3 months ago

@ajlende Thanks for the advice!

I plan on working on this PR, but I'll leave the diff here as a note to check if there are any other missing fields.

Details ```diff git diff wp/6.5...wp/6.6 schemas/json/block.json diff --git a/schemas/json/block.json b/schemas/json/block.json index 7234f36a5e..0c036a6e05 100644 --- a/schemas/json/block.json +++ b/schemas/json/block.json @@ -294,12 +294,12 @@ }, "heading": { "type": "boolean", - "description": "This property adds block controls which allow the user to set heading colors in a block, heading color is disabled by default.\n\nHeading color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.heading, its attributes definition is extended to include the style attribute", + "description": "This property adds block controls which allow the user to set heading colors in a block. Heading color is disabled by default.\n\nHeading color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.heading, its attributes definition is extended to include the style attribute", "default": false }, "button": { "type": "boolean", - "description": "This property adds block controls which allow the user to set button colors in a block, button color is disabled by default.\n\nButton color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.heading, its attributes definition is extended to include the style attribute", + "description": "This property adds block controls which allow the user to set button colors in a block. Button color is disabled by default.\n\nButton color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.button, its attributes definition is extended to include the style attribute", "default": false }, "enableContrastChecker": { @@ -314,11 +314,6 @@ "description": "This property adds a field to define a custom className for the block’s wrapper.", "default": true }, - "defaultStylePicker": { - "type": "boolean", - "description": "When the style picker is shown, a dropdown is displayed so the user can select a default style for this block type. If you prefer not to show the dropdown, set this property to false.", - "default": true - }, "dimensions": { "type": "object", "description": "This value signals that a block supports some of the CSS style propertie s related to dimensions. When it does, the block editor will show UI controls for the user to set their values if the theme decl ares support.\n\nWhen the block declares support for a specific dimensions property, its attributes definition is extended to in clude the style attribute.", @@ -346,6 +341,22 @@ } } }, + "background": { + "type": "object", + "description": "This value signals that a block supports some of the CSS style propertie s related to background. When it does, the block editor will show UI controls for the user to set their values if the theme decl ares support.\n\nWhen the block declares support for a specific background property, its attributes definition is extended to in clude the style attribute.", + "properties": { + "backgroundImage": { + "type": "boolean", + "description": "Allow blocks to define a background image.", + "default": false + }, + "backgroundSize": { + "type": "boolean", + "description": "Allow blocks to define values related to the size of a b ackground image, including size, position, and repeat controls", + "default": false + } + } + }, "html": { "type": "boolean", "description": "By default, a block’s markup can be edited individually. To disable this behavior, set html to false.", @@ -466,6 +477,11 @@ "type": "boolean", "description": "For the `flex` layout type only, determi nes display of the orientation control in the block toolbar.", "default": true + }, + "allowCustomContentAndWideSize": { + "type": "boolean", + "description": "For the `constrained` layout type only, determines display of the custom content and wide size controls in the block sidebar.", + "default": true } } } @@ -556,10 +572,12 @@ } }, "shadow": { + "default": false, "description": "Allow blocks to define a box shadow.", "oneOf": [ { - "type": "boolean" + "type": "boolean", + "description": "Defines whether a box shadow is enabled or not." }, { "type": "object" @@ -579,8 +597,54 @@ "type": "boolean", "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, its attributes definition is extended to include a new attribute sty le of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by s pecifying its own style attribute with a default", "default": false + }, + "textAlign": { + "description": "This property adds block toolbar controls which allow to change block's text alignment.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string", + "enum": [ "left", "center", "right" ] + } + } + ], + "default": false } } + }, + "interactivity": { + "description": "Indicates if the block is using Interactivity API features.", + "oneOf": [ + { + "type": "boolean", + "description": "Indicates whether the block is using the Interactivity A PI directives.", + "default": false + }, + { + "type": "object", + "properties": { + "clientNavigation": { + "type": "boolean", + "description": "Indicates whether a block is compatible with the Interactivity API client-side navigation.\n\nSet it to true only if the block is not interactive or if it is interactiv e using the Interactivity API. Set it to false if the block is interactive but uses vanilla JS, jQuery or another JS framework/l ibrary other than the Interactivity API.", + "default": false + }, + "interactive": { + "type": "boolean", + "description": "Indicates whether the block is using the Interactivity API directives.", + "default": false + } + } + } + ] + }, + "splitting": { + "type": "boolean", + "description": "This property indicates whether the block can split when the Enter key i s pressed or when blocks are pasted.", + "default": false } }, "additionalProperties": true @@ -681,31 +745,6 @@ } } - "type": "boolean", - "description": "Indicates whether the block is using the Interactivity API directives.", - "default": false - } - } - } - ] } } }, @@ -801,6 +840,20 @@ } ] }, + "viewScriptModule": { + "description": "Block type frontend script module definition. It will be enqueued only when viewing the content on the front of the site.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "editorStyle": { "description": "Block type editor style definition. It will only be enqueued in the context of the editor.", "oneOf": [ ```
cbravobernal commented 3 months ago

Another approach for viewScriptModuledescription could be:

JavaScript module source that will be only enqueued on the front side of the site.

t-hamano commented 3 months ago

@cbravobernal Thanks for the suggestion.

Regarding the description improvements, it might be a good idea to not include them in the backport to WP6.5, but instead submit a new PR against the trunk branch.

t-hamano commented 2 months ago

Fixed by #62917