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 a way to completely disable the default placeholder plugin #3077

Closed
wants to merge 2 commits into from

Conversation

ajpalkovic
Copy link

@ajpalkovic ajpalkovic commented Oct 23, 2019

I'd like to use slate-react, along with a custom placeholder.
The problem I'm running into though is that slate-react always adds the PlaceholderPlugin pretty much. Even setting the placeholder to an empty string will still actually add a magic div to the dom, and that's what breaking for me.

So, I figured adding support for passing exactly null in to disable the plugin would work well. Folks that don't pass in anything will still get the "default" of an "empty placeholder" so hopefully nothing breaks.

Is this adding or improving a feature or fixing a bug?

Improving a feature

What's the new behavior?

The placeholder plugin will not be added to the editor if the placeholder prop is exactly null.

How does this change work?

The placeholder plugin will not be added to the editor if the placeholder prop is exactly null.

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn prettier.)
  • The relevant examples still work. (Run examples with yarn watch.)

Does this fix any issues or need any specific reviewers?

Fixes: #
Reviewers: @ianstormtaylor

ajpalkovic and others added 2 commits October 23, 2019 10:28
I'd like to use slate-react, along with a custom placeholder.
The problem I'm running into though is that slate-react _always_ adds the PlaceholderPlugin pretty much.  Even setting the placeholder to an empty string will still actually add a magic div to the dom, and that's what breaking for me.

So, I figured adding support for passing _exactly_ null in to disable the plugin would work well.  Folks that don't pass in anything will still get the "default" of an "empty placeholder" so hopefully nothing breaks.
@ajpalkovic
Copy link
Author

fwiw, this is a screenshot of the html of the existing placeholder example. Notice that even though it specifies a custom PlaceholderPlugin, there's still an empty placeholder span added from the default instance of the plugin:
Screen Shot 2019-10-23 at 11 45 05 AM

@ianstormtaylor ianstormtaylor mentioned this pull request Nov 14, 2019
@ianstormtaylor
Copy link
Owner

Fixed by #3093.

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.

2 participants