verbb / vizy

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

Can't delete initial <p> tag #169

Closed anchovy closed 1 year ago

anchovy commented 2 years ago

Describe the bug

When in a vizy field if you add a block then add a line break before the block it's impossible to delete the line break without switching to the html view and manually deleting the `

' tag.

Steps to reproduce

  1. Add a block to a new empty vizy field.
  2. Add a line break before the block - you'll now get the '+' icon enabling you to add another block.
  3. Press 'delete' to remove the line break - nothing happens.
  4. Click the 'HTML' option in the editor
  5. Code shows the following:
    1: <p></p>
    2: <vizy-block>{"id".... </vizy-block>

Craft CMS version

Craft Pro 3.7.50

Plugin version

1.0.17

Multi-site?

No

Additional context

No response

engram-design commented 2 years ago

This is largely unavoidable behaviour for the moment, to ensure that a line break can be inserted to show the "add block" button. I'd recommend enabling the "Remove Empty Paragraphs" option for the field.

engram-design commented 1 year ago

After some further research, this is the behaviour of ProseMirror. It always needs a paragraph node (or a similar block level node) to start with, and there's nothing we can do about that.

However, what we can do on our end is remove any empty paragraphs (see field setting). If this really bugs you and you want a "blocks only" mode, that will be achievable in https://github.com/verbb/vizy/issues/16