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

Add prop "isFocused" / "isSelected" for custom nodes #1950

Merged
merged 5 commits into from
Jul 3, 2018

Conversation

SamyPesse
Copy link
Collaborator

This PR is a proposal for a breaking change. It changes the definition of the prop isSelected for custom nodes, and add a prop isFocused.

Basically isFocused is equal to the previous isSelected.

  • isSelected: true when the node is in the selection (focused or blurred)
  • isFocused: true when the node is in the focused selection

In my opinion, these names better match the other concept in slate: something can be selected without being focused.

Upgrade path

Developers depending on isSelected will have to rename it to isFocused. It should be easy (Search & replace).

TODOs

  • Add isSelected and isFocused
  • Document it
  • Write some rendering unit tests in slate-react

@ianstormtaylor
Copy link
Owner

Hey @SamyPesse this looks good to me. Can you update the examples that use isSelected so people don't get confused? Thanks!

return (
<div {...this.props.attributes}>
{this.renderVideo()}
{this.renderInput()}
{isSelected ? this.renderInput() : null}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've adapted this example to show the input only when the node is selected.

@SamyPesse SamyPesse removed the request for review from Soreine July 3, 2018 22:52
@ianstormtaylor
Copy link
Owner

Thanks @SamyPesse, this looks great!

@ianstormtaylor ianstormtaylor merged commit 0ceefea into master Jul 3, 2018
@ianstormtaylor ianstormtaylor deleted the isSelected-isFocused branch September 21, 2018 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants