Completed
Last Updated: 25 Apr 2017 06:26 by ADMIN
ADMIN
Dimitar
Created on: 17 Sep 2015 10:39
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - the comments buttons in the RibbonUI are not working properly.
To reproduce:
- Add some comments and try to navigate through them.
- Try add or show/hide the comments while the cursor is in one of the comments.

Workaround:
Create a custom RichTextEditorRibbonBar
and override the following methods:

Public Class MyRichTextEditorRibbonBar
    Inherits RichTextEditorRibbonBar

    Protected Overrides Sub ButtonNewComment_Click(sender As Object, e As EventArgs)
        Dim command As New InsertCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)

    End Sub

    Protected Overrides Sub ButtonDeleteComment_Click(sender As Object, e As EventArgs)
        Dim command As New DeleteCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)
    End Sub

    Protected Overrides Sub ButtonPreviousComment_Click(sender As Object, e As EventArgs)
        Dim command As New GoToPreviousCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)
    End Sub

    Protected Overrides Sub ButtonNextComment_Click(sender As Object, e As EventArgs)
        Dim command As New GoToNextCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)
    End Sub

    Protected Overrides Sub ToggleButtonShowHideComments_ToggleStateChanged(sender As Object, args As StateChangedEventArgs)

        Dim command As New ToggleCommentsCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)
    End Sub

    Protected Overrides Sub ButtonDeleteAllComments_Click(sender As Object, e As EventArgs)
        Dim command As New DeleteAllCommentsCommand(Me.AssociatedRichTextEditor.RichTextBoxElement)
        Me.ExecuteCommand(command)
    End Sub

    Protected Overrides Sub HandleDocumentCommandExecuted(document As RadDocument)
        MyBase.HandleDocumentCommandExecuted(document)

        Dim hasComments As Boolean = Me.AssociatedRichTextEditor.Document.EnumerateChildrenOfType(Of CommentRangeStart)().Count() > 0

        Me.buttonPreviousComment.Enabled = hasComments
        Me.buttonNextComment.Enabled = hasComments
        Me.buttonDeleteComment.Enabled = hasComments
        Me.buttonDeleteAllComments.Enabled = hasComments
    End Sub

End Class
0 comments