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

Code block plugin can get paragraph elements inserted into it #1910

Closed
charrondev opened this issue Sep 30, 2022 · 3 comments · Fixed by #1911
Closed

Code block plugin can get paragraph elements inserted into it #1910

charrondev opened this issue Sep 30, 2022 · 3 comments · Fixed by #1911
Labels
bug Something isn't working

Comments

@charrondev
Copy link
Collaborator

charrondev commented Sep 30, 2022

Description

There's a bug where it's possible to get paragraph elements inserted directly into a code block plugin without them being normalized into code lines. This then breaks most custom behaviour for code blocks.

Steps

  1. Go to this codesandbox

Edit sandpack-project (forked)

  1. Delete the last line of the codeblock.
  2. Delete the last paragraph of the document, backspacing into the codeblock.
  3. Notice that there is now a paragraph element in the codeblock.

Sandbox

https://codesandbox.io/s/sandpack-project-forked-s1kv7h

Expectation

Codeblock should only ever have code lines in it.

Environment

  • slate: 0.78
  • slate-react: 0.79
  • browser: chrome
@charrondev charrondev added the bug Something isn't working label Sep 30, 2022
@O4epegb
Copy link
Collaborator

O4epegb commented Oct 18, 2022

I also saw the opposite issue, when code lines are created outside of code block, but I can't reproduce it right now on Codesandbox because it throws an error:

Screenshot 2022-10-18 at 18 47 16

But it's reproducible in my app like that:

  1. Have an empty paragraph element
  2. Now make an empty code block after that
  3. Press backspace to delete code block
  4. Now you have empty code line without code block in place of the paragraph

@charrondev
Copy link
Collaborator Author

@O4epegb Right. I'll have a check and see if I can fix that too. I've been away from my PR for a little bit, but I should be able to wrap it up next week.

@O4epegb
Copy link
Collaborator

O4epegb commented Oct 20, 2022

@O4epegb Right. I'll have a check and see if I can fix that too. I've been away from my PR for a little bit, but I should be able to wrap it up next week.

Would be awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants