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

Can't clear formatting of first line if it's a block node #2281

Closed
1 of 2 tasks
rfgamaral opened this issue Dec 15, 2021 · 3 comments · Fixed by #2284
Closed
1 of 2 tasks

Can't clear formatting of first line if it's a block node #2281

rfgamaral opened this issue Dec 15, 2021 · 3 comments · Fixed by #2284
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@rfgamaral
Copy link
Contributor

What’s the bug you are facing?

If the first line in the editor is a block node (like a heading), there's no way to clear formatting without a toolbar.

How can we reproduce the bug on our side?

  • Got to the editor on https://tiptap.dev front page
  • Type # Test to turn the paragraph into a heading
  • Select all text with Mod+A and delete it
    • Alternative, use Backspace to delete everything
  • Observe that the heading node is not cleared, and it's not possible to reset to a normal paragraph without a formatting toolbar

Can you provide a CodeSandbox?

No response

What did you expect to happen?

The block node (the heading) to be reset to a paragraph if ALL the node text was deleted.

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. 💖
@rfgamaral rfgamaral added the Type: Bug The issue or pullrequest is related to a bug label Dec 15, 2021
@philippkuehn
Copy link
Contributor

I created a PR for it. Any feedback? Here is a preview.

@rfgamaral
Copy link
Contributor Author

@philippkuehn Looks great, thanks for fixing this.

philippkuehn added a commit that referenced this issue Dec 16, 2021
* improve backspace handling

* revert codeblock changes

* revert codeblock changes

* fix tests

Co-authored-by: Philipp Kühn <[email protected]>
@cadars
Copy link
Contributor

cadars commented Dec 16, 2021

This is awesome, thanks much!

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.

3 participants