Kendo Editor - Remove toolbar

11,859

Solution 1

If you don't want to show the toolbar define an empty tools in the KendoUI editor initialization:

$("#editor").kendoEditor({
    // Empty tools so do not display toolbar
    tools: [ ]
});

See it here http://jsfiddle.net/OnaBai/Eh6X2/

If you want to disable the edition, you should use:

// Disable edition
$(editor.body).attr('contenteditable',false);

And the following code selects all the text and converts it to bold, then deselects it.

var range = editor.createRange();
range.selectNodeContents(editor.body);
editor.selectRange(range);
editor.exec("bold");
editor.selectRange();

The full example here: http://jsfiddle.net/OnaBai/Eh6X2/3/

Solution 2

This works well in MVC using HTML wrappers

 @(Html.Kendo().EditorFor(m => m.Body).Tools(t => t.Clear()))

Solution 3

Hide toolbar with css:

.k-editor-toolbar {
    display: none !important;
}

This works for me (Asp.Net Core 3.0)...

Solution 4

if you want your kendoEditor textarea readonly then use below code,

$('iframe').contents().find("body").attr('contenteditable',false);

and if you want to disabled your toolbar then use this code,

$('.k-editor-toolbar').find('li a').click(function(){return false;})

Hide toolbar

$('.k-editor-toolbar').hide();
Share:
11,859
Hamdi Baligh
Author by

Hamdi Baligh

Mainly a .NET/T-SQL developer, I had a short experience with JAVA including Hibernate, JSF, Vaadin and many other Java EE apsects. With a focus on Microsoft technologies, I am trying everyday to improve my skills and share my knowledge with people having the same affinities as mine.

Updated on June 08, 2022

Comments

  • Hamdi Baligh
    Hamdi Baligh almost 2 years

    I am using kendo Editor and though... I want to disable the edit toolbar. Indeed, All I want is to have the possibility to format my textarea (bold, italic...) without allowing the user to interact with my textarea neither have a toolbar which will be very confusing to a user. I want it to be displayed like a normal readonly textarea, nothing else. I tried this :

    $("#output").kendoEditor();
    $($('#output').data().kendoEditor.body).attr('contenteditable', false);
    

    But it's not working. Any ideas?

    Edit

    I just want to have a simple textarea, I want to hide the toolbar and manipulate the content of the textarea programmatically since it is readonly.

  • Hamdi Baligh
    Hamdi Baligh about 10 years
    I just want to have a simple textarea, I want to hide the toolbar and manipulate the content of the textarea programmatically since it is readonly.
  • Jaimin
    Jaimin about 10 years
    if you want to hide the toolbar then use this, $('.k-editor-toolbar').hide()