Skip to content

Commit

Permalink
Update grande.bind to take in bindableNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mduvall committed Sep 13, 2013
1 parent ce0b42f commit 9a1b5c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="https://github.com/mduvall/grande.js"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>

<section>
<article contenteditable="true" class="content">
<article class="content">
<h1>Welcome, this is grande.js</h1>
<blockquote>"Make every detail perfect and limit the number of details to perfect." - <span class="jack">Jack Dorsey</span></blockquote>
<p>Style your text to how you <b>think</b> and put the <i>feeling</i> into your words. Just select any text and choose how you want it to look from the menu.</p>
Expand All @@ -34,7 +34,7 @@ <h1>Welcome, this is grande.js</h1>

<script type="text/javascript" src="js/grande.js"></script>
<script type="text/javascript">
grande.bind();
grande.bind(document.querySelectorAll("article"));
</script>
</body>
</html>
7 changes: 6 additions & 1 deletion js/grande.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
previouslySelectedText,

grande = {
bind: function() {
bind: function(bindableNodes) {
if (bindableNodes) {
editableNodes = bindableNodes;
}

attachToolbarTemplate();
bindTextSelectionEvents();
bindTextStylingEvents();
Expand Down Expand Up @@ -93,6 +97,7 @@

for (i = 0, len = editableNodes.length; i < len; i++) {
node = editableNodes[i];
node.contentEditable = true;
node.onmousedown = node.onkeyup = node.onmouseup = triggerTextSelection;
}
}
Expand Down

0 comments on commit 9a1b5c4

Please sign in to comment.