ueberdosis / tiptap-php

A PHP package to work with Tiptap content
https://tiptap.dev
MIT License
171 stars 26 forks source link

Ordered List incompatible with Tiptap JS #47

Open JshGrn opened 4 months ago

JshGrn commented 4 months ago

I save content to my database with tiptap editor, the output json from the editor is this:

'{"type":"doc","content":[{"type":"orderedList","attrs":{"start":2},"content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Test text here "}]}]}]}]}';

However, when this is passed into tiptap-php with setContent and then getHTML, the ol element has no order attribute. If I modify the json above to have order instead of start it works as expected. I believe this to be a bug in tiptap-php and not tiptap js.

This is re-produceable with the below code:

Incorrect:

 $content = '{"type":"doc","content":[{"type":"orderedList","attrs":{"start":2},"content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Test text here "}]}]}]}]}';
 echo (new Editor())
     ->setContent($content)
     ->getHTML();

Correct:

 $content = '{"type":"doc","content":[{"type":"orderedList","attrs":{"order":2},"content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Test text here "}]}]}]}]}';
 echo (new Editor())
     ->setContent($content)
     ->getHTML();
JshGrn commented 3 months ago

Hi has there been any update or anyone been able to look into this issue?