HtmlEditor & <pre><code>

Hello everyone.
I can't figure out how to extend HTMLEditor to put a piece of text in "<pre > <code> </code> </pre>.
Thanks

Hi @BCEBOLOD

You can switch to source view (last button on the toolbar "<>" and copy/paste the "<pre><code> insert code here </code></pre>" directly in the source.

Regards

Paul

Thanks for the answer.
For me, this is an incorrect solution, because it is important for me that at the touch of a button, the text goes into pre code.
Honestly, I did not find a solution to my problem. I decided to do everything as you indicated, but here's the problem - I downloaded nuget radzen, added to the page all the code from (Blazor HTML editor componenet with lots of built-in tools) "EDIT SOURCE", but there is no "<>" button in the html editor. Can you tell me why there is no button?

This feature isn't supported. You can try implementing it as a custom tool. This will insert a <pre> only (formatBlock can't insert nested tags as far as I know).

 await args.Editor.ExecuteCommandAsync(HtmlEditorCommands.FormatBlock, "pre");

You don't have an up-to-date version of Radzen.Blazor.

1 Like