Developer forum

Forum » PIM » Field type "Editor" with broken HTML leads to inclusion of PIM edit page into content fields

Field type "Editor" with broken HTML leads to inclusion of PIM edit page into content fields

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have a custom product field of type Editor. For some reason, that field in the database contains broken / incomplete HTML for a number of products. Not sure where that started: on import, user error or a bug in Dynamicweb. However, once it's there, the problem gets worse as parts of the HTML of the PIM management page are added to the field. I think this happens because the HTML in the custom field is incomplete and invalid, therefore breaking the contenteditable behavior of the field in the browser. Here's an example of the bad data I have for a field:

Størrelser:<div><b style=box-sizing: border-box; color: rgb(44, 56, 68); font-family: Roboto, sans-serif; font-size: 15px;>1</b><span style=color: rgb(44, 56, 68); font-family: Roboto, sans-serif; font-size: 15px;>&nbsp;= 15,5 cm</span><br style=box-

That then leads to this in the PIM UI when editing that field:

Note how the Edit Text links have moved into the control for the field. That means if I save this page, the product now contains the Edit Text link + more HTML. Each time you save, the field's HTML gets bigger and bigger.

Can this be fixed so the Editor field can handle invalid HTML?

Thanks!

Imar


Replies

 
Kristoffer Krusborg Jensen Dynamicweb Employee
Kristoffer Krusborg Jensen
Reply

Hi! 

I'm currently experiencing the same thing with ProductShortDescription, which is not a custom field, but also an editor field. 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yep, I've seen it happen there too. I think it's using the same implementation for the control.

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump! Can this be confirmed as a bug and maybe get fixed?

Thanks!

Imar

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Imar

It might be a bug.

How would you expect it should behave - should we remove the markup and leave the text or html encode the string if the markup is invalid? Or simply write 'invalid markup' and show an empty editor?

I am not sure we can fix the markup correctly.

BR Nicolai

 
Søren Jensen Dynamicweb Employee
Søren Jensen
Reply

 

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> How would you expect it should behave

Good question. Guess encoding it seems the best option as it allows you to keep what you have and then manually fix it.

Imar

 

You must be logged in to post in the forum