Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
paste: {
forcePlainText: true,
cleanPastedHTML: true,
cleanReplacements: [],
cleanAttrs: [ 'class', 'style', 'dir', 'id' ],
cleanTags: [ 'meta', 'script' ],
unwrapTags: []
}
});
/**
* set up the date picker for the publication date
*/
const dateInput = document.querySelector('#book-publishing-date'),
datePicker = new Flatpickr(dateInput, {
locale: FlatpickrLocale.de,
defaultDate: new Date(dateInput.dataset.date),
dateFormat: 'd.m.Y',
appendTo: dateInput.parentNode,
static: true
});
document.querySelector('input#book-cover').addEventListener('change', function(event) {
if (this.files && this.files[ 0 ]) {
const reader = new FileReader();
reader.onload = event => {
let coverPlaceholder = document.querySelector('.book-cover-placeholder');
coverPlaceholder.classList.add('loaded');
coverPlaceholder.style.backgroundImage = `url(data:${event.target.result})`;
};