Declined
Last Updated: 01 Apr 2021 15:58 by Ben Hayat
Ben Hayat
Created on: 01 Apr 2021 15:41
Category: UI for Blazor
Type: Feature Request
1
Question/Suggestion - Editor with no toolbar, readonly

Hello team;

Let's say, depending on the user's authorization level, we just want to show the content of the Editor as "Read-Only" with no toolbar. So it will basically looks like an HTML rendered content to them to read.

Is it possible to do so with Editor or can we add a feature to hide the toolbar and make it read only?

If not, what's the best way and lightest way to show the content as read-only on different devices based medias query?

Thanks!

2 comments
Ben Hayat
Posted on: 01 Apr 2021 15:58
Thanks Marin;
ADMIN
Marin Bratanov
Posted on: 01 Apr 2021 15:53

Hello Ben,

The editor offers the Enabled parameter for making it read only too

<TelerikEditor Enabled="false"></TelerikEditor>

Otherwise, a read only state would be a <div> with the content, so it does not make sense to make a special feature in the editor for something that's an if-block in the markup.

@if (hasPermissions)
{
    <TelerikEditor Enabled="false" @bind-Value="@TheContent"></TelerikEditor>
}
else
{
    //if you want to show as HTML encoded
    @*<div>@TheContent</div>*@

    // if you are OK with just renderingthe HTML unencoded
    <div>@( new MarkupString(TheContent) )</div>
}

@code{
    bool hasPermissions { get; set; }
    string TheContent { get; set; } = "<p>lorem ipsum</p>";
}

Regards,
Marin Bratanov
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.