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

Heading with anchor in it will create a broken block #15

Open
pbauer opened this issue Dec 2, 2022 · 5 comments
Open

Heading with anchor in it will create a broken block #15

pbauer opened this issue Dec 2, 2022 · 5 comments

Comments

@pbauer
Copy link
Member

pbauer commented Dec 2, 2022

This html : <h2><a name="fairuse"></a>Examples of Fair Use of the Plone Trademark</h2> will result in the following broken block:

 "e1dfcb82-7463-4db4-885b-1057e63b60ca": {
  "@type": "slate",
  "value": [
   {
    "type": "h2",
    "children": [
     {
      "type": "link",
      "data": {
       "url": null,
       "title": null,
       "target": null
      },
      "children": [
       {
        "text": ""
       }
      ]
     },
     {
      "text": "Examples of Fair Use of the Plone Trademark"
     }
    ]
   }
  ],
  "plaintext": "Examples of Fair Use of the Plone Trademark"
 },
@davisagli
Copy link
Member

@tiberiuichim Is there a way to represent an anchor in slate?

@tiberiuichim
Copy link

tiberiuichim commented Dec 3, 2022

@davisagli No, here's the code that renders the above data:

https://github.com/plone/volto/blob/6cb3cfab77e9ddc9e32dc29dd45652881db91542/packages/volto-slate/src/editor/plugins/Link/render.jsx#L4-L14

In principle it's a simple matter of stashing some data in the link element and rendering it in the ViewLink component.

@davisagli
Copy link
Member

@tiberiuichim Thanks. Though, semantically here maybe it makes more sense as a property of the heading. So maybe it has some relation to plone/volto#3540 then...

@tiberiuichim
Copy link

@davisagli oh, right, I forgot about that PR :( I should finish it maybe

@pbauer
Copy link
Member Author

pbauer commented Dec 3, 2022

I'm working around that issue for the plone.org migration by dropping the anchors here: plone/plone.org@dedc1d0#diff-80a050ecf679f4bda74b9fa99abf9b8ab3211a301b62a5b826430d52194e4839R211

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

3 participants