Proper form reseting after printing.

This commit is contained in:
kplaczek
2018-06-21 22:23:49 +02:00
parent db3f7772a6
commit 5d75992372

View File

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