Skip to content

Commit

Permalink
improve new print window variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsereko authored and denniskigen committed Nov 12, 2024
1 parent d1a29f0 commit 8e0702f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ const PrintIdentifierSticker: React.FC<PrintIdentifierStickerProps> = ({ closeMo
closeModal();
}, [closeModal]);

const handlePrintOverflow = useCallback((iframe: HTMLIFrameElement | null): Promise<void> => {
const handlePrintWindow = useCallback((printWindow: HTMLIFrameElement | null): Promise<void> => {
return new Promise<void>((resolve) => {
if (iframe) {
const printContent = iframe.contentDocument || iframe.contentWindow?.document;
if (printWindow) {
const printContent = printWindow.contentDocument || printWindow.contentWindow?.document;
if (printContent) {
printContent.body.style.overflow = 'initial !important';
iframe.contentWindow?.print();
printWindow.contentWindow?.print();
}
}
resolve();
Expand Down Expand Up @@ -106,7 +106,7 @@ const PrintIdentifierSticker: React.FC<PrintIdentifierStickerProps> = ({ closeMo
onAfterPrint: handleAfterPrint,
onBeforeGetContent: handleBeforeGetContent,
onPrintError: handlePrintError,
print: handlePrintOverflow,
print: handlePrintWindow,
copyStyles: true,
});

Expand Down

0 comments on commit 8e0702f

Please sign in to comment.