trix icon indicating copy to clipboard operation
trix copied to clipboard

Header becomes a default block when merged into adjacent empty block

Open oskarolsson-jimdo opened this issue 8 years ago • 3 comments

When either pressing delete or backspace to merge a header into an empty block, the header becomes a default block.

Steps to Reproduce
  1. Go to trix-editor.org
  2. Place cursor at beginning of header like so: "[]Trix"
  3. Press enter to create empty block above the header
  4. Press the "backspace"-key
  5. Header is merged with the empty block, and becomes a default block

or

  1. Go to trix-editor.org
  2. Place cursor at beginning of header like so: "[]Trix"
  3. Press enter to create empty block above the header
  4. Press up-arrow to move the selection to the empty line
  5. Press the "delete"-key
  6. 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

oskarolsson-jimdo avatar Jul 12 '18 16:07 oskarolsson-jimdo

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 ↓ delete-merge

javan avatar Aug 12 '18 16:08 javan

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.

javan avatar Aug 12 '18 16:08 javan

This issue has been automatically marked as stale after 90 days of inactivity. It will be closed if no further activity occurs.

stale[bot] avatar Nov 10 '18 16:11 stale[bot]