diff --git a/src/main/resources/static/css/redact.css b/src/main/resources/static/css/redact.css index 5eaf12eb7..bc59dda44 100644 --- a/src/main/resources/static/css/redact.css +++ b/src/main/resources/static/css/redact.css @@ -172,26 +172,6 @@ html { height: 0; } -#apply-redaction { - height: var(--toolButton-height); - width: var(--toolButton-width); - - border-radius: var(--toolButton-border-radius); -} - -#apply-redaction[disabled=true], #apply-redaction:disabled:not([disabled=false]) { - color: rgb(147, 149, 153); - box-shadow: none !important; -} - -#apply-redaction:is(:hover):not([disabled=true], :disabled:not([disabled=false])) { - cursor: pointer; - background-color: rgba(6, 114, 197, 0.82); - color: rgb(14, 12, 12); - outline:rgba(6, 114, 197, 0.82) !important; - border-color: rgba(6, 114, 197, 0.82) !important; -} - .toolbar-btn-hover:hover { cursor: pointer; background-color: rgba(6, 114, 197, 0.82) !important; @@ -200,15 +180,6 @@ html { border-color: rgba(6, 114, 197, 0.82) !important; } -#apply-redaction-icon { - font-size: var(--toolButton-icon-font-size); -} - -#apply-redaction > span { - user-select: none; - pointer-events: none; -} - #pageRedactColor, input[data-for=pageRedactColor] { flex: 1; padding: 1px; diff --git a/src/main/resources/static/js/redact.js b/src/main/resources/static/js/redact.js index 5a09a1a58..b3c746495 100644 --- a/src/main/resources/static/js/redact.js +++ b/src/main/resources/static/js/redact.js @@ -206,8 +206,6 @@ window.addEventListener('load', (e) => { let redactionsPaletteContainer = document.getElementById('redactionsPaletteContainer'); - let applyRedactionBtn = document.getElementById('apply-redaction'); - let redactedPagesDetails = { numbers: new Set(), ranges: new Set(), @@ -249,7 +247,6 @@ window.addEventListener('load', (e) => { displayFieldErrorMessages(input, errors); } else { pageBasedRedactionOverlay.classList.add('d-none'); - applyRedactionBtn.removeAttribute('disabled'); input.classList.remove('is-valid'); let totalPagesCount = PDFViewerApplication.pdfViewer.pagesCount; @@ -323,16 +320,9 @@ window.addEventListener('load', (e) => { viewer.onmouseup = (e) => { if (redactionMode !== RedactionModes.TEXT) return; const containsText = window.getSelection() && window.getSelection().toString() != ''; - applyRedactionBtn.disabled = !containsText; - }; - - applyRedactionBtn.onclick = (e) => { - if (redactionMode !== RedactionModes.TEXT) { - applyRedactionBtn.disabled = true; - return; + if(containsText){ + redactTextSelection(); } - redactTextSelection(); - applyRedactionBtn.disabled = true; }; redactionsPaletteInput.onchange = (e) => { @@ -413,26 +403,28 @@ window.addEventListener('load', (e) => { }; initDraw(layer, redactionsContainer); + enableTextRedactionMode(); function _handleTextSelectionRedactionBtnClick(e) { if (textSelectionRedactionBtn.classList.contains('toggled')) { resetTextSelection(); } else { - resetDrawRedactions(); - textSelectionRedactionBtn.classList.add('toggled'); - redactionMode = RedactionModes.TEXT; - const containsText = window.getSelection() && window.getSelection().toString() != ''; - applyRedactionBtn.disabled = !containsText; - applyRedactionBtn.classList.remove('d-none'); + enableTextRedactionMode(); } } + function enableTextRedactionMode() { + if(!textSelectionRedactionBtn.classList.contains('toggled')){ + textSelectionRedactionBtn.classList.add('toggled'); + } + resetDrawRedactions(); + redactionMode = RedactionModes.TEXT; + }; + function resetTextSelection() { textSelectionRedactionBtn.classList.remove('toggled'); redactionMode = RedactionModes.NONE; clearSelection(); - applyRedactionBtn.disabled = true; - applyRedactionBtn.classList.add('d-none'); } function clearSelection() { @@ -791,7 +783,6 @@ window.addEventListener('load', (e) => { } _setRedactionsInput(redactions); - applyRedactionBtn.disabled = true; } function _scaleToDisplay(value) { diff --git a/src/main/resources/templates/security/redact.html b/src/main/resources/templates/security/redact.html index cdea8015c..707ddac17 100644 --- a/src/main/resources/templates/security/redact.html +++ b/src/main/resources/templates/security/redact.html @@ -453,11 +453,6 @@ -