statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.11k stars 539 forks source link

Paragraph whitespace stripping in bard field #10847

Open LorensoD opened 2 months ago

LorensoD commented 2 months ago

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.

duncanmcclean commented 2 months ago

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

LorensoD commented 2 months ago

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 commented 2 months ago

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
philippe-tellier commented 2 weeks ago

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

jasonvarga commented 2 weeks ago

Please provide a repo with this problem reproduced.