From a7a660678fd76b845891790986b465f5177d2b13 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:29:27 +0300 Subject: [PATCH] Added new kb article editor-prevent-backspace-radeditor-disabled (#602) Co-authored-by: KB Bot --- ...or-prevent-backspace-radeditor-disabled.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 knowledge-base/editor-prevent-backspace-radeditor-disabled.md diff --git a/knowledge-base/editor-prevent-backspace-radeditor-disabled.md b/knowledge-base/editor-prevent-backspace-radeditor-disabled.md new file mode 100644 index 000000000..bdc081b7e --- /dev/null +++ b/knowledge-base/editor-prevent-backspace-radeditor-disabled.md @@ -0,0 +1,95 @@ +--- +title: Disabling Content Removal Using Backspace when RadEditor is disabled +description: Learn how to prevent content removal using the backspace key in RadEditor by disabling editing and making it non-editable. +type: how-to +page_title: How to Prevent Content Deletion with Backspace when RadEditor is disabled +slug: editor-prevent-backspace-radeditor-disabled +tags: radeditor, asp.net ajax, disable editing, non-editable, backspace, prevent content removal +res_type: kb +ticketid: 1666216 +--- + +## Environment + + + + + + + + + + + +
ProductRadEditor for ASP.NET AJAX
Versionall
+ +## Description +Even after setting `enableEditing` and `set_editable` to `false`, it's still possible to remove or modify the content in RadEditor using the backspace key. How can this behavior be disabled to prevent content removal? + +This KB article also answers the following questions: +- How to make RadEditor content non-editable? +- How to disable the backspace key in RadEditor? +- How to prevent content modification in RadEditor? + +## Solution +To prevent users from removing content using the backspace key in [RadEditor](https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/overview) while keeping the editor non-editable, follow the steps below: + +1. **Disable Editing and Make Non-Editable:** + + Set the editor to non-editable mode by using the `enableEditing(false)` and `set_editable(false)` methods. + +2. **Disable the Backspace Key:** + + Add an event listener to the RadEditor content area to disable the backspace key functionality. + + ````ASPX + + ```` + +3. **Integrate the Event Listener with the RadEditor:** + + Ensure the `OnClientLoad` event is properly configured in your RadEditor definition. + + ````aspx + + some content + + ```` + + This configuration disables the backspace key, preventing content removal and modification, while keeping the editor in a non-editable state. + +Additionally, to disable other editing features such as copy, typing, enter, delete, and pasting content, you can use the `OnClientCommandExecuting` and `OnClientPasteHtml` events: + +```asp + + test content + +``` + +````ASPX + +```` + +## See Also + +- [RadEditor Overview](https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/overview) +- [RadEditor Client-Side Programming](https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/client-side-programming/overview)