plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

[draft] Provide a JsonCompatible adapter for RichTextValue objects

Open erral opened this issue 2 years ago • 6 comments

Fixes #1583

erral avatar Feb 13 '23 16:02 erral

@erral thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

mister-roboto avatar Feb 13 '23 16:02 mister-roboto

Deploy Preview for plone-restapi canceled.

Name Link
Latest commit 29d679a45b64246816bc60d1c680558d899df123
Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/63ea6980242d520008290caa

netlify[bot] avatar Feb 13 '23 16:02 netlify[bot]

Deploy Preview for plone-restapi canceled.

Name Link
Latest commit 127d596ed420ab5a9c0e8d6feaac1b137fc71636
Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/63ea693863815c000827eb05

netlify[bot] avatar Feb 13 '23 16:02 netlify[bot]

Your solution provides only the rendered safe-HTML. But what if we want to get the raw data from the field, for an editor or alike? This could be any content type as raw, i.e. markdown. I do not think this implementation is enough. I would expect something like a dict with output, raw and its configured types, i.e something like:

{
    "output": {
        "data": "<p>foo<p>",
        "type": "text/safe-html",
    "raw": {
        "data": "foo",
        "data": "text/plain",
}

jensens avatar Feb 14 '23 12:02 jensens

This is the initial draft.

I first checked what happens when you add a simple HTML as a default value of the RichText field. I will test further with some other values.

erral avatar Feb 14 '23 12:02 erral

OK! Since this is not a draft PR nor labels were applied, my understanding was like it is ready for review.

jensens avatar Feb 14 '23 22:02 jensens