Hello, i am using KendoReact Editor as a wysiwyg html editor and when I insert script tag and push update
script tag is automatically removed, i tried to add script tag to editor's schema
but it had no effect, maybe i am doing something wrong? Please tell me how can i add support for script tag?
1 Answer, 1 is accepted
1
Accepted
Vessy
Telerik team
answered on 22 Nov 2022, 03:28 PM
Hello, Andrei,
As per your assumption, the Editor applies certain rules to the HTML in order to achieve consistency but you can change that behavior by customizing the default schema based on your own requirements. For convenience, I have created a sample demonstrating a possible option to allow the `script` tags, you can test it here (refer the schema.ts file):
Please, give this example a try and let me know if I can assist you any further on this matter.
Regards,
Vessy
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
is there a way to avoid this kind of behaviour and make so editor pass all the attributes as they are?
Vessy
Telerik team
commented on 25 Nov 2022, 03:57 PM
Hi, Andrei,
The allowed attributes also can be configured through the schema, for convenience, I have updated the provided sample to showcase how to allow the listed data- attributes for the <div>:
we can't predict which attributes will be inserted by user, is there a way to permit all attributes as they are inserted?
Vessy
Telerik team
commented on 30 Nov 2022, 07:51 AM
Hi, Andrei,
The desired behavior can be achieved by defining a custom NodeView for the rendering of the elements where you want to allow all kind of attributes (e.g. for `div`) and override the div definition in the schema. Please, have in mind that allowing all attributes of an element could lead to many security issues, and we strongly do not recommend it.