mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-04-19 11:11:18 +00:00
Fix for propergating events causing multiple redaction boxes
This commit is contained in:
parent
18d9f8767b
commit
95edb92869
@ -317,11 +317,27 @@ window.addEventListener('load', (e) => {
|
||||
|
||||
redactionsPaletteContainer.onclick = (e) => redactionsPalette.click();
|
||||
|
||||
function clearSelection() {
|
||||
if (window.getSelection) {
|
||||
if (window.getSelection().empty) {
|
||||
// Chrome
|
||||
window.getSelection().empty();
|
||||
} else if (window.getSelection().removeAllRanges) {
|
||||
// Firefox
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
} else if (document.selection) {
|
||||
// IE?
|
||||
document.selection.empty();
|
||||
}
|
||||
}
|
||||
|
||||
viewer.onmouseup = (e) => {
|
||||
if (redactionMode !== RedactionModes.TEXT) return;
|
||||
const containsText = window.getSelection() && window.getSelection().toString() != '';
|
||||
if(containsText){
|
||||
redactTextSelection();
|
||||
clearSelection();
|
||||
}
|
||||
};
|
||||
|
||||
@ -427,21 +443,6 @@ window.addEventListener('load', (e) => {
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
if (window.getSelection) {
|
||||
if (window.getSelection().empty) {
|
||||
// Chrome
|
||||
window.getSelection().empty();
|
||||
} else if (window.getSelection().removeAllRanges) {
|
||||
// Firefox
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
} else if (document.selection) {
|
||||
// IE?
|
||||
document.selection.empty();
|
||||
}
|
||||
}
|
||||
|
||||
function _handleDrawRedactionBtnClick(e) {
|
||||
if (drawRedactionBtn.classList.contains('toggled')) {
|
||||
resetDrawRedactions();
|
||||
|
Loading…
x
Reference in New Issue
Block a user