{"action":"created","issue":{"url":"https://api.github.com/repos/WordPress/gutenberg/issues/14050","repository_url":"https://api.github.com/repos/WordPress/gutenberg","labels_url":"https://api.github.com/repos/WordPress/gutenberg/issues/14050/labels{/name}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/issues/14050/comments","events_url":"https://api.github.com/repos/WordPress/gutenberg/issues/14050/events","html_url":"https://github.com/WordPress/gutenberg/pull/14050","id":413359113,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU1MzYwMDE2","number":14050,"title":"WIP - Allow plugins to extend core embed blocks","user":{"login":"notnownikki","id":3314354,"node_id":"MDQ6VXNlcjMzMTQzNTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3314354?v=4","gravatar_id":"","url":"https://api.github.com/users/notnownikki","html_url":"https://github.com/notnownikki","followers_url":"https://api.github.com/users/notnownikki/followers","following_url":"https://api.github.com/users/notnownikki/following{/other_user}","gists_url":"https://api.github.com/users/notnownikki/gists{/gist_id}","starred_url":"https://api.github.com/users/notnownikki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notnownikki/subscriptions","organizations_url":"https://api.github.com/users/notnownikki/orgs","repos_url":"https://api.github.com/users/notnownikki/repos","events_url":"https://api.github.com/users/notnownikki/events{/privacy}","received_events_url":"https://api.github.com/users/notnownikki/received_events","type":"User","site_admin":false},"labels":[{"id":631490822,"node_id":"MDU6TGFiZWw2MzE0OTA4MjI=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/Extensibility","name":"Extensibility","color":"655104","default":false},{"id":1078477350,"node_id":"MDU6TGFiZWwxMDc4NDc3MzUw","url":"https://api.github.com/repos/WordPress/gutenberg/labels/[Block]%20Embed","name":"[Block] Embed","color":"6767e5","default":false},{"id":587343997,"node_id":"MDU6TGFiZWw1ODczNDM5OTc=","url":"https://api.github.com/repos/WordPress/gutenberg/labels/[Status]%20In%20Progress","name":"[Status] In Progress","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2019-02-22T11:19:01Z","updated_at":"2019-03-18T13:02:48Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/WordPress/gutenberg/pulls/14050","html_url":"https://github.com/WordPress/gutenberg/pull/14050","diff_url":"https://github.com/WordPress/gutenberg/pull/14050.diff","patch_url":"https://github.com/WordPress/gutenberg/pull/14050.patch"},"body":"## Description\r\n\r\nThis is Work In Progress, needing feedback from plugin developers and core Gutenberg team members.\r\n\r\nSome plugins (e.g. Jetpack) have shortcodes that handle embedding certain content, for example, YouTube. These shortcodes have extra options that aren't available through oEmbed, because the provider's oEmbed API does not support the extra options.\r\n\r\nThis PR adds new options to the embed block settings to allow plugins to customise core embed blocks and add extra options, modifying the output from oEmbed if needed, or allowing the plugin to override what the embed block saves with a shortcode.\r\n\r\nThe new options are:\r\n\r\n`preview`: function that returns an enhanced preview. Takes the preview oEmbed generates as an argument.\r\n`save`: function that allows the plugin to override the block's save.\r\n`fetching`: function that returns a boolean to show if the `preview` is being fetched. This allows custom preview endpoints to be implemented.\r\n`inspector`: component to be rendered as part of the block inspector, to provide controls for any new options the plugin provides.\r\n\r\nThis PR also includes enhancements for the YouTube block, allowing us to set relative video options, start time, and autoplay. This might not be suitable for inclusion in core (more suited to a plugin?) but it's here as an example of what's possible with the new options.\r\n\r\nTo demonstrate how a plugin can provide a custom save and preview, the `packages/e2e-tests/plugins/extend-embeds/`plugin shows the Reddit block being backed by the plugin's own preview endpoint.\r\n\r\n## How has this been tested?\r\n\r\nThere's a new e2e test that has a plugin that demonstrates all the new features are working.\r\n\r\n## Types of changes\r\nNew feature, completely backwards compatible.\r\n\r\n## Checklist:\r\n- [ ] My code is tested.\r\n- [ ] My code follows the WordPress code style. <!-- Check code: `npm run lint`, Guidelines: https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/ -->\r\n- [ ] My code follows the accessibility standards. <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/coding-standards/accessibility-coding-standards/ -->\r\n- [ ] My code has proper inline documentation. <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/ -->\r\n- [ ] I've included developer documentation if appropriate. <!-- Handbook: https://wordpress.org/gutenberg/handbook/designers-developers/ -->\r\n"},"comment":{"url":"https://api.github.com/repos/WordPress/gutenberg/issues/comments/473900742","html_url":"https://github.com/WordPress/gutenberg/pull/14050#issuecomment-473900742","issue_url":"https://api.github.com/repos/WordPress/gutenberg/issues/14050","id":473900742,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MzkwMDc0Mg==","user":{"login":"notnownikki","id":3314354,"node_id":"MDQ6VXNlcjMzMTQzNTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3314354?v=4","gravatar_id":"","url":"https://api.github.com/users/notnownikki","html_url":"https://github.com/notnownikki","followers_url":"https://api.github.com/users/notnownikki/followers","following_url":"https://api.github.com/users/notnownikki/following{/other_user}","gists_url":"https://api.github.com/users/notnownikki/gists{/gist_id}","starred_url":"https://api.github.com/users/notnownikki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notnownikki/subscriptions","organizations_url":"https://api.github.com/users/notnownikki/orgs","repos_url":"https://api.github.com/users/notnownikki/repos","events_url":"https://api.github.com/users/notnownikki/events{/privacy}","received_events_url":"https://api.github.com/users/notnownikki/received_events","type":"User","site_admin":false},"created_at":"2019-03-18T13:02:48Z","updated_at":"2019-03-18T13:02:48Z","author_association":"MEMBER","body":"@gwwar \r\n\r\n> If a plugin enhances a core embed, we publish a post with the new options, disable the plugin and then edit again, does the core block still work?\r\n\r\n\"It depends\" - every engineer ever ;)\r\n\r\nIf the YouTube extension was removed, the blocks would continue to work, because we're modifying the output of oEmbed with a server side dynamic block and not altering what gets saved. So editing those would load as expected, because oEmbed would still run, but the extended behaviour wouldn't render  any more so you'd just get the normal version.\r\n\r\nIf a plugin was removed that had replaced `save` with something completely different, then the editor would treat it as an unknown block, because it wouldn't match what the un-enhanced embed block expected. If the plugin had replaced `save` with some arbitrary HTML, then converting it to HTML would be fine. If the plugin had used a shortcode, then it's the same situation as any other scenario where you install a plugin that provides a shortcode and then remove the plugin.\r\n\r\n"}}
{"actor":{"display_login":"notnownikki"}}