Merge branch 'issue-1'
# Conflicts: # public/js/printer.js
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
var content, preview;
|
var content, preview, selfPrinter;
|
||||||
var Printer = function () {
|
var Printer = function () {
|
||||||
|
|
||||||
|
|
||||||
@@ -8,14 +8,11 @@ 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');
|
||||||
// preview = this.preview = document.querySelector('#editor');
|
|
||||||
|
|
||||||
|
|
||||||
selfPrinter = this;
|
selfPrinter = this;
|
||||||
this.reset.addEventListener('click', this.clear);
|
this.reset.addEventListener('click', this.clear);
|
||||||
|
|
||||||
// this.content.addEventListener('keypress', this.printPreview);
|
|
||||||
// this.preview.addEventListener('keyup', this.divToTextbox);
|
|
||||||
content.addEventListener("mouseup", this.contentResize);
|
content.addEventListener("mouseup", this.contentResize);
|
||||||
|
|
||||||
this.restoreContentHeight();
|
this.restoreContentHeight();
|
||||||
@@ -26,34 +23,24 @@ var Printer = function () {
|
|||||||
|
|
||||||
document.querySelectorAll('.icon').forEach(function (e) {
|
document.querySelectorAll('.icon').forEach(function (e) {
|
||||||
e.addEventListener('click', function () {
|
e.addEventListener('click', function () {
|
||||||
document.querySelectorAll('.icon').forEach(function (e, i) {
|
selfPrinter.selectIcon(this.title);
|
||||||
e.classList.remove('selected');
|
|
||||||
});
|
|
||||||
document.querySelector('#icon').value = this.title;
|
|
||||||
this.classList.add('selected');
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// this.commandCenter = document.querySelector('.icon.command.center');
|
|
||||||
// this.commandLeft = document.querySelector('.icon.command.left');
|
|
||||||
// this.commandRight = document.querySelector('.icon.command.right');
|
|
||||||
// this.commandBold = document.querySelector('.icon.command.bold');
|
|
||||||
// this.commandItalic = document.querySelector('.icon.command.italic');
|
|
||||||
// this.commandUnderline = document.querySelector('.icon.command.underline');
|
|
||||||
|
|
||||||
// this.commandCenter.addEventListener('click', function(){document.execCommand('justifyCenter', false);});
|
|
||||||
// this.commandLeft.addEventListener('click', function(){document.execCommand('justifyLeft', false);});
|
|
||||||
// this.commandRight.addEventListener('click', function(){document.execCommand('justifyRight', false);});
|
|
||||||
|
|
||||||
// this.commandBold.addEventListener('click', function(){document.execCommand('bold', false);});
|
|
||||||
// this.commandItalic.addEventListener('click', function(){document.execCommand('italic', false);});
|
|
||||||
// this.commandUnderline.addEventListener('click', function(){document.execCommand('underline', false);});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* resetuje wybór ikony
|
||||||
|
*/
|
||||||
|
this.selectIcon = function(iconTitle){
|
||||||
|
document.querySelectorAll('.icon').forEach(function (e, i) {
|
||||||
|
e.classList.remove('selected');
|
||||||
|
});
|
||||||
|
document.querySelector('#icon').value = iconTitle;
|
||||||
|
var selector = '.icon[title="' + iconTitle + '"]';
|
||||||
|
document.querySelector(selector).classList.add('selected');
|
||||||
|
};
|
||||||
|
|
||||||
// this.printPreview = function(){
|
|
||||||
// preview.innerText = content.value;
|
|
||||||
// };
|
|
||||||
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')
|
||||||
@@ -70,6 +57,7 @@ var Printer = function () {
|
|||||||
|
|
||||||
this.clear = function () {
|
this.clear = function () {
|
||||||
selfPrinter.content.innerHTML = '';
|
selfPrinter.content.innerHTML = '';
|
||||||
|
selfPrinter.selectIcon('empty');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.confirmDelete = function (e) {
|
this.confirmDelete = function (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user