Completed
Last Updated: 29 Sep 2015 10:55 by ADMIN
ADMIN
Ianko
Created on: 01 Jul 2015 06:25
Category: UI for ASP.NET AJAX
Type: Bug Report
0
Accept and Reject Track Changes tools are enabled on initial load when CanAcceptTrackChanges is set to false
This leads to possibility for the end-user to press the button before selecting the content area and accept/reject tracked content. 

This can be resolved via some custom code that disables the tools on initial load. For example:

<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad"
    EnableTrackChanges="true" TrackChangesSettings-CanAcceptTrackChanges="false">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="AcceptTrackChange" Text="Accept Track Change" />
            <telerik:EditorTool Name="RejectTrackChange" Text="Reject Track Change" />
            <telerik:EditorTool Name="AcceptAllTrackChanges" Text="Accept All Track Changes" />
            <telerik:EditorTool Name="RejectAllTrackChanges" Text="Reject All Track Changes" />
            <telerik:EditorTool Name="EnableTrackChangesOverride" Text="Enable Track Changes Override" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>

<script type="text/javascript">
    function OnClientLoad(sender, args) {
        var editor = sender;
        var toolNamesToDisable = ["AcceptTrackChange", "RejectTrackChange",
            "AcceptAllTrackChanges", "RejectAllTrackChanges"];
        var canAcceptChanges = editor.get_canAcceptTrackChanges();

        if (!canAcceptChanges) {
            for (var i = 0; i < toolNamesToDisable.length; i++) {
                var toolName = toolNamesToDisable[i];
                editor.getToolByName(toolName)
                    .setState(Telerik.Web.UI.Editor.CommandStates.Disabled)
            }
        }
    }
</script>
0 comments