|
| 1 | +--- |
| 2 | +title: Disabling Grammarly in RadEditor for ASP.NET AJAX |
| 3 | +description: Learn how to prevent Grammarly from interfering with RadEditor by disabling it using JavaScript and CSS. |
| 4 | +type: troubleshooting |
| 5 | +page_title: How to Disable Grammarly Extension in RadEditor for ASP.NET AJAX |
| 6 | +slug: disable-grammarly-radeditor |
| 7 | +tags: radeditor, asp.net ajax, grammarly, javascript, css |
| 8 | +res_type: kb |
| 9 | +ticketid: 1676891 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +<table> |
| 15 | +<tbody> |
| 16 | +<tr> |
| 17 | +<td>Product</td> |
| 18 | +<td>RadEditor for ASP.NET AJAX</td> |
| 19 | +</tr> |
| 20 | +<tr> |
| 21 | +<td>Version</td> |
| 22 | +<td>2024.4.1114</td> |
| 23 | +</tr> |
| 24 | +</tbody> |
| 25 | +</table> |
| 26 | + |
| 27 | +## Description |
| 28 | +When using [RadEditor for ASP.NET AJAX](https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/overview), Grammarly can introduce performance issues and unwanted HTML tags. To ensure smooth operation of RadEditor, disabling Grammarly within its content area is necessary. |
| 29 | + |
| 30 | +## Cause |
| 31 | +Grammarly interacts with content-editable elements, such as the content area of RadEditor, causing unwanted behavior and performance degradation. |
| 32 | + |
| 33 | +## Solution |
| 34 | + |
| 35 | +To prevent Grammarly from affecting RadEditor, follow these steps: |
| 36 | + |
| 37 | +1. Disable Grammarly in the content area of RadEditor by setting specific attributes to `false`. Implement the JavaScript function `OnClientLoad` and assign it to the RadEditor's `OnClientLoad` property. |
| 38 | + |
| 39 | +```javascript |
| 40 | +<script> |
| 41 | + function OnClientLoad(editor, args) { |
| 42 | + const contentArea = editor.get_contentArea(); |
| 43 | + contentArea.setAttribute('data-gramm', 'false'); |
| 44 | + contentArea.setAttribute('data-gramm_editor', 'false'); |
| 45 | + contentArea.setAttribute('data-enable-grammarly', 'false'); |
| 46 | + } |
| 47 | +</script> |
| 48 | +<telerik:RadEditor OnClientLoad="OnClientLoad" runat="server" ID="RadEditor1"></telerik:RadEditor> |
| 49 | +``` |
| 50 | + |
| 51 | +2. Use CSS to hide any Grammarly extensions that might still appear. Add the following CSS rules to your application: |
| 52 | + |
| 53 | +```css |
| 54 | +[contenteditable] ~ grammarly-extension, |
| 55 | +input ~ grammarly-extension, |
| 56 | +textarea ~ grammarly-extension { |
| 57 | + display: none !important; |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +This will ensure that Grammarly extensions are not visible, further reducing their impact on RadEditor. |
| 62 | + |
| 63 | +### Additional Checks |
| 64 | + |
| 65 | +- **Inspect HTML**: Use Developer Tools to ensure the attributes are correctly applied to the RadEditor's content area. |
| 66 | +- **Content Area Mode**: Switch between `Iframe` and `Div` modes based on your application's requirements. Grammarly does not function in the `Iframe` mode. |
| 67 | +- **JavaScript Errors**: Check for and resolve any JavaScript errors that might prevent the disabling script from executing. |
| 68 | +- **Browser and Environment**: Test in various browsers and environments to rule out browser-specific issues. |
| 69 | +- **Isolate the Issue**: Create a simple test page to determine if external factors are affecting RadEditor. |
| 70 | + |
| 71 | +By implementing these steps, you can disable Grammarly in RadEditor, ensuring it operates without interference. |
| 72 | + |
| 73 | +## See Also |
| 74 | + |
| 75 | +- [RadEditor Overview](https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/overview) |
| 76 | +- [Editable DIV Content Area Demo](https://demos.telerik.com/aspnet-ajax/editor/examples/contentareamodediv/defaultcs.aspx) |
| 77 | +- [How to stop extensions/add-ons like Grammarly on contenteditable editors](https://stackoverflow.com/questions/37444906/how-to-stop-extensions-add-ons-like-grammarly-on-contenteditable-editors) |
0 commit comments