verbb / vizy

A flexible visual editor for Craft CMS
Other
44 stars 8 forks source link

Extra line breaks added to Redactor fields #100

Closed alexroper closed 2 years ago

alexroper commented 2 years ago

Description

When using a Redactor field inside a Vizy block, html block elements will have double line breaks between them after saving the entry. The problem does not appear in the same Redactor field used outside of Vizy.

Before saving:

Screen Shot 2022-02-09 at 2 50 38 PM

After saving:

Screen Shot 2022-02-09 at 2 51 00 PM

The HTML looks clean as expected without any extra elements or strange characters:

Screen Shot 2022-02-09 at 2 55 37 PM

I think I tracked the problem down to this CSS:

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
    white-space: pre-wrap;
}

Disabling white-space: pre-wrap in dev tools fixes the problem.

Steps to reproduce

  1. Create a Vizy block with a redactor field inside.
  2. Create an entry and add multiple lines to the redactor field.
  3. Save the entry.
  4. Edit the entry again. There will be double line breaks between html block elements instead of single line breaks.

Additional info

Additional context

engram-design commented 2 years ago

Fixed for the next release. To get the fix early, change your verbb/vizy requirement in composer.json to:

"require": {
  "verbb/vizy": "dev-craft-3 as 1.0.9",
  "...": "..."
}

Then run composer update.

engram-design commented 2 years ago

Fixed in 1.0.10