trix icon indicating copy to clipboard operation
trix copied to clipboard

Quote and code blocks merge if adjacent

Open emilbruckner opened this issue 8 years ago • 6 comments

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

emilbruckner avatar Jul 30 '17 12:07 emilbruckner

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.

javan avatar Aug 22 '17 11:08 javan

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.

djhopper01 avatar Dec 12 '17 02:12 djhopper01

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 Sep 17 '18 19:09 stale[bot]

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.

emilbruckner avatar Sep 19 '18 11:09 emilbruckner

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

anew-bhav avatar Oct 05 '18 07:10 anew-bhav