diff --git a/src/js/functions.js b/src/js/functions.js index 3cc5061..069f6f6 100644 --- a/src/js/functions.js +++ b/src/js/functions.js @@ -73,9 +73,9 @@ export function cleanUp (params) { if (params.showModal || params.onLoadingStart) window.URL.revokeObjectURL(params.printable) // Run onPrintDialogClose callback - let event = 'mouseover' + let event = 'mousemove' - if (Browser.isChrome() || Browser.isFirefox()) { + if (Browser.isFirefox()) { // Ps.: Firefox will require an extra click in the document to fire the focus event. event = 'focus' } @@ -94,7 +94,12 @@ export function cleanUp (params) { } } - window.addEventListener(event, handler) + if (Browser.isChrome()) { + // waiting for load print dialog + setTimeout(() => { window.addEventListener(event, handler) }, 1500) + } else { + window.addEventListener(event, handler) + } } export function isRawHTML (raw) { diff --git a/webpack.config.js b/webpack.config.js index a719b37..980be50 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { libraryTarget: 'umd', path: path.resolve(__dirname, 'dist'), filename: 'print.js', - sourceMapFilename: 'print.map', + sourceMapFilename: '[file].map[query]', libraryExport: 'default' }, module: {