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

Handling of div is problematic #17

Closed
pbauer opened this issue Dec 2, 2022 · 0 comments
Closed

Handling of div is problematic #17

pbauer opened this issue Dec 2, 2022 · 0 comments

Comments

@pbauer
Copy link
Member

pbauer commented Dec 2, 2022

This text: "<div><b>Foo</b> <br /><br />Bar</div>"

Creates the following blocks:

{'1e09e7a9-9bb1-47bc-a3e5-f982d2424dfe': {'@type': 'slate', 'plaintext': '', 'value': ['\n']},
 '4e4d3c39-7eec-469f-977b-0bc93cd97d3e': {'@type': 'slate', 'plaintext': 'Foo', 'value': [{'children': [{'text': 'Foo'}], 'type': 'strong'}]},
 'd0e71e76-332c-480d-8e32-1623ecb32179': {'@type': 'slate', 'plaintext': '', 'value': ['\n']}}

Bar is missing and the ['\n'] create these tracebacks:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.content.get, line 16, in reply
  Module plone.restapi.serializer.dxcontent, line 159, in __call__
  Module plone.restapi.serializer.dxcontent, line 111, in __call__
  Module plone.restapi.serializer.blocks, line 82, in __call__
  Module plone.restapi.serializer.blocks, line 69, in apply_block_serialization_transforms
  Module plone.restapi.deserializer.blocks, line 265, in __call__
AttributeError: 'str' object has no attribute 'get'

Without the line-breaks it is also broken:

"<div><b>Foo</b> Bar</div>" drops the Bar:

{'ea9dff8a-7164-42dd-95a0-d57f49621bd1': {'@type': 'slate', 'plaintext': 'Foo', 'value': [{'children': [{'text': 'Foo'}], 'type': 'strong'}]}}

Inside a <p> the result is ok: <p><b>Foo</b> <br /><br />Bar</p>

{'5868681d-3aea-4e41-b3cf-d95affacf945': {'@type': 'slate',
                                          'plaintext': 'Foo Bar',
                                          'value': [{'children': [{'children': [{'text': 'Foo'}], 'type': 'strong'}, {'text': '\n\nBar'}],
                                                     'type': 'p'}]}}

Example: https://plone.org/foundation/materials/privacy

pbauer added a commit that referenced this issue Dec 3, 2022
davisagli added a commit that referenced this issue Dec 3, 2022
@ericof ericof closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants