mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-05-29 13:22:00 +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();
|
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) => {
|
viewer.onmouseup = (e) => {
|
||||||
if (redactionMode !== RedactionModes.TEXT) return;
|
if (redactionMode !== RedactionModes.TEXT) return;
|
||||||
const containsText = window.getSelection() && window.getSelection().toString() != '';
|
const containsText = window.getSelection() && window.getSelection().toString() != '';
|
||||||
if(containsText){
|
if(containsText){
|
||||||
redactTextSelection();
|
redactTextSelection();
|
||||||
|
clearSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -427,21 +443,6 @@ window.addEventListener('load', (e) => {
|
|||||||
clearSelection();
|
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) {
|
function _handleDrawRedactionBtnClick(e) {
|
||||||
if (drawRedactionBtn.classList.contains('toggled')) {
|
if (drawRedactionBtn.classList.contains('toggled')) {
|
||||||
resetDrawRedactions();
|
resetDrawRedactions();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user