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

[Solved] How to explicitly exclude some features of editor?

0 Answers 87 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yalamarty
Top achievements
Rank 1
Yalamarty asked on 15 Nov 2011, 11:02 AM
hi,

I am using Telerik MVC Editor in my application. I have put the editor in a user control and defined a router to get the html generated by that. I am using that HTML in JQuery post to display the editor with the contents from DB.

I am able to do the above functionality. But there are some scenarios where I dont need to provide the user with Image browser, HTML Pop up etc.

is there any way i can restrict with out duplicating the code.

My Code Block of the editor user control:
<%= Html.Telerik().Editor()
            .Encode(false)
            .Name(Model.Id+"body")
            .Value(Model.Body)
            .Tools(tools => tools.Clear()       // remove the existing tools from the default configuration
                        .Bold()                 // "bold" command
                        .Italic()               // "italic" command
                        .Underline()            // "UnderLine" command
                        .Separator()            // separator item
                        .InsertUnorderedList()  // "insert unordered list" command
                        .InsertOrderedList()    // "insert ordered list" command
                        .Separator()            // separator item
                        .CreateLink()           // "Create Link" command
                        .Unlink()               // "unlink" command
                        .Separator()            // separator item
                        .Custom(settings => settings.HtmlAttributes(new { @class = "t-html", onclick = "showHtml(event)" }))
                        .Custom(code => code.HtmlAttributes(new { @class = "t-code", onclick = "showCode(event)", @Title="Insert Code Block" }))
                        .Separator()            // separator item
                        .InsertImage()
            )
            .FileBrowser(browser => browser.Browse("Browse", "ImageBrowser")
                                           .Thumbnail("Thumbnail", "ImageBrowser")
                                           .Upload("Upload", "ImageBrowser")
                                           .DeleteFile("DeleteFile", "ImageBrowser")
                                           .DeleteDirectory("DeleteDirectory", "ImageBrowser")
                                           .CreateDirectory("CreateDirectory", "ImageBrowser"))
            .StyleSheets(styleSheets => styleSheets.Add("TelerikEditorStyles.css"))
            .ClientEvents(events => events.OnLoad("Editor_onLoad"))
    %>

Code for calling the user control in my page.
<div id="editor">
      <% Html.RenderPartial("TelerikTextEditor", new TelerikEditorViewModel() {Id = "", Body=""}); %>
      <input type="hidden" name="attachmentIds" />
</div>

Here while calling this user control which holds the editor initialization i want to disable image insert for the users.

How can i achieve it.

thanks,
Sundeep.
Tags
Editor
Asked by
Yalamarty
Top achievements
Rank 1
Share this question
or