[英]Disable Copy-Paste from the Text Editor
@if (Model.CanMaintainNcrLineManagement) { <tr> <td>@Html.TextAreaFor(model => model.Description, new { id = "txArNcrLineDescriptionValue", @style = "height:520px" })</td> </tr> } else { <tr class="read-only-editor"> <td>@Html.TextAreaFor(model => model.Description, new { id = "txArNcrLineDescriptionReadOnly", @style = "height:520px" })</td> </tr> }
I want to disable the copy-past option from the text editor box. 我想从文本编辑器框中禁用复制粘贴选项。 I have used below both codes to disable it but its not working.
我在下面的两个代码中都使用过它来禁用它,但是它不起作用。 Please give me some solution
请给我一些解决方案
$('body').bind('copy paste', function(e) { e.preventDefault(); return false; });
<body oncopy="return false" oncut="return false" onpaste="return false">
Change your code and your text editor must be inside body tag and will prevent all inside body tag. 更改代码,文本编辑器必须在body标签内,并且将阻止所有body标签内。
<body oncopy="return false" oncut="return false" onpaste="return false">
To 至
<body onselectstart="return false" onpaste="return false;" onCopy="return false" onCut="return false" onDrag="return false" onDrop="return false">
I tested this in Chrome 66.0.3359.181, IE 11, and FireFox 59.0.3 and it is disabling copying and pasting into anything in the body or the input. 我在Chrome 66.0.3359.181,IE 11和FireFox 59.0.3中对此进行了测试,它禁用了复制和粘贴到正文或输入中的任何内容的功能。
$('body').bind('copy paste', function (e) { e.preventDefault(); return false; });
<body oncopy="return false" oncut="return false" onpaste="return false">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.