Customized button + Calling CleanFormatting

1 Answer 69 Views
Editor
Caio
Top achievements
Rank 1
Caio asked on 19 Jul 2021, 05:53 PM

Hello!

I created a custom tool using the BackgroundColorTool tutorial and inside my onClick method, I would like to call the cleanFormatting.

How do I do that?


const onClick = (e) => {
        EditorUtils.formatBlockElements(view, "p", EditorToolsSettings);

        e.preventDefault();
    };

1 Answer, 1 is accepted

Sort by
1
Stefan
Telerik team
answered on 20 Jul 2021, 05:43 AM

Hello, Caio,

I can suggest checking the following example that shows how to implement a clear format tool:

https://www.telerik.com/kendo-react-ui/knowledge-base/add-custom-tools-to-the-editor-and-customize-built-in-tools/#toc-clear-format-tool

I hope this is helpful.

Regards,
Stefan
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.

Caio
Top achievements
Rank 1
commented on 20 Jul 2021, 03:27 PM

Thank you Stefan! that solved my problem. However, if I just wanna call an existing prop tool (like cleaningformat), isnt a way like calling $(this).data(kendo-editor).exec('cleaning-format') ?
Stefan
Telerik team
commented on 21 Jul 2021, 04:57 AM

Currently, this requires the approach shown in the demo. The KendoReact components are specifically made for React and follow the React recommendations. This is why the approach is different than the one used in Kendo UI for jQuery.

If the developer want to make customization and still use the built-in logic of an existing tool, this is the supported way:

https://www.telerik.com/kendo-react-ui/components/editor/tools/#toc-customizing-built-in-tools
Tags
Editor
Asked by
Caio
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or