massiveart / husky

Other
19 stars 12 forks source link

Fix CKEditor preview for content that is not wrapped in an HTML tag #782

Closed YetiCGN closed 5 years ago

YetiCGN commented 5 years ago

The preview textarea for a property of type text_editor in Sulu breaks when the content is not wrapped in an HTML tag, e.g. just plain text without any HTML. This PR changes the code to fallback to the unmodified content in case it cannot be parsed as a DOM node by jQuery.

This occurs for example if a field is switched from text_area to text_editor and is not converted.

CKEditor will work just fine and will wrap the content in a new <p> tag when editing, but it doesn't get there if the preview errors out before. This change fixes the preview for plain text.

YetiCGN commented 5 years ago

I think the npm version used in the tests is too old (v1.2.30) to support the caret version constraints. Current npm version is 6.8.

YetiCGN commented 5 years ago

I give up trying to fix the Travis build. This setup is too old to fix in a few minutes. 😆

alexander-schranz commented 5 years ago

@YetiCGN the karma build is broken since longer time, and can be ignored.