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

Bard content not including orderedList ProseMirror attributes in HTML output #9363

Closed
kristiana-s opened this issue Jan 19, 2024 · 2 comments
Labels

Comments

@kristiana-s
Copy link

kristiana-s commented Jan 19, 2024

Bug description

Have noticed that when writing lists in bard field - and if splitting list items with paragraphs in between, both in cms and the associated .md file, the list numbering is retained correctly. However this is not reflected when trying to output this text in antlers template. Have tried many modifiers but seems like the output of the renderProsemirrorToHtml method in Bard/Augmentor.php is stripping the marks out.

content in .md file

 bard:
  -
    type: heading
    attrs:
      level: 2
    content:
      -
        type: text
        text: test
  -
    type: orderedList
    attrs:
      start: 1
    content:
      -
        type: listItem
        content:
          -
            type: paragraph
            content:
              -
                type: text
                text: 'Lorem ipsum dolor sit amet, consectetur'
  -
    type: paragraph
    content:
      -
        type: text
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
  -
    type: orderedList
    attrs:
      start: 2
    content:
      -
        type: listItem
        content:
          -
            type: paragraph
            content:
              -
                type: text
                text: 'Lorem ipsum dolor sit amet, consectetur'
  -
    type: paragraph
    content:
      -
        type: text
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
  -
    type: orderedList
    attrs:
      start: 3
    content:
      -
        type: listItem
        content:
          -
            type: paragraph
            content:
              -
                type: text
                text: 'Lorem ipsum dolor sit amet, consectetur' ....

html as is output in the frontend - from {{bard|dump}} You can see no marks applied from orderedList to <ol> tags

   "type" => "text"
        "text" => 
Statamic\Fields
Value {#14880 
          #raw: "
<h2 id="test">test</h2><ol><li><p>Lorem ipsum dolor sit amet, consectetur</p></li></ol><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><ol><li><p>Lorem ipsum dolor sit amet, consectetur</p></li></ol><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><ol><li><p>Lorem ipsum dolor sit amet, consectetur</p></li><li><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></li><li><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></li></ol>"

Possibly related to an older issue - #454

How to reproduce

Create blueprint with bard field, enter text with a list broken up with paragraphs.
This can include sets

Output in template via following in template file

{{ bard }}
  {{ if type == "text" }}
    <div class="text">
      {{ text }}
    </div>
  {{ elseif type == "image" }}
    <div class="image">
      <img src="{{ image }}" alt="{{ caption }}" />
    </div>
  {{ /if }}
...

{{ /bard }}

Logs

No response

Environment

Laravel Version: 9.52.16
PHP Version: 8.2.11
Composer Version: 2.1.5
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Addons: 8
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.44.0 PRO

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

Runtime (default)

Additional details

No response

@jacksleight
Copy link
Contributor

jacksleight commented Jan 19, 2024

I suspect this is due to a bug in tiptap-php. I submitted a PR to fix it but it's not been merged yet: ueberdosis/tiptap-php#32

Might be worth giving that a 👍 .

@jasonvarga
Copy link
Member

jasonvarga commented Jan 19, 2024

This is a TipTap issue and @jacksleight has opened a PR to fix it already.
See ueberdosis/tiptap-php#32

Maybe give them a little ping there?

Edit: Oops he just commented all that. hah.

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

No branches or pull requests

4 participants