Skip to content

Hook arguments #172

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

Merged
merged 2 commits into from
Apr 2, 2016
Merged

Hook arguments #172

merged 2 commits into from
Apr 2, 2016

Conversation

nikgraf
Copy link
Member

@nikgraf nikgraf commented Apr 2, 2016

This will make plugin system more flexible for future changes.

In the future we can easily extend out the arguments depending on new features that will be available in DraftJS. We even could pass in the whole pluginEditor context (as we had it in the first implementation & @ianstormtaylor suggested) and it would not result in a braking the API.

Yet I don't feel comfortable to expand the API and pass down the whole pluginEditor context until there is a valid use-case.focus() came up as a suggestion, but this can easily be done with forceSelection on the editorState as well.

I'm curious how you guys feel about it? @juliankrispel @ianstormtaylor @bkniffler

P.S. I merged it already so I can move on with some refactoring. If there are good arguments against this change I'm happy to revert back.

@nikgraf nikgraf merged commit 93241e0 into master Apr 2, 2016
@nikgraf nikgraf deleted the hook-arguments branch April 2, 2016 23:54
@bkniffler
Copy link
Member

Seems like a good move and very much inline with what I'd expect from the hooks; we won't always need every argument and we can always decide to add more arguments without breaking anything. No objection 👍

@ianstormtaylor
Copy link
Collaborator

+1 for this change, but I still don't see how this is better than passing the editor object itself.

@nikgraf
Copy link
Member Author

nikgraf commented Apr 4, 2016

@ianstormtaylor I talked to Isaac and none of the public methods are supposed to be used by people except focus. Even focus you don't need, since you can force the focus by manipulating the Selection.

I wonder if there is a use-case that would require to expose the editorContext to the plugins. I worried that people start to do hacky things like overwriting the behaviour of blockRendererFn because they couldn't figure out how to write a proper blockRendererFn for their plugin.

@juliankrispel
Copy link
Member

I'm all for restriction by default. All good things are better with a smaller API

Julian Krispel-Samsel
rainforestqa.com
goodafternoon.co

On Apr 5, 2016, at 01:51, Nik Graf notifications@github.com wrote:

@ianstormtaylor I talked to Isaac and none of the public methods are supposed to be used by people except focus. Even focus you don't need at you can force the focus by manipulating the Selection.

I wonder if there is a use-case that would require to expose the editorContext to the plugins. I worried that people start to do hacky things like overwriting the behaviour of blockRendererFn because they couldn't figure out how to write a proper blockRendererFn for their plugin.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants