tiptap-php icon indicating copy to clipboard operation
tiptap-php copied to clipboard

Ordered List incompatible with Tiptap JS

Open JshGrn opened this issue 4 months ago • 1 comments

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 avatar Mar 06 '24 21:03 JshGrn

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

JshGrn avatar Apr 04 '24 15:04 JshGrn