Skip to content

Commit

Permalink
Reset menu buttons after a selection
Browse files Browse the repository at this point in the history
  • Loading branch information
piatra committed Feb 28, 2014
1 parent fb855fa commit de2c3d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
17 changes: 12 additions & 5 deletions js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -286,7 +289,6 @@ function appendContent(content) {
}

function textAlignment() {
console.log('here')
var property = 'display:block;text-align:' + this.getAttribute('data-align');
replaceSelectionWithHtml('<span style="'+property+'">' + getSelectionHtml() + '</span>');
}
Expand Down Expand Up @@ -318,24 +320,26 @@ function createCodeBlock() {
* */
function setHeading() {
replaceSelectionWithHtml('<span style="font-size:'+this.value+'">' + getSelectionHtml() + '</span>');
this.value = 'none';
}

function setColor() {
replaceSelectionWithHtml('<span style="color:'+this.value+'">' + getSelectionHtml() + '</span>');
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;
}
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 9 additions & 5 deletions js/menu-controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* globals module, _, App, Reveal */
'use strict';

module.exports = {
addListeners: function(handler) {
handler.upload.addEventListener('submit', uploadSlides, false);
Expand Down Expand Up @@ -88,7 +91,6 @@ function appendContent(content) {
}

function textAlignment() {
console.log('here')
var property = 'display:block;text-align:' + this.getAttribute('data-align');
replaceSelectionWithHtml('<span style="'+property+'">' + getSelectionHtml() + '</span>');
}
Expand Down Expand Up @@ -120,24 +122,26 @@ function createCodeBlock() {
* */
function setHeading() {
replaceSelectionWithHtml('<span style="font-size:'+this.value+'">' + getSelectionHtml() + '</span>');
this.value = 'none';
}

function setColor() {
replaceSelectionWithHtml('<span style="color:'+this.value+'">' + getSelectionHtml() + '</span>');
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;
}
Expand Down
3 changes: 3 additions & 0 deletions js/sidemenu-controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* globals module, _, App */
'use strict';

module.exports = {
addListeners: function(handler) {
handler.presentationTitle.addEventListener('keyup', setPresentationTitle, false);
Expand Down

0 comments on commit de2c3d3

Please sign in to comment.