Is any standard method to disable edit in the HTML mode available?
HTML mode must be visible to show output code, but now allowed for users to edit using it, only using Design.
Thank you.
1 Answer, 1 is accepted
0
Rumen
Telerik team
answered on 12 Jul 2024, 03:22 PM
| edited on 12 Jul 2024, 03:23 PM
Hi Emin,
To disable editing in the HTML mode of RadEditor while still allowing users to view the HTML code, you can use the following approach. This method ensures that users can see the HTML content but cannot modify it when in HTML mode
<telerik:RadEditorrunat="server"ID="RadEditor1"Height="600px"OnClientModeChange="OnClientModeChange"><Content></Content></telerik:RadEditor><script>functionOnClientModeChange(editor, args) {
var mode = editor.get_mode();
if (mode == 2) { // Check if the mode is HTMLsetTimeout(function () {
var htmlMode = editor.get_textArea();
htmlMode.disabled = "true"; // Disable editing
}, 100);
}
}
</script>
For more information, you can refer to this documentation: