Unplanned
Last Updated: 31 Oct 2018 08:06 by ADMIN
ADMIN
Tanya
Created on: 15 Nov 2016 09:21
Category: RichTextBox
Type: Bug Report
1
RichTextBox: Pasting content containing CommentRangeStart/CommentRangeEnd in a comment leads to StackOverflowException
The start and end annotations are pasted along with the other content, trying to update the styles leads to cycle and StackOverflowException is thrown.

Workaround: Remove the comments from the document in the clipboard:

void radRichTextBox_ActiveDocumentEditorChanged(object sender, Telerik.Windows.Documents.UI.ActiveDocumentEditorChangedEventArgs e)
{
    if (e.DocumentEditorType == Telerik.Windows.Documents.UI.DocumentEditorType.Comment)
    {
        var currentEditor = this.radRichTextBox.ActiveDocumentEditor as RadRichTextBox;
        currentEditor.CommandExecuting += activeEditor_CommandExecuting;
    }
}

void activeEditor_CommandExecuting(object sender, CommandExecutingEventArgs e)
{
    if (e.Command is PasteCommand)
    {
        RadDocument pastedDocument = ClipboardEx.GetDocument().ToDocument();
        RadDocumentEditor editor = new RadDocumentEditor(pastedDocument);

        editor.DeleteAllComments();

        ClipboardEx.SetDocument(new DocumentFragment(pastedDocument));
    }
}
0 comments