This is a migrated thread and some comments may be shown as answers.

Change the background color of a Kendo Editor text area

4 Answers 1327 Views
Editor
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 Feb 2015, 07:41 PM
I have a number of Kendo Editor's used in my application.  Much of the text entered via the Editor will be displayed in a Kendo Grid.  I am using the Black theme, so the background color in the grid is a gray, which is fine.  The background color of the Kendo Editor text area is white.  I want to change that from white to a gray, or the same color as the grid background.  This way you will be able to enter the text as it will appear in the grid

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 20 Feb 2015, 11:18 AM

Hello John,

You can achieve this either by adding a stylesheet to the editor content via the stylesheets configuration option, or via JavaScript by accessing the body field (the example in the documentation shows exactly this).

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
John
Top achievements
Rank 1
answered on 20 Feb 2015, 04:06 PM
Your suggestion does not work, I do get a colored background but its a mess.

Without the <script> code I get

which look nice, except I want it with a gray background.  When I add the <script> code
    $("#editor").kendoEditor();
    var editor = $("#editor").data("kendoEditor");
    editor.body.style.backgroundColor = "gray";
I get this.


I have attached my .cshtml file in Test.zip


0
John
Top achievements
Rank 1
answered on 20 Feb 2015, 04:09 PM
The screen shots
0
Alex Gyoshev
Telerik team
answered on 24 Feb 2015, 10:08 AM

Hello John,

Based on the screenshots that you posted, it appears that you are initializing the editor twice on the same element, which is not supported. Instead, get hold of the editor instance and use the body field:

@(Html.Kendo().Editor().Name("editor"))

<script>
    $("#editor").data("kendoEditor").body.style.background = "gray";
</script>

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
John
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
John
Top achievements
Rank 1
Share this question
or