cms icon indicating copy to clipboard operation
cms copied to clipboard

Paragraph whitespace stripping in bard field

Open LorensoD opened this issue 1 year ago • 3 comments

Bug description

After upgrading to Statamic 5, I’ve encountered an issue where the Bard field is stripping whitespace in certain situations. Specifically, when using bold text or hyperlinks within a paragraph, the spaces before and after the formatted text are removed, causing words to run together.

Bard field before saving: image

Html source before saving: image

Bard field after saving: image

Html source after saving: image

How to reproduce

  1. Create or edit an entry with a Bard field.
  2. Type a paragraph of text.
  3. Within the paragraph, select a word or phrase in the middle and apply bold formatting or insert a link.
  4. Save the entry.
  5. View the published content or revisit the editor.

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.21.0
PHP Version: 8.3.11
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: --
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: redis
Session: redis

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.8.0
PHP SDK Version: 4.9.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 2
Sites: 4 (Dutch, English, German, French)
Stache Watcher: Enabled
Static Caching: full
Version: 5.26.0 PRO

Statamic Addons
webographen/statamic-widget-continue-editing: 1.3.2
withcandour/aardvark-seo: 5.0.0

Installation

Fresh statamic/statamic site via CLI

Additional details

I use sets in my bard field. The bard field does not Save as HTML.

LorensoD avatar Sep 26 '24 11:09 LorensoD

Is this happening on the frontend too, or just when you view the source HTML in the Bard editor?

duncanmcclean avatar Sep 26 '24 13:09 duncanmcclean

Is this happening on the frontend too, or just when you view the source HTML in the Bard editor?

I'm using the Rest API. And there the rendered html in the json response is also missing whitespace.

LorensoD avatar Sep 26 '24 19:09 LorensoD

After the V5 upgrade when I save a page with Bard fields, without making any content changes, it results in the whitespace being stripped. I get this change in the markdown/yaml content file of the page:

image image

LorensoD avatar Sep 27 '24 06:09 LorensoD

I'm experiencing the exact same issue. Has anyone found a solution?

philippe-tellier avatar Nov 06 '24 20:11 philippe-tellier

Please provide a repo with this problem reproduced.

jasonvarga avatar Nov 06 '24 23:11 jasonvarga

Fixed by #11127

philippe-tellier avatar Nov 28 '24 19:11 philippe-tellier