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 Editable placeholders #756

Merged
merged 1 commit into from
May 10, 2017
Merged

Add Editable placeholders #756

merged 1 commit into from
May 10, 2017

Conversation

ellatrix
Copy link
Member

This is #475 but without any other improvements.


const content = this.getContent();

this.setState( {
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably shouldn't be calling this all the time.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if this would trigger a re-render if the value is the same?

This performs a shallow merge of stateChange into the new state.
https://facebook.github.io/react/docs/react-component.html#setstate

I do notice a lot of re-renders form node change though, not from this one.

Copy link
Member

@aduth aduth May 10, 2017

Choose a reason for hiding this comment

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

I'm not sure if this would trigger a re-render if the value is the same?

Yes it does: https://codepen.io/aduth/pen/mmXgxQ

We'd need to expose and use React.PureComponent for it to not: https://facebook.github.io/react/docs/react-api.html#react.purecomponent

Alternatively just compare against state here and return; early if it would end up being the same.

@ellatrix ellatrix added the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label May 10, 2017
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

This works great and it's simple enough 👍

@ellatrix ellatrix merged commit 1c1e7ea into master May 10, 2017
@ellatrix ellatrix deleted the add/editable-placeholder-2 branch May 10, 2017 17:44
@ellatrix
Copy link
Member Author

If it needs any changes, a new ticket can be opened.

@jasmussen
Copy link
Contributor

Thank you so much for working on this! I know it's been quite hellish — really appreciate you sticking with it!

@ellatrix
Copy link
Member Author

:) Yeah it wasn't really adding the placeholders specifically, should have just done it like this a while ago... Let's look at the rest separately.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants