1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/javascripts/print.js
Jason Etcovitch f8074874be A couple of tweaks to release notes page (#16934)
* Add link

* Allow multiple print buttons

* Fix scrolling for tall sidebar

Co-authored-by: Chiedo John <2156688+chiedo@users.noreply.github.com>
2020-12-14 22:01:14 +00:00

18 lines
408 B
JavaScript

import { sendEvent } from './events'
export default function () {
const printButtons = document.querySelectorAll('.js-print')
Array.from(printButtons).forEach(btn => {
// Open the print dialog when the button is clicked
btn.addEventListener('click', () => {
window.print()
})
})
// Track print events
window.onbeforeprint = function () {
sendEvent({ type: 'print' })
}
}