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

Unable to set whiteSpace style on NodeViewWrapper & NodeViewContent #2883

Closed
1 of 2 tasks
EvitanRelta opened this issue Jun 15, 2022 · 0 comments · Fixed by #2884
Closed
1 of 2 tasks

Unable to set whiteSpace style on NodeViewWrapper & NodeViewContent #2883

EvitanRelta opened this issue Jun 15, 2022 · 0 comments · Fixed by #2884
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@EvitanRelta
Copy link
Contributor

What’s the bug you are facing?

Passing whiteSpace in the style prop of NodeViewWrapper and NodeViewContent elements doesn't work.

image

Rendered HTML:
image


image

Rendered HTML:
image

Which browser was this experienced in? Are any special extensions installed?

Nothing special.

How can we reproduce the bug on our side?

Attempt to pass whiteSpace: "pre" in the style prop of NodeViewContent & NodeViewWrapper in @tiptap/react.

For example:
image

And you'll see the white-space style on the rendered HTML elements won't be set to pre.
image

Can you provide a CodeSandbox?

https://codesandbox.io/s/intelligent-wildflower-wt6zb8?file=/src/Editor/CodeBlockComponent.test.js

The CodeSandbox example is the same as the React example from https://tiptap.dev/examples/syntax-highlighting, but with the style prop being declared on the NodeViewWrapper and NodeViewContent elements, as shown:

<NodeViewWrapper
  className="code-block"
  style={{
    color: "blue",
    whiteSpace: "pre"
  }}
>
<NodeViewContent
  as="code"
  style={{
    color: "red",
    whiteSpace: "pre"
  }}
/>

If you run the tests, it'll say that has the 2 color styles are set as red/blue, but not white-space: pre styling.

What did you expect to happen?

For it the whiteSpace style to reflect on the rendered HTML.

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant