fix pdf.js可以复制,限制复制的数量
This commit is contained in:
@@ -38,7 +38,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
</head>
|
||||
|
||||
<body tabindex="1">
|
||||
<div id="outerContainer" style="user-select: none">
|
||||
<div id="outerContainer">
|
||||
|
||||
<div id="sidebarContainer">
|
||||
<div id="toolbarSidebar">
|
||||
@@ -581,4 +581,17 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
|
||||
<input type="file" id="fileInput" class="hidden">
|
||||
</body>
|
||||
|
||||
<script>
|
||||
const previewDom = document.getElementById('viewerContainer')
|
||||
const handleSelectionChange = (event) => {
|
||||
const windowSelection = window.getSelection()
|
||||
const selectionText = windowSelection ? window.getSelection().toString() : document.selection.createRange().text
|
||||
if (selectionText.length > 500) {
|
||||
alert('超出可复制长度')
|
||||
windowSelection ? window.getSelection().removeAllRanges() : document.selection.empty()
|
||||
}
|
||||
}
|
||||
document.addEventListener('selectionchange', handleSelectionChange)
|
||||
</script>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user