-
Notifications
You must be signed in to change notification settings - Fork 258
Enable rest props to pass to editor #6
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
Conversation
|
I'm not sure, I want to allow passing arbitrary props through the element through for now. And if so, it'll need to correctly append classnames, and proxy events in the callbacks :/ |
|
I can add proxy event handling and classname handling, if desired. |
|
If you prefer a more surgical approach, for my use case I need blur/focus event handlers passed through. |
|
|
kitten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, last request. Otherwise lgtm :)
src/components/Editor/index.js
Outdated
| const { contentEditable, className, style } = this.props | ||
| const { contentEditable, className, style, ...rest } = this.props | ||
| const { html } = this.state | ||
| delete rest.children; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a rather non obvious v8 perf hog :) can you just manually set code to undefined for presentations below? Also you don't need to do anything about children
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I don't think the lifetime of rest is such that it will be affected by the V8 issue, but I shall make the change requested and leave children alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, setting it to undefined does not have the desired effect. It's still a property on rest and causes a React warning: Unknown prop code on <pre> tag. I removed the delete on children and the unneeded semicolon. The only other option is destructuring out code and ignoring it, but I don't like unused parameter warnings much.
|
If you're interested, here's the React discussion on |
|
@webOS101 Interesting. Seems I forgot about this behaviour due to the future shift in React towards not filtering anymore :) Let's get this merged then |
|
FWIW, I did a benchmark test of rendering 500 components using destructuring and again using |
|
whoops, I labeled my tests backwards. |
This allows for passing props into the editor from the wrapping app.