Default Font Select Value Instead Of "inherited font".

1 Answer 241 Views
DropDownList Toolbar
Ralph
Top achievements
Rank 1
Ralph asked on 17 Aug 2023, 07:45 AM | edited on 17 Aug 2023, 07:46 AM
I'm using the kendo editor tool for a rich text editor, and I want to change the default font family. No matter what I do (I've tried accessing the HTML element by jQuery and DOM selectors and change its value), the selected font stays "inherited font" option, what should I do? (Same goes for "inherited size", for the font size)

1 Answer, 1 is accepted

Sort by
0
Zornitsa
Telerik team
answered on 21 Aug 2023, 02:27 PM

Hello Ralph,

The described behavior you are experiencing is expected, since the value of the fontSize and fontName tools of the Editor depend on the selected text from the content area. The inherited values represent an absence of a specifically defined value for a selected element.

Therefore, (inherited font) and (inherited size) are the default values of the corresponding tools because they are inherited from the respective selected body element, i.e. they are not defined by an external value.

In order to display different default values for the fontSize and fontName tools, I would suggest using the exec method of the Editor component:

var editor = $("#editor").data("kendoEditor");

editor.exec("fontName", {value:'Arial'});
editor.exec("fontSize", {value:'15px'});

However, as you might notice, the chosen default values still would not be explicitly applied to the text.

Below you can find a simple Dojo example, in which you can observe the suggested approach:

If further questions arise, please let me know.

Regards,
Zornitsa
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
DropDownList Toolbar
Asked by
Ralph
Top achievements
Rank 1
Answers by
Zornitsa
Telerik team
Share this question
or