Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API Bard ordered list not using start attributes #10770

Closed
davydokter opened this issue Sep 6, 2024 · 4 comments
Closed

REST API Bard ordered list not using start attributes #10770

davydokter opened this issue Sep 6, 2024 · 4 comments

Comments

@davydokter
Copy link

Bug description

While using bard with an ordered list. Within statamic it shows like the following:
image

In the markdown it is shown like this:

          -
            type: orderedList
            attrs:
              start: 2
            content:
              -
                type: listItem
                content:
                  -
                    type: paragraph
                    content:
                      -
                        type: text
                        marks:
                          -
                            type: bold
                        text: 'Lorem ipsum dolor sit amet'
          -

However within the Api, the html being sent is an ordered list without attributes. Like this:

<ol><li><p><strong>Lorem ipsum dolor sit amet </strong></p></li></ol><p>Lorem ipsum dolor sit amet</p><ol><li><p><strong>Lorem ipsum dolor sit amet</strong></p></li></ol><p>Lorem ipsum dolor sit amet</p><ol><li><p><strong>Lorem Ipsum dolor sit amet</strong></p></li></ol><p>Lorem ipsum dolor sit amet</p><ol><li><p><strong> Lorem ipsum dolor sit amet</strong></p></li></ol><p>Lorem ipsum dolor sit amet</p>"

This causes the HTML to be rendered like this:
image

How to reproduce

Enable the REST API,
Add a bard fieldset with ordered list option enabled to a page,
Use an ordered list with some text in between
Check API response

Logs

N/A

Environment

Environment
Application Name: Laravel
Laravel Version: 10.48.16
PHP Version: 8.2.23
Composer Version: 2.7.8
Environment: local
Debug Mode: ENABLED
URL: statamic.test
Maintenance Mode: OFF

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

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: daily
Mail: log
Queue: sync
Session: file

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.6.1
PHP SDK Version: 4.8.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: 4
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.45.0 PRO

Statamic Addons
goldnead/statamic-collapse-fieldtype: 1.0.5
statamic-rad-pack/runway: 6.7.1
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-seo: 8.15.3

Installation

Fresh statamic/statamic site via CLI

Additional details

N/A

@duncanmcclean
Copy link
Member

Are you able to provide the full value for the Bard field (the YAML in the entry's markdown file)?

@davydokter
Copy link
Author

The YAML i'm loading is as followed:

  -
    handle: text_rich
    field:
      buttons:
        - h1
        - h2
        - h3
        - h4
        - h5
        - bold
        - italic
        - unorderedlist
        - orderedlist
        - removeformat
        - anchor
      save_html: false
      toolbar_mode: fixed
      link_noopener: true
      link_noreferrer: true
      container: assets
      target_blank: true
      reading_time: false
      fullscreen: true
      allow_source: true
      type: bard
      replicator_preview: false
      localizable: true
      listable: hidden
      display: 'Tekst met blokken'
      instructions_position: above
      always_show_set_button: true
      enable_input_rules: true
      enable_paste_rules: true
      antlers: false
      sets:
        main:
          display: Main
          instructions: null
          icon: null
          sets:
            button:
              display: Knop
              instructions: null
              icon: null
              fields:
                -
                  import: button
            buttons:
              display: Knoppen
              instructions: null
              icon: null
              fields:
                -
                  import: buttons
            image:
              display: Afbeelding
              instructions: null
              icon: null
              fields:
                -
                  import: figure
            video:
              display: Video
              instructions: null
              icon: null
              fields:
                -
                  import: video
      visibility: visible
      collapse: false
      previews: true
      smart_typography: false
      inline: false
      remove_empty_nodes: false
      word_count: false
      hide_display: false
  -

I load this like so in my component:

  -
    handle: content
    field: common.text_rich
    config:
      display: Tekst
      sets:
        main:
          display: Main
          instructions: null
          icon: null
          sets:
            button:
              display: Knop
              instructions: null
              icon: null
              fields:
                -
                  import: button
            buttons:
              display: Knoppen
              instructions: null
              icon: null
              fields:
                -
                  import: buttons

The actual markdown i am getting within the page:

     -
        id: m0l40urh
        media_type: picture
        media_position: left
        image: test.webp
        content:
          -
            type: heading
            attrs:
              level: 3
            content:
              -
                type: text
                marks:
                  -
                    type: bold
                text: 'Lorem ipsum'
          -
            type: paragraph
            content:
              -
                type: text
                text: 'lorem ipsum'
          -
            type: orderedList
            attrs:
              start: 1
            content:
              -
                type: listItem
                content:
                  -
                    type: paragraph
                    content:
                      -
                        type: text
                        marks:
                          -
                            type: bold
                        text: 'Lorem Ipsum'
          -
            type: paragraph
            content:
              -
                type: text
                text: 'lorem ipsum'
          -
            type: orderedList
            attrs:
              start: 2
            content:
              -
                type: listItem
                content:
                  -
                    type: paragraph
                    content:
                      -
                        type: text
                        text: 'Lorem Ipsum'
          -
            type: paragraph
            content:
              -
                type: text
                text: 'lorem ipsum'
          -
            type: orderedList
            attrs:
              start: 3
            content:
              -
                type: listItem
                content:
                  -
                    type: paragraph
                    content:
                      -
                        type: text
                        text: 'Lorem Ipsum'
          -
            type: paragraph
            content:
              -
                type: text
                text: 'lorem ipsum'
          -
            type: orderedList
            attrs:
              start: 4
            content:
              -
                type: listItem
                content:
                  -
                    type: paragraph
                    content:
                      -
                        type: text
                        text: 'Lorem Ipsum'
          -
            type: paragraph
            content:
              -
                type: text
                text: 'lorem ipsum'
        type: text_media
        enabled: true
    type: sections
    enabled: true

It seems to only be doing this when you start a list like typing 2. then text, or 3. then text. Please let me know if i need to add on any information!

@jasonvarga
Copy link
Member

What version of ueberdosis/tiptap-php do you have installed? This was fixed in 1.4.0.
ueberdosis/tiptap-php#32

Try a composer update ueberdosis/tiptap-php

@davydokter
Copy link
Author

I just updated statamic in it self to the latest version of v4, this seemed to have updated tiptap-php & fixed the issue. Thanks both! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants