We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello good people of Contentstack,
I have a bug report/question: I'm using the json-rte-serializer to convert Contentstack json rich text fields to html and back.
I'm having some trouble when the rich text includes a reference to an image in my assets, such as with this example:
Where the json rich text for the asset reads:
{ "type": "doc", "attrs": {}, "uid": "15f6598d47d64423bf741c2a8869aba1", "children": [ { "uid": "297d01bb8fa3427a9d1762fa618cc2c1", "type": "reference", "attrs": { "display-type": "display", "asset-uid": "blte303180181b60c6b", "content-type-uid": "sys_assets", "asset-link": "https://images.contentstack.io/v3/assets/blt16cd66e95c9bd033/blte303180181b60c6b/6634d8e33d07fbb1b8d9793d/Sphere.jpeg", "asset-name": "Sphere.jpeg", "asset-type": "image/jpeg", "type": "asset", "class-name": "embedded-asset", "alt": "Sphere.jpeg", "asset-alt": "Sphere.jpeg", "redactor-attributes": { "alt": "Sphere.jpeg", "position": "none", "caption": "Image Caption" }, "style": {}, "position": "none", "asset-caption": "Image Caption" }, "children": [ { "text": "" } ] } ], "_version": 1 }
and the jsonToHtml conversion yields:
jsonToHtml
<figure style="margin: 0"> <div style="display: inline-block"><img src="https://images.contentstack.io/v3/assets/blt16cd66e95c9bd033/blte303180181b60c6b/6634d8e33d07fbb1b8d9793d/Sphere.jpeg" alt="Sphere.jpeg" caption="Image Caption" class="embedded-asset" content-type-uid="sys_assets" type="asset" asset-alt="Sphere.jpeg" style="width: auto" data-sys-asset-filelink="https://images.contentstack.io/v3/assets/blt16cd66e95c9bd033/blte303180181b60c6b/6634d8e33d07fbb1b8d9793d/Sphere.jpeg" data-sys-asset-uid="blte303180181b60c6b" data-sys-asset-filename="Sphere.jpeg" data-sys-asset-contenttype="image/jpeg" data-sys-asset-caption="Image Caption" data-sys-asset-alt="Sphere.jpeg" data-sys-asset-position="none" sys-style-type="display"/> <figcaption style="text-align:center">Image Caption</figcaption> </div> </figure>
But when I take the resulting HTML and try to convert it back, using htmlToJson I get:
htmlToJson
{ "type": "doc", "uid": "4886ddaf349946bc9d9ebf1df10c5b25", "attrs": {}, "children": [ { "type": "img", "attrs": { "style": { "margin": "0px" }, "redactor-attributes": { "style": "margin: 0" } }, "uid": "90aafc2814334af293d30843e650bde6", "children": [ { "text": "" } ] } ] }
Witch results in a malformed image/field once used to update the original Contentstack entry.
Is this sort of to-and-from transformation not supported for assets/images? Or could this be a bug you folks could help me with?
Thanks!
(I'm using "@contentstack/json-rte-serializer": "^2.0.6" )
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello good people of Contentstack,
I have a bug report/question: I'm using the json-rte-serializer to convert Contentstack json rich text fields to html and back.
I'm having some trouble when the rich text includes a reference to an image in my assets, such as with this example:
![image](https://private-user-images.githubusercontent.com/73340371/327762538-fd2252c7-7ed5-4c56-831d-5bd766219b27.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2MTk5MzgsIm5iZiI6MTcyMDYxOTYzOCwicGF0aCI6Ii83MzM0MDM3MS8zMjc3NjI1MzgtZmQyMjUyYzctN2VkNS00YzU2LTgzMWQtNWJkNzY2MjE5YjI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDEzNTM1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVmYTE4Y2U1MmE0MzUwNTZjN2UyMjI2NTg4OTYzMWNjMjhkYTM2YjZkYmU1NWUxMDkzMDdjODk5NmZjNTM2OTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TjwcoxYhLFJAtELGEbXGe6Ao-HoCO_KzmDXy4Ae4JP8)
Where the json rich text for the asset reads:
and the
jsonToHtml
conversion yields:But when I take the resulting HTML and try to convert it back, using
htmlToJson
I get:Witch results in a malformed image/field once used to update the original Contentstack entry.
Is this sort of to-and-from transformation not supported for assets/images? Or could this be a bug you folks could help me with?
Thanks!
(I'm using "@contentstack/json-rte-serializer": "^2.0.6" )
The text was updated successfully, but these errors were encountered: