Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of select editor from the block editor module #16184

Conversation

jorgefilipecosta
Copy link
Member

Description

The block editor performed a select to the core/editor store, this causes problems when the editor store is not available e.g. in the widget screen after we merge #16160.

This PR refactors to code to use a block editor setting instead of the editor store.

How has this been tested?

With an admin rule, I pasted the following in a paragraph: <iframe src="httt://www.wordpress.org/" />. I verified an HTML block with the iframe was created.
With a contributor rule I pasted the same code I verified an HTML block with the iframe was not created.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Type] Code Quality Issues or PRs that relate to code quality labels Jun 14, 2019
@@ -102,6 +109,7 @@ class EditorProvider extends Component {
__experimentalReusableBlocks: reusableBlocks,
__experimentalMediaUpload: hasUploadPermissions ? mediaUpload : undefined,
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
__experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you think this shhould be experimental?
Also these settings are documented in the defaults.js file of the block-editor package in addition to providing the default value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @youknowriad the default.js file was updated, nice catch.
The setting was only marked as experimental because lately all new additions were kept experimental for one version so I followed the same logic, but I can change it.

@jorgefilipecosta jorgefilipecosta force-pushed the refactor/remove-usage-of-select-block-editor-from-the-block-editor-module branch from 8c41ea2 to 5223795 Compare June 14, 2019 21:17
@jorgefilipecosta jorgefilipecosta requested a review from gziolo as a code owner June 14, 2019 21:17
@jorgefilipecosta jorgefilipecosta force-pushed the refactor/remove-usage-of-select-block-editor-from-the-block-editor-module branch from 5223795 to 16c677a Compare July 9, 2019 21:27
Copy link
Member

@ellatrix ellatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Tested iframe pasting and it still works. :)

@jorgefilipecosta jorgefilipecosta merged commit 5756b29 into master Jul 10, 2019
@jorgefilipecosta jorgefilipecosta deleted the refactor/remove-usage-of-select-block-editor-from-the-block-editor-module branch July 10, 2019 15:36
@youknowriad youknowriad added this to the Gutenberg 6.2 milestone Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants