Resetowanie formularza po wydruku. #36

Merged
krzysiej merged 1 commits from issue-35 into master 2018-06-21 22:29:43 +02:00

View File

@@ -1,4 +1,4 @@
var content, preview, selfPrinter;
var content, title, preview, selfPrinter;
var Printer = function () {
@@ -8,6 +8,7 @@ var Printer = function () {
this.delete = document.querySelector('.js-delete');
content = this.content = document.querySelector('.js-content');
title = this.title = document.querySelector('input[name="title"]');
selfPrinter = this;
@@ -32,7 +33,7 @@ var Printer = function () {
/**
* resetuje wybór ikony
*/
this.selectIcon = function(iconTitle){
this.selectIcon = function (iconTitle) {
document.querySelectorAll('.icon').forEach(function (e, i) {
e.classList.remove('selected');
});
@@ -42,7 +43,7 @@ var Printer = function () {
};
this.restoreContentHeight = function () {
if(!!localStorage.getItem('contentHeight')){
if (!!localStorage.getItem('contentHeight')) {
document.querySelector('.js-content').style.height = localStorage.getItem('contentHeight')
}
};
@@ -56,6 +57,7 @@ var Printer = function () {
};
this.clear = function () {
selfPrinter.title.value = '';
selfPrinter.content.innerHTML = '';
selfPrinter.selectIcon('empty');
};