我试图在选择后禁用文本可编辑性,但将 contenteditable 设置为 false 不起作用。
<div class="block" contenteditable="true" onclick="document.execCommand('selectAll',false,null)">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip </div>