mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-04-22 16:51:38 +00:00
Text based redaction configured by default
Redaction applied as soon as text highlighted Removed Apply button
This commit is contained in:
parent
ec77123789
commit
9c1e04425f
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -453,11 +453,6 @@
|
||||
<input type="color" name="color-picker">
|
||||
</label>
|
||||
</button>
|
||||
<button id="apply-redaction" th:title="#{redact.applyChanges}" class="btn-success d-none" disabled>
|
||||
<span id="apply-redaction-icon" class="material-symbols-rounded">
|
||||
check
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="toolbarViewerRight">
|
||||
<div class="splitToolbarButton">
|
||||
|
Loading…
x
Reference in New Issue
Block a user