03-11-23
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
// and a arraybuffer which represents the document that should be displayed.
|
||||
loadPSPDFKit(arrayBuffer, container) {
|
||||
return PSPDFKit.load({
|
||||
styleSheets: ['/css/site.css'],
|
||||
container: container,
|
||||
document: arrayBuffer,
|
||||
autoSaveMode: "DISABLED",
|
||||
@@ -26,24 +27,20 @@
|
||||
isEditableAnnotation: function (annotation) {
|
||||
// Check if the annotation is a signature
|
||||
// This will allow new signatures, but not allow edits.
|
||||
return !annotation.isSignature;
|
||||
console.log(annotation.isSignature, annotation.description)
|
||||
|
||||
if (annotation.isSignature || annotation.description == "FRAME") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
//return !annotation.isSignature;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
configurePSPDFKit(instance, handler) {
|
||||
instance.addEventListener("annotations.load", (loadedAnnotations) => {
|
||||
console.log("annotations loaded", loadedAnnotations.toJS());
|
||||
})
|
||||
|
||||
instance.addEventListener("annotations.change", () => {
|
||||
console.log("annotations changed")
|
||||
})
|
||||
|
||||
instance.addEventListener("annotations.create", async (createdAnnotations) => {
|
||||
console.log("annotations created");
|
||||
})
|
||||
|
||||
const toolbarItems = this.getToolbarItems(instance, handler)
|
||||
instance.setToolbarItems(toolbarItems)
|
||||
|
||||
@@ -56,14 +53,22 @@
|
||||
return defaultItems.concat(customItems)
|
||||
}
|
||||
|
||||
createElementFromHTML(html) {
|
||||
const el = document.createElement('div')
|
||||
el.innerHTML = html.trim()
|
||||
|
||||
return el.firstChild
|
||||
}
|
||||
|
||||
getCustomItems = function (callback) {
|
||||
const customItems = [
|
||||
return [
|
||||
{
|
||||
type: "custom",
|
||||
id: "button-reset",
|
||||
className: "button-reset",
|
||||
title: "Zurücksetzen",
|
||||
onPress() {
|
||||
console.log("RESET")
|
||||
callback("RESET")
|
||||
},
|
||||
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
|
||||
@@ -77,15 +82,11 @@
|
||||
className: "button-finish",
|
||||
title: "Abschließen",
|
||||
onPress() {
|
||||
console.log("FINISH")
|
||||
callback("FINISH")
|
||||
},
|
||||
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-check2-circle" viewBox="0 0 16 16">
|
||||
<path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0 5.5 5.5 0 1 1-11 0z"/>
|
||||
<path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293 5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z" />
|
||||
</svg>`
|
||||
}
|
||||
}
|
||||
]
|
||||
return customItems
|
||||
}
|
||||
|
||||
getDefaultItems(items) {
|
||||
|
||||
Reference in New Issue
Block a user