Hello everyone,
I am experiencing an issue with my Blazor application and am seeking advice or solutions from anyone who might have had the same issue.
When interacting with the Telerik Editor within a Telerik Grid, clicking inside the editor unexpectedly exits the edit mode. This seems to be linked to event propagation issues, where clicking the editor triggers a propagation that causes the grid to exit edit mode.
Error Messages:
When my issue triggers, I also see the following error in the console:
Uncaught TypeError: Cannot read properties of null (reading 'state')
This occurs within the telerik-blazor.js script and seems related to handling state changes or events.
I already looked trough Troubleshooting but removing all "StateHasChanged" didn't solve the issue.
What I've Tried:
Implemented JavaScript to stop event propagation using event.stopPropagation() within various event handlers (click, mousedown, etc.).
Checked that the event handlers are correctly assigned and that the JavaScript is initialized at the correct life cycle phase in Blazor (OnAfterRenderAsync).
Removed any redundant StateHasChanged() calls as per Telerik's recommendations to prevent unnecessary re-rendering and potential race conditions.
Code:
The Telerikgrid with the Telerikeditor:
<TelerikGrid Data="ProzessSubPosListe"
EditMode="@GridEditMode.Incell"
OnUpdate="@UpdateHandlerProzessPos"
OnDelete="@DeleteHanlderProzessPos"
Size="@ThemeConstants.Grid.Size.Small"
PageSize="100"
Sortable="true"
Pageable="false"
Resizable="true"
>
<GridColumns>
<GridColumn Field="@nameof(ProzessPosClass.Nr)" Title="Nr" Width="10%"></GridColumn>
<GridColumn Field="@nameof(ProzessPosClass.Title)" Title="Thema" Width="20%"></GridColumn>
<GridColumn Field="@nameof(ProzessPosClass.ProzessContent)" Title="Beschreibung" Width="20%">
<EditorTemplate Context="dataItem">
<div @onclick:stopPropagation="true" @onclick:preventDefault="true">
@{
var item = dataItem as ProzessPosClass;
<TelerikEditor @bind-Value="@item.ProzessContent" Width="650px" Height="400px" ></TelerikEditor>
}
</div>
</EditorTemplate>
</GridColumn>
<GridCommandColumn Context="Journal" Width="100px">
<GridCommandButton Command="Save" Icon="@("save")" ShowInEdit="true"></GridCommandButton>
<GridCommandButton Command="Delete" Icon="@("trash")"></GridCommandButton>
<GridCommandButton Command="Cancel" Icon="@("cancel")" ShowInEdit="true"></GridCommandButton>
</GridCommandColumn>
</GridColumns>
<NoDataTemplate>
<strong>Kein Prozessschritt vorhanden</strong>
</NoDataTemplate>
</TelerikGrid>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("setupEditorEventHandling");
}
}
My Javascript inside of _Layout.cshtml trying to resolve the issue:
<script>
function setupEditorEventHandling() {
console.log("Setup editor event handling");
document.addEventListener('click', function (event) {
try {
var editor = event.target.closest('.k-editor.telerik-blazor');
if (editor) {
event.stopPropagation();
}
} catch (error) {
console.error('Error handling editor click:', error);
}
}, true);
}
</script>
How the issue looks like:
Has anyone encountered similar issues with event handling in Blazor applications using that setup?
Any insights or suggestions would be greatly appreciated.
We are in search of a word processor component for Blazor, that delivers a user experience comparable to word processors such as Google Docs, DevExpress, or Syncfusion. Our core requirements include features document formatting (page size, orientation, etc), importing docx, saving as docx.
Could you provide insight into whether TelerikEditor, coupled with appropriate word processing libraries, is capable of achieving this level of functionality?
Thank you.
I'm using the TelerikEditor component:
<TelerikEditor @ref="@SummaryEditor"
Class="rich-editor"
EditMode="@EditorEditMode.Iframe"
Value="@TextDisplayModel.Text"
ValueChanged="@RichEditorValueChanges"
ValueExpression="@((()=> TextDisplayModel.Text))">
</TelerikEditor>
Hello,
I'm a newcomer to Telerik, and I'd appreciate it if you could assist me without suggesting that the documentation is clear enough.
Is there an uncomplicated method to enable resizing for the Editor, similar to the one used in your forum's editor?
I'm concurrently working with Syncfusion controls, and I've been able to implement a resizable editor easily using the code provided below with their control.
How can I achieve the same functionality with your control?
Regards,
Omar
@using Syncfusion.Blazor.RichTextEditor
<div class="control-section resize">
<SfRichTextEditor EnableResize="true" Height="250px">
<p>
The Rich Text Editor component is a WYSIWYG ("what you see is what you get") editor that provides the best user experience to create and update the content.
Users can format their content using standard toolbar commands.
</p>
</SfRichTextEditor>
</div>
<style>
.e-richtexteditor {
max-width: 880px;
min-width: 200px;
min-height: 170px;
max-height: 400px;
}
.control-section.resize .e-popup.e-popup-open.e-dialog {
max-height: 410px !important;
}
</style>
Hi,
Using the editor, is it possible to combine the built-in tools and the custom ones?
I would like to use the Tools="EditorToolSets.All" as well as the @ToolCollection that I created at the same time.
Regards,
Omar
One of the most basic features, and a reason why many would want to use an HTML editor, is to use style tags to style the content of the HTML editor.
However, it appears if you use the iframe, you cannot do this. The whole point of an iframe is to stop scope creep both ways, which means style tags should work without issue. Although they seem to be ignored in the editor, and HTML is placed inside an <textarea> outside of the iframe, making the style tag affect the entire web app.
And if you use a div instead of an iframe, you get the scope creep.
Seriously.... why is this not implemented????
Is there a way to make the iframe honor the style tags?