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

Block Edit: Remove legacy context API child context #7869

Merged
merged 2 commits into from
Jul 11, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Jul 10, 2018

This pull request seeks to refactor BlockEdit to remove use of the legacy context API (getChildContext).

It removes the need for withSelect, opting instead to omit canUserUseUnfilteredHTML from block context and consume directly from the single location where it is used (RichText). Presumably this was needed to be passed by context when RichText was not part of the editor directory. The postType prop, to the best of my knowledge, is not used at all.

Testing instructions:

Verify there are no other usage of the canUserUseUnfilteredHTML context.

Ensure there are no regressions in RichText's use of the canUserUseUnfilteredHTML prop (see #4660).

@aduth aduth added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Code Quality Issues or PRs that relate to code quality labels Jul 10, 2018
@aduth aduth requested review from oandregal and gziolo July 10, 2018 18:30
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Unit tests fail, we probably import BlockEdit as follows in test code:

import { BlockEdit } from ....

I can fix it myself.

@gziolo gziolo added this to the 3.3 milestone Jul 11, 2018

// Hack to avoid the wrapping HoCs.
import { BlockEdit } from '../../../editor/components/block-edit';
import { BlockEdit } from '@wordpress/editor';
Copy link
Member

@gziolo gziolo Jul 11, 2018

Choose a reason for hiding this comment

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

No more hacks 😄

@gziolo
Copy link
Member

gziolo commented Jul 11, 2018

I think I fixed the issue. In my testing, everything works as expected including embedding Google Maps code into HTML block.

@gziolo gziolo merged commit 5e59893 into master Jul 11, 2018
@gziolo gziolo deleted the remove/block-edit-legacy-context branch July 11, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants