I'm trying to use the Blazor editor but the "Insert Image" function is very basic. Previously using Webforms & Core the insert image in the editor presented the user with a file management and image upload popup. Is this functionality available with the Blazor component?
=====ADMIN EDIT=====
Possible alternative:
It would be great in a future release if we could paste in images from the clipboard.
*** Thread created by admin on customer behalf ***
I would like to be able to customize the content of the Iframe in the Editor with CSS.
===
Telerik edit:
In the meantime, it is possible to inject CSS styles in the Editor <iframe> with JavaScript:
@inject IJSRuntime js
<TelerikEditor @bind-Value="@EditorValue" />
@* Move scripts to separate js files in production. *@
<script suppress-error="BL9992">
function injectEditorStyleTag() {
var doc = document.querySelector("iframe").contentWindow.document;
var head = doc.querySelector("head");
var style = doc.createElement("style");
style.type = "text/css";
var css = "body { background: #fed; font-size: 24px; }";
style.appendChild(doc.createTextNode(css));
head.appendChild(style);
}
</script>
@code {
private string EditorValue { get; set; } = "<p>The default font-size is 24px.</p>";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await js.InvokeVoidAsync("injectEditorStyleTag");
}
}
}
Hi,
I tried looking through the docs and api reference for the Blazor Editor, but I can't seem to find any resizable property like the one found in the ASP.NET Core component here: ASP.NET Core Editor - Api Reference | Telerik UI for ASP.NET Core
I just wanted to check that this feature is not included in the editor for Blazor before I submitted a feature request. I tried to search the requests as well and I didn't see this request listed.
If this feature does not exist, do you know if it is being currently considered for a future release or if there is a workaround?
Thank you,
Frank
An event that we can hook into so that we can take the (presumably) base64 encoded image (link), upload it somewhere, and then replace it with an image element set to the uploaded imaged file. Ideally, that would work for other content too.
*** Thread created by admin on customer behalf ***
Please expose the ability to allow additional HTML attributes in the Editor content.
===ADMIN EDIT===
Provide support for:
When I add table to Editor, dispose the component and initialize it again with the same content, the table cells appear taller. It looks like an additional <br class="ProseMirror-trailingBreak"> appears in every cell.
Reproduction: https://blazorrepl.telerik.com/cwaqcSuV12myl9ok47.
Steps to reproduce:
At the moment, commands are available both for color and background color, you can find them in the built-in tools list article - see the Back Color and Fore Color tools: https://docs.telerik.com/blazor-ui/components/editor/built-in-tools. You can use them as custom tools right now: https://docs.telerik.com/blazor-ui/components/editor/custom-tool - basic examples are also available in the demo: https://demos.telerik.com/blazor-ui/editor/custom-tools.
I would like to have them as built-in tools with predefined color pickers.
*** Thread created by admin on customer behalf ***
I do have a default word content available for the user, and the user will be able to change the content if required.
The track change feature would allow reviewers to quickly zoom into the edited wording (i.e. highlighted in red) for them to review quickly.
---
ADMIN EDIT
If such a feature were to be implemented as part of the component feature set, it is likely to show diff via CSS and HTML elements and would not likely compare against a Word (or any other) document.
For the time being, you can consider a custom button that will do an HTML diff against the original content that was provided to it to show it in the editor, but reconciling any changes will be a more complex task that is very far from trivial to implement.
When selecting an image, I expect drag handles to show me that an image selection has occurred and that let me resize the image.
*** Thread created by admin on customer behalf ***
In fashion similar to the following example for the React editor that's done through the onMount ReactJS-specific event: https://www.telerik.com/kendo-react-ui/components/editor/plugins/#popup-tools
More on plugins for ProseMirror: https://prosemirror.net/docs/ref/version/0.20.0.html#state.Plugin_System
Currently, our Editor component does not support a placeholder parameter. Having a placeholder parameter, similar to the Kendo UI Editor, would prove to be beneficial.
Hello,
after selecting a block of text in your editor and perform some block operation (for instance - change font size, name, ..) the original selection is lost. Would it be possible to keep that selection please?
Very thanks.
Miroslav
I cannot clear the content area of the TelerikEditor when the component is placed in the Form Item Template.
<AdminEdit>
Below, you can find a workaround solution:
@using System.ComponentModel.DataAnnotations;
@using Telerik.Blazor.Components.Editor
<TelerikForm Model="@Model" OnSubmit="@OnSubmitHandler">
<FormValidation>
<DataAnnotationsValidator />
<ValidationSummary />
</FormValidation>
<FormItems>
<FormItem>
<Template>
<TelerikEditor @bind-Value="@Model.Name" @ref="@EditorRef" />
</Template>
</FormItem>
</FormItems>
</TelerikForm>
@code {
public SampleData Model { get; set; } = new SampleData();
public TelerikEditor EditorRef { get; set; }
private async Task OnSubmitHandler(EditContext editContext)
{
bool isFormValid = editContext.Validate();
if (isFormValid)
{
//some logic here
}
else
{
await EditorRef.ExecuteAsync(new HtmlCommandArgs("setHtml", "")); //workaround
//clear the content of the editor to let the user type anew
Model.Name = String.Empty;
}
}
public class SampleData
{
[Required]
[MinLength(30, ErrorMessage = "The content should be minimum 30 characters long.")]
public string Name { get; set; }
}
}
</AdminEdit>
I need help to format/pretty HTML code in the viewhtml dialog box in the Editor. Plus, I couldn't find any property on the ViewHtml class that allows setting the content when the dialog box is open.