Trix: Quote and code blocks merge if adjacent

Created on 30 Jul 2017  Â·  5Comments  Â·  Source: basecamp/trix

When there are no paragraphs between two blockquotes, the blockquotes get merged into one. That alone is a problem for me (I sort content by blocks), but the biggest problem is, that not even any newline is kept → two words of different paragraphs become a single word
It's the same with code-blocks

I would suggest that two blocks always stay two blocks.
Is there a quick way to solve this via the api?
Thank you

screen recording 2017-07-30 at 02 29 pm
screen recording 2017-07-30 at 02 30 pm

Steps to Reproduce
  1. in line 1, create a quote and write something
  2. press enter 3 times
  3. create a quote and write something
  4. delete line 2
Details
  • Trix version: latest, 10.2? trix-editor.org
  • Browser name and version: Chrome 59 (and latest Firefox & Safari)
  • Operating system: macOS
bug confirmed

Most helpful comment

Hey @emilbruckner, I've confirmed this issue and agree that the outcome is not correct. There should either be two blocks or a single merged block with a newline between the two texts after deleting the empty block. Curiously, it works correctly with heading blocks.

All 5 comments

Hey @emilbruckner, I've confirmed this issue and agree that the outcome is not correct. There should either be two blocks or a single merged block with a newline between the two texts after deleting the empty block. Curiously, it works correctly with heading blocks.

Hi @emilbruckner and @javan,

I was doing a little digging into this issue and documented a few things.

As @javan mentioned, it works correctly with heading blocks. The document ends up having two blocks with the heading1 attribute. The generated html is <h1>abc</h1><h1>def</h1>.

After following the steps to reproduce from @emilbruckner, the document also ends up having two blocks - this time with quote attribute. However, the generated html is <blockquote>abcdef</blockquote>.

I'm not too familiar with the source yet, so pardon me if any of this is obvious. If you set group: false for quote in src/trix/config/block_attributes.coffee, the generated html becomes <blockquote>abc</blockquote><blockquote>def</blockquote>. However, this breaks a handful of tests, so I'm not sure if this is the right to go about it.

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

I currently don’t work with trix, but I just tested this and the issue still exists. I haven’t looked into @djhopper01’s suggestion though

@javan I’ll leave it up to you whether this should be closed.

@javan I am interested to look into the issue and submit a PR possibly

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acapro picture acapro  Â·  3Comments

WhatFreshHellIsThis picture WhatFreshHellIsThis  Â·  4Comments

atuttle picture atuttle  Â·  4Comments

plainspace picture plainspace  Â·  4Comments

betorina picture betorina  Â·  3Comments