verbb / vizy

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

List items have nested paragraph tags by default #153

Closed alexroper closed 1 year ago

alexroper commented 2 years ago

Description

When creating ordered and unordered lists, list items have nested paragraph tags by default.

<ul>
    <li>
        <p>Test</p>
    </li>
</ul>

You can see this behavior by revealing the HTML code on the Vizy field itself, or by rendering the field on the front end like this:

{{ entry.text.renderHtml() }}

The expected behavior is that paragraph tags are converted into <li> tags instead of wrapping them when the list button is clicked. Expected output would be:

<ul>
    <li>Test</li>
</ul>

Steps to reproduce

  1. Create an unordered list in a Vizy field.
  2. There is no step 2.

Additional info

Additional context

alexroper commented 2 years ago

I think this is a default behavior inherited from ProseMirror. It happens in their basic example:

https://prosemirror.net/examples/basic/

I'm not sure if it's possible to override this. It's unfortunate that this is the default behavior. Neither Redactor nor CKEditor behave this way. It's perplexing, but I'm guessing this is an intentional choice by ProseMirror's authors.

engram-design commented 2 years ago

Yeah, it's a known issue coming from ProseMirror I'm afraid. I've looked up ways to handle it, and I think it comes down to how new items are handled, and marks like Bold, Italic, etc are handled.

But there are some potential changes that I'll need to test out.

engram-design commented 1 year ago

Fixed in 2.1.0