cms icon indicating copy to clipboard operation
cms copied to clipboard

Bard: When empty, save as empty, don't save alone `<p>` tags

Open duncanmcclean opened this issue 4 years ago • 1 comments

Bug description

If you have a Bard field with content, then you remove the contents in Bard. It will just save empty p tags (eg. <p></p>). This makes it hard to check whether something exists.

Where you'd expect this to work:

{{ if banner_content }}
  {{ banner_content }}
{{ /if }}

You actually have to do this:

{{ if banner_content && banner_content|strip_tags|is_empty == false }}
  {{ banner_content }}
{{ /if }}

Ideally (in my head) it should just save as null or similar? Maybe I'm wrong?

How to reproduce

  1. Create Bard field
  2. Put content in bard field
  3. Take content out of Bard field via CP
  4. Try to check if Bard content exists (it will)

Logs

No response

Versions

Statamic 3.2.4 Pro Laravel 8.60.0 PHP 7.4.13 rias/statamic-redirect 1.4.7 statamic/migrator dev-master withcandour/aardvark-seo 2.0.15

Installation

Other (please explain)

Additional details

Migration from v2

duncanmcclean avatar Oct 13 '21 14:10 duncanmcclean

@duncanmcclean I'm still getting this behavior (saving empty <p></p> tags). You?

adnankussair avatar Jun 23 '22 23:06 adnankussair

Just tested this one again and it seems to be fixed.

duncanmcclean avatar Nov 24 '23 15:11 duncanmcclean