Add SaveAsHandler for custom save as behavior#1000
Add SaveAsHandler for custom save as behavior#1000uwohlfeil wants to merge 5 commits intoApryseSDK:8.11from
Conversation
|
Hi @uwohlfeil, Thanks for making this PR! We will add this to our following sprint to review. Our next sprint starts next Monday. Once we have completed our review we will provide feedback. Thanks for taking the time to submit this, you will hear from us soon. |
|
I have added a few corrections in the area of the German translation: Incorrect translations
OptimizationThis translations are not wrong but we think they can be optimized.
IdeasThe toolbar names are a little bit confusing and very long.
|
|
We currently have the problem that the thumbnail multiselect checkbox input control is slightly shifted to the right. This makes it impossible to select the checkbox in the left part of the framed area. The problem seems to be the css rule "position: absolute". We suspect that our solution is not correct, but we hope that it shows the problem. |
carlopdftron
left a comment
There was a problem hiding this comment.
Thank you for you feedback and additions! Most of this looks good. For the checkbox issue, we are working on implementing a fix already so you can leave the css change out for now. The only other changes would be to use const instead of var in var handler = getSaveAsHandler();
src/components/Choice/Choice.scss
Outdated
| align-items: center; | ||
| } | ||
|
|
||
| .ui__choice__input input { |
There was a problem hiding this comment.
We have investigated the issue causing the checkboxes to go off-centre. We'll be implementing a fix for this soon. This particular CSS selector might affect other inputs so it would be best to leave this out for now.
| () => { | ||
| saveAs(file.blob, file.filename); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
| const fileData = file.url ? file.url : await decompressFileContent(file); | ||
| saveAs(fileData, file.name); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
| const { fileData, fileName } = fileMeta; | ||
| saveAs(fileData, fileName); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
src/helpers/downloadPdf.js
Outdated
| } | ||
| saveAs(file, downloadName); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
| onConfirm: () => extractPagesWithAnnotations(pageNumbers).then((file) => { | ||
| saveAs(file, 'extractedDocument.pdf'); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
| extractPagesWithAnnotations(pageNumbers).then((file) => { | ||
| saveAs(file, 'extractedDocument.pdf'); | ||
| if (getSaveAsHandler() !== null) { | ||
| var handler = getSaveAsHandler(); |
There was a problem hiding this comment.
Should be a const here instead of a var
@carlopdftron |
carlopdftron
left a comment
There was a problem hiding this comment.
After further review, it would be better to use the same model that we use for other APIs to get/set the saveAsHandler with Redux.
Please refer to 101fb32 to see how we use customApplyRedactionsHandler to do something similar to this.
This way, there would be no need for the saveAs helper functions.


This pull request is a proposal for an extended functionality in the area of the 'save as' functionality.
Currently the
saveAsfunction of thefile-saver libraryis always triggered here. In some cases, it may be useful to implement this event individually in the context of customizing. E.g. in the context of a document management system, the result should not be saved locally but stored directly as a new file in the DMS. There can also be problems in the context of the IFrame attribute sandbox (IFrame in IFrame case).See also:
https://community.apryse.com/t/intercept-overwrite-download-function-in-webviewer/7245