
Hi Telerik Team,
I would like to know if it is possible to make the context menu visible for a newly created table in the RadEditor. Currently, the context menu is only visible for tables that are explicitly "accepted as changes." Is there a way to enable the context menu for newly created tables without requiring them to be accepted as changes first?
3 Answers, 1 is accepted
Hi Emin,
Thank you for sharing the details of the issue you're experiencing with the EnableTrackChanges
property and the context menu in the RadEditor. I appreciate your thorough explanation and for testing in our demo as well.
I tested this behavior on my side by setting EnableTrackChanges
both inline in the markup and programmatically in the Page_Load
method in the codebehind. In both cases, the context menu worked as expected, including for elements wrapped in <ins>
tags.
To demonstrate, I’ve recorded a short video showing that setting the property programmatically in the Page_Load
works and the context menu appears as intended. You can review the video here: RadEditor Track Changes Testing. Here is the code that I used:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//now I will enable track changes from the codebehind
theEditor.EnableTrackChanges = true;
SetDefaultConfiguratorValues();
}
}
Since the behavior is consistent in my tests, it’s possible that another factor in your project setup is influencing the issue. Here are a few steps you can take to troubleshoot:
- Check for any JavaScript errors on your page that could interfere with the context menu functionality.
- Compare your RadEditor configuration to the one in our demo and ensure it matches, especially regarding any custom settings for
TrackChanges
or the context menu. - Review any custom scripts or styles applied to your page to ensure they aren’t impacting the context menu’s rendering or interaction.
- Try replicating the issue in a different project or on a brand-new, clean page within your existing project to rule out any project-specific factors.
- Ensure you’re testing with the latest version of
Telerik.Web.UI
to avoid potential issues that have already been resolved in recent updates.
These steps should help identify any underlying causes for the discrepancy. Let me know how it goes!
Regards,
Rumen
Progress Telerik
Hi Rumen,
Thank you for your detailed response and for testing the behavior on your end. I really appreciate the video and the code example you provided—it’s very helpful! I was able to make the code work.
I have a quick follow-up question regarding the EnableTrackChanges property. In my case, the context menu didn’t work as expected when I set EnableTrackChanges = true programmatically in the backend (Page_Load), but it worked fine when the same property was set inline in the HTML. Interestingly, after I updated my tools file to include the TrackChangeFormat context menu, the context menu started working in both cases:
<contextMenus>
<contextMenu forElement="TrackChangeFormat">
</contextMenu>
...
<contextMenus>
I noticed in your video that you are using a tools file for the editor configuration. If you remove the tools file or do not include the TrackChangeFormat context menu in it, I believe you might encounter the same issue as I did.
Could you help clarify:
1. Why does adding TrackChangeFormat in the tools file seem to resolve the issue?
2. Is there any specific initialization or timing difference between setting EnableTrackChanges in HTML versus programmatically in the backend that might cause this behavior?
3. Is the TrackChangeFormat context menu a mandatory requirement for the RadEditor to function correctly with EnableTrackChanges?
4. Where can I found extended information about Context Menu, I found just in the online documentation, but there is no "forElement" attribute there:
Updated: found here: https://www.telerik.com/products/aspnet-ajax/documentation/controls/editor/functionality/toolbars/using-toolsfile.xml#configuring-various-tools
I’d love to hear your insights or recommendations for ensuring consistent behavior across different
setups.
Hi Emin,
Thank you for your inquiry about enabling the context menu for newly created tables in RadEditor. Based on my testing in the Track Changes demo, the context menu appears for both accepted and unaccepted tables, including newly created ones wrapped in <ins> tags. This indicates that the RadEditor supports context menus for tables regardless of their acceptance status.
If this is not working in your setup, it might be due to configuration differences or customizations. Please ensure the editor is correctly configured with EnableTrackChanges set to true and that there are no custom scripts or styles interfering with the functionality. Testing in multiple browsers and updating to the latest Telerik version may also help resolve the issue.
If the problem persists, feel free to share your configuration or any relevant customizations for further assistance.
Newly inserted table context menu
Existing table context menu
Regards,
Rumen
Progress Telerik
The issue is with EnableTrackChanges
. If I set it to true
in the backend, the context menu doesn’t work properly for elements like <ins>
tags (e.g., tables with TrackChanges metadata). But if I set EnableTrackChanges
directly in the HTML (client-side), everything works as expected.
This isn’t just about newly created tables—it seems to affect anything wrapped in <ins>
tags when the setting is done via the backend. I tested this in your demo, and it works fine there, so I’m guessing I might be missing something.
Any idea what might be causing this? Could there be a difference in how TrackChanges gets initialized when set server-side versus client-side?
I’d really appreciate your insights on this. Thanks a lot!
Hi Emin,
Let's address your follow-up questions:
Why does adding TrackChangeFormat in the tools file seem to resolve the issue?
- Adding the
TrackChangeFormat
context menu in your tools file explicitly instructs the RadEditor to handle context menus for elements with track changes. This configuration ensures that the context menu is initialized correctly and is available when interacting with elements wrapped in<ins>
tags. By defining this in the tools file, you provide the editor with the necessary setup to render the context menu properly.
- Adding the
Is there any specific initialization or timing difference between setting EnableTrackChanges in HTML versus programmatically in the backend?
- Setting EnableTrackChanges directly in the HTML markup initializes the property as part of the page's initial rendering process. This ensures that the property is applied during the server-side lifecycle before the page is sent to the client. When EnableTrackChanges is set programmatically in the backend (e.g., in Page_Load), it is applied later in the page lifecycle, potentially after some client-side scripts or configurations have already been processed or prepared. This difference in timing can lead to discrepancies, especially if certain client-side functionalities, like context menus or other JavaScript-dependent features, rely on this property being initialized early during rendering.
Is the TrackChangeFormat context menu a mandatory requirement for the RadEditor to function correctly with EnableTrackChanges?
- While not strictly mandatory, defining the TrackChangeFormat context menu is highly recommended. It ensures consistent functionality of the context menu when EnableTrackChanges is enabled. Without it, the editor may not properly recognize elements with track changes, resulting in issues with the context menu's appearance and functionality.
- While not strictly mandatory, defining the TrackChangeFormat context menu is highly recommended. It ensures consistent functionality of the context menu when EnableTrackChanges is enabled. Without it, the editor may not properly recognize elements with track changes, resulting in issues with the context menu's appearance and functionality.
Where can I find extended information about the Context Menu?
- You can find detailed information about configuring context menus, including the
forElement
attribute, in the Telerik documentation at the following link:
- You can find detailed information about configuring context menus, including the
To ensure consistent behavior across different setups, make sure your tools file is correctly configured to include the necessary context menus and other settings. This will help maintain consistent functionality regardless of how properties are set.
Regards,
Rumen
Progress Telerik