we want to change the default WrappingStyle when inserting images.
The images are inserted via Copy&Paste or Drag&Drop.
They should all have WrappingStyle "Square" when inserted (and not WrappingStyle "In line with text").
What is the simplest solution to do this?
Thank you, Andi
3 Answers, 1 is accepted
0
Dimitar
Telerik team
answered on 25 Feb 2021, 01:45 PM
Hi Andi,
You can use the CommandExecuted event and if an image is pasted change the wrapping. Here is an example of this:
privatevoidRadRichTextBox_CommandExecuted(object sender, CommandExecutedEventArgs e)
{
if (e.Command is PasteCommand)
{
var currentElement = radRichTextBox.Document.CaretPosition.GetPreviousInline();
if (currentElement is ImageInline)
{
var command = new ChangeImageWrappingStyleCommand(radRichTextBox);
radRichTextBox.Document.CaretPosition.MoveToInline(currentElement);
command.Execute(WrappingStyle.Square);
}
}
}
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.