Header becomes a default block when merged into adjacent empty block
When either pressing delete or backspace to merge a header into an empty block, the header becomes a default block.
Steps to Reproduce
- Go to trix-editor.org
- Place cursor at beginning of header like so: "[]Trix"
- Press enter to create empty block above the header
- Press the "backspace"-key
- Header is merged with the empty block, and becomes a default block
or
- Go to trix-editor.org
- Place cursor at beginning of header like so: "[]Trix"
- Press enter to create empty block above the header
- Press up-arrow to move the selection to the empty line
- Press the "delete"-key
- Header is merged with the empty block, and becomes a default block
Expected result: Header would remain a header and empty block would be deleted
Details
- Trix version: 0.11.4
- Browser name and version: All
- Operating system: All
Similar issue for DraftJS can be found here: https://github.com/facebook/draft-js/issues/190 With a PR that was never merged here: https://github.com/facebook/draft-js/pull/266
That's the intended behavior when pressing delete at the beginning of a formatted block. It's the same for all block attributes (heading, quote, etc):
https://github.com/basecamp/trix/blob/fe324b47bfbae019235f6032b3fdf7090be26627/src/trix/models/composition.coffee#L139-L146 ↓

I'm open to changing this behavior for certain conditions if there's a compelling reason to. Just noting that it's working as designed, currently.
This issue has been automatically marked as stale after 90 days of inactivity. It will be closed if no further activity occurs.