Angular Kendo Editor Bug

1 Answer 124 Views
Editor
Josh
Top achievements
Rank 1
Josh asked on 16 Oct 2024, 02:57 AM

There is a bug in the Angular Kendo Editor, whereby it treats any semicolon in the style attribute as a CSS property delimiter. However, not all semicolons are CSS property delimiters, as I will show in an example below.

Version:    "@progress/kendo-angular-editor": "16.8.0".

Set the value property of <kendo-editor>  to the below value: 

<p  style="background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo)"> </p>

Note the semicolon in the URL parameter between svg+xml and base64.

When you load the editor, you will get the following error:

TypeError: Cannot read properties of undefined (reading 'trim')
    at http://localhost:9090/dev-build/vendor.js:81983:45
    at Array.forEach (<anonymous>)
    at applyStyle (http://localhost:9090/dev-build/vendor.js:81981:98)
    at http://localhost:9090/dev-build/vendor.js:81989:5
    at Array.forEach (<anonymous>)
    at restoreStyleAttr (http://localhost:9090/dev-build/vendor.js:81986:65)
    at htmlToFragment (http://localhost:9090/dev-build/vendor.js:82001:3)
    at parseContent (http://localhost:9090/dev-build/vendor.js:82041:15)
    at EditorComponent.initialize (http://localhost:9090/dev-build/vendor.js:324747:100)
    at Object.next (http://localhost:9090/dev-build/vendor.js:324378:155)

The error seems to be occurring in the file

./node_modules/@progress/kendo-drawing/dist/es2015/svg/utils/render-svg.js

Below is the problematic code. It assumes that any semicolon is a CSS property delimiter, but this is not true, as in the example above,

where the semicolon is part of the CSS value.

const applyStyle = (styleString, element) => styleString.split(';').filter(s => s !== '').forEach(s => {
  const parts = s.split(':');
  element.style[parts[0].trim()] = parts[1].trim();
});
The code is crashing on line 3 above, as there is no 1st element of the parts array.

1 Answer, 1 is accepted

Sort by
0
Yanmario
Telerik team
answered on 17 Oct 2024, 11:22 AM | edited on 18 Oct 2024, 09:30 AM

Hi John,

Our team is aware of this bug and it can be tracked in:

https://github.com/telerik/kendo-angular/issues/4439

This is valid for Kendo Angular, Blazor, React, and Vue libraries as they use the same common package for the problematic logic.

Regards,
Yanmario
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Josh
Top achievements
Rank 1
commented on 18 Oct 2024, 03:49 AM | edited

@Yanmario

I can't access the webpage at the link you provided. Is it because the repo is private?

Anyway, do you know when the bug will be fixed? We are trying to decide if we should wait for you to fix it, or if we should remove the problematic semicolons from our data.

Yanmario
Telerik team
commented on 18 Oct 2024, 09:31 AM

Hi John,

I have created a public issue for tracking purposes and my initial comment was also updated.

Regards,
Yanmario
Progress Telerik
Tags
Editor
Asked by
Josh
Top achievements
Rank 1
Answers by
Yanmario
Telerik team
Share this question
or