禁用从 tinymce textarea 复制文本
Disable copy text from tinymce textarea
有没有办法停止从 tinymce 文本区域复制文本?我按照代码进行了尝试,它禁用了简单文本区域的复制,但我希望对 tinymce 文本区域进行此限制,我不是在谈论按钮我是在谈论在文本区域中编写的文本
<textarea id="mytinymcetextarea" class="noselect">Not copy able</textarea>
tinymce.init({
selector: "#mytextarea"
});
$('#mytinymcetextarea').bind('copy',function(e) {
e.preventDefault(); return false;
});
我也试过 css
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
如果不可能,是否有任何其他允许禁用复制文本的文本编辑器。
您可以尝试拦截 copy
事件并禁用其默认行为:
document.addEventListener('copy', function(e){
e.preventDefault(); // default behaviour is to copy selected text
});
虽然不能保证这适用于所有浏览器。
除此之外,您还可以删除上下文菜单(参见:Remove the Context Menu in TinyMCE), and you can also remove the "copy" option from the "Edit" menu in TinyMCE (see: http://codeasp.net/blogs/microsoft-net/204/tinymce-how-to-remove-cut-copy-and-paste-items-in-edit-menu)。
有没有办法停止从 tinymce 文本区域复制文本?我按照代码进行了尝试,它禁用了简单文本区域的复制,但我希望对 tinymce 文本区域进行此限制,我不是在谈论按钮我是在谈论在文本区域中编写的文本
<textarea id="mytinymcetextarea" class="noselect">Not copy able</textarea>
tinymce.init({
selector: "#mytextarea"
});
$('#mytinymcetextarea').bind('copy',function(e) {
e.preventDefault(); return false;
});
我也试过 css
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
如果不可能,是否有任何其他允许禁用复制文本的文本编辑器。
您可以尝试拦截 copy
事件并禁用其默认行为:
document.addEventListener('copy', function(e){
e.preventDefault(); // default behaviour is to copy selected text
});
虽然不能保证这适用于所有浏览器。
除此之外,您还可以删除上下文菜单(参见:Remove the Context Menu in TinyMCE), and you can also remove the "copy" option from the "Edit" menu in TinyMCE (see: http://codeasp.net/blogs/microsoft-net/204/tinymce-how-to-remove-cut-copy-and-paste-items-in-edit-menu)。