{"action":"closed","issue":{"url":"https://api.github.com/repos/WordPress/gutenberg/issues/8532","repository_url":"https://api.github.com/repos/WordPress/gutenberg","labels_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8532/labels{/name}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8532/comments","events_url":"https://api.github.com/repos/WordPress/gutenberg/issues/8532/events","html_url":"https://github.com/WordPress/gutenberg/issues/8532","id":347632774,"node_id":"MDU6SXNzdWUzNDc2MzI3NzQ=","number":8532,"title":"Block validation: exclude data attributes / add support for custom validators","user":{"login":"AndiDittrich","id":1474107,"node_id":"MDQ6VXNlcjE0NzQxMDc=","avatar_url":"https://avatars2.githubusercontent.com/u/1474107?v=4","gravatar_id":"","url":"https://api.github.com/users/AndiDittrich","html_url":"https://github.com/AndiDittrich","followers_url":"https://api.github.com/users/AndiDittrich/followers","following_url":"https://api.github.com/users/AndiDittrich/following{/other_user}","gists_url":"https://api.github.com/users/AndiDittrich/gists{/gist_id}","starred_url":"https://api.github.com/users/AndiDittrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndiDittrich/subscriptions","organizations_url":"https://api.github.com/users/AndiDittrich/orgs","repos_url":"https://api.github.com/users/AndiDittrich/repos","events_url":"https://api.github.com/users/AndiDittrich/events{/privacy}","received_events_url":"https://api.github.com/users/AndiDittrich/received_events","type":"User","site_admin":false},"labels":[{"id":671400480,"node_id":"MDU6TGFiZWw2NzE0MDA0ODA=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/[Component]%20Raw%20Handling","name":"[Component] Raw Handling","color":"fbca04","default":false},{"id":982059778,"node_id":"MDU6TGFiZWw5ODIwNTk3Nzg=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/[Status]%20Duplicate","name":"[Status] Duplicate","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-04T16:58:07Z","updated_at":"2018-08-06T22:47:37Z","closed_at":"2018-08-06T22:47:37Z","author_association":"NONE","body":"Dear Gutenberg Team,\r\n\r\ni'm currently developing a [Gutenberg Plugin](https://github.com/EnlighterJS/Plugin.Gutenberg) to integrate [EnlighterJS](https://github.com/EnlighterJS/EnlighterJS) Syntax Highlighter into to editor and ran into serious trouble regarding the \"block/element validation\":\r\n\r\nBecause of the strict **1:1** structure validation there seems to be no possibility? to add **optional attributes** to the elements generated by the `save` function. \r\nThe editor always throws element validation errors in case custom attributes are added (e.g. manually by a user - which might be legitimate).\r\n\r\nOf course, its possible to add **all** allowed attributes to the output...but this will mess-up the generated html with a lot of **unused attributes**\r\n\r\n#### Example HTML Structure ####\r\n\r\n```html\r\n<pre \r\ndata-enlighter-language=\"less\" \r\ndata-enlighter-highlight=\"2\" \r\ndata-enlighter-lineoffset=\"\" \r\ndata-enlighter-linenumbers=\"\" \r\ndata-enlighter-title=\"\">\r\n...\r\n</pre>\r\n```\r\n\r\n#### Typical Validation Error ####\r\n\r\n![gutenberg_validation_error](https://user-images.githubusercontent.com/1474107/43678670-fc9df990-9817-11e8-8233-c0715450f89d.png)\r\n\r\n#### Suggestions ####\r\n\r\n* Exclude `data-` attributes from validation (they represent an elements state, not its structure)\r\n* Add support for custom block validation methods (within `registerBlockType`) to allow users to override the default behaviour\r\n* Maybe use the **attribute** schema to validate the structure, including an `optional` flag\r\n\r\n\r\nbest regards, Andi\r\n\r\n"}}
{"actor":{"display_login":"designsimply"}}