10.01.2024

This commit is contained in:
Jonathan Jenne
2024-01-10 09:31:04 +01:00
parent b7fbb21076
commit 277f5d3f0d
8 changed files with 148 additions and 27 deletions

View File

@@ -26,17 +26,15 @@
}
async deleteAnnotations(instance) {
let pageAnnotations = this.getAnnotations(instance)
.filter(
(annotation) =>
!!annotation.isSignature || annotation.description == 'FRAME'
)
const allAnnotations = await this.getAnnotations(instance)
const pageAnnotations = allAnnotations.filter(this.isSignature)
//deleting all Annotations
return await instance.delete(pageAnnotations)
}
}
async validateAnnotations(instance) {
let pageAnnotations = this.getAnnotations(instance)
const allAnnotations = await this.getAnnotations(instance)
const pageAnnotations = allAnnotations
.map((annotation) => {
console.log(annotation.toJS())
return annotation
@@ -45,6 +43,10 @@
return true
}
isSignature(annotation) {
return !!annotation.isSignature || annotation.description == 'FRAME'
}
createAnnotationFromElement(element) {
const id = PSPDFKit.generateInstantId()
const width = this.inchToPoint(element.width)

View File

@@ -165,18 +165,14 @@ class App {
case 'RESET':
result = await this.handleReset(null)
console.log(result)
if (result == true) {
Swal.fire({
title: 'Erfolg',
text: 'Dokument wurde zurückgesetzt',
icon: 'info',
})
} else {
Swal.fire({
title: 'Fehler',
text: 'Dokument konnte nicht zurückgesetzt werden!',
icon: 'error',
})
}
break
@@ -293,17 +289,13 @@ class App {
title: 'Sind sie sicher?',
text: 'Wollen Sie das Dokument und alle erstellten Signaturen zurücksetzen?',
icon: 'question',
showCancelButton: true
})
if (result.isConfirmed) {
const result = this.Annotation.deleteAnnotations(this.Instance)
return true
const result = await this.Annotation.deleteAnnotations(this.Instance)
}
if (result.isDimissed) {
return true
}
return false
return result
}
}