From de2c3d38d6d89260ed96fac0ce2c7999df62eeca Mon Sep 17 00:00:00 2001 From: Andrei Oprea Date: Fri, 28 Feb 2014 18:43:51 +0200 Subject: [PATCH] Reset menu buttons after a selection --- js/bundle.js | 17 ++++++++++++----- js/menu-controller.js | 14 +++++++++----- js/sidemenu-controller.js | 3 +++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/js/bundle.js b/js/bundle.js index 17f35ba..4ed9f8b 100644 --- a/js/bundle.js +++ b/js/bundle.js @@ -196,6 +196,9 @@ var kreator = require('./kreator.js'); kreator(); },{"./kreator.js":2}],4:[function(require,module,exports){ +/* globals module, _, App, Reveal */ +'use strict'; + module.exports = { addListeners: function(handler) { handler.upload.addEventListener('submit', uploadSlides, false); @@ -286,7 +289,6 @@ function appendContent(content) { } function textAlignment() { - console.log('here') var property = 'display:block;text-align:' + this.getAttribute('data-align'); replaceSelectionWithHtml('' + getSelectionHtml() + ''); } @@ -318,24 +320,26 @@ function createCodeBlock() { * */ function setHeading() { replaceSelectionWithHtml('' + getSelectionHtml() + ''); + this.value = 'none'; } function setColor() { replaceSelectionWithHtml('' + getSelectionHtml() + ''); + this.value = '#000'; } function getSelectionHtml() { - var html = ""; - if (typeof window.getSelection != "undefined") { + var html = ''; + if (typeof window.getSelection != 'undefined') { var sel = window.getSelection(); if (sel.rangeCount) { - var container = document.createElement("div"); + var container = document.createElement('div'); for (var i = 0, len = sel.rangeCount; i < len; ++i) { container.appendChild(sel.getRangeAt(i).cloneContents()); } html = container.innerHTML; } - } else if (typeof document.selection != "undefined") { + } else if (typeof document.selection != 'undefined') { if (document.selection.type == "Text") { html = document.selection.createRange().htmlText; } @@ -363,6 +367,9 @@ function replaceSelectionWithHtml(html) { } },{}],5:[function(require,module,exports){ +/* globals module, _, App */ +'use strict'; + module.exports = { addListeners: function(handler) { handler.presentationTitle.addEventListener('keyup', setPresentationTitle, false); diff --git a/js/menu-controller.js b/js/menu-controller.js index aac27c7..0a5a4a6 100644 --- a/js/menu-controller.js +++ b/js/menu-controller.js @@ -1,3 +1,6 @@ +/* globals module, _, App, Reveal */ +'use strict'; + module.exports = { addListeners: function(handler) { handler.upload.addEventListener('submit', uploadSlides, false); @@ -88,7 +91,6 @@ function appendContent(content) { } function textAlignment() { - console.log('here') var property = 'display:block;text-align:' + this.getAttribute('data-align'); replaceSelectionWithHtml('' + getSelectionHtml() + ''); } @@ -120,24 +122,26 @@ function createCodeBlock() { * */ function setHeading() { replaceSelectionWithHtml('' + getSelectionHtml() + ''); + this.value = 'none'; } function setColor() { replaceSelectionWithHtml('' + getSelectionHtml() + ''); + this.value = '#000'; } function getSelectionHtml() { - var html = ""; - if (typeof window.getSelection != "undefined") { + var html = ''; + if (typeof window.getSelection != 'undefined') { var sel = window.getSelection(); if (sel.rangeCount) { - var container = document.createElement("div"); + var container = document.createElement('div'); for (var i = 0, len = sel.rangeCount; i < len; ++i) { container.appendChild(sel.getRangeAt(i).cloneContents()); } html = container.innerHTML; } - } else if (typeof document.selection != "undefined") { + } else if (typeof document.selection != 'undefined') { if (document.selection.type == "Text") { html = document.selection.createRange().htmlText; } diff --git a/js/sidemenu-controller.js b/js/sidemenu-controller.js index d583242..0f28033 100644 --- a/js/sidemenu-controller.js +++ b/js/sidemenu-controller.js @@ -1,3 +1,6 @@ +/* globals module, _, App */ +'use strict'; + module.exports = { addListeners: function(handler) { handler.presentationTitle.addEventListener('keyup', setPresentationTitle, false);