]> git.za3k.com Git - flowy.git/commitdiff
Make left/right arrows work
authorZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 00:46:40 +0000 (17:46 -0700)
committerZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 00:46:40 +0000 (17:46 -0700)
dist/flowy.js
dist/flowy.unwrapped.js
src/library/cursorToEnd.js

index da82859cb09413313eff6b9326906208dfa4a079..8e202cdff9e39c9fd71574f0edf8701d9f02895c 100644 (file)
@@ -5,7 +5,7 @@ function setEndOfContenteditable(contentEditableElement)
     if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
     {
         range = document.createRange();//Create a range (a range is a like the selection but invisible)
-        range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
+        range.selectNodeContents(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         selection = window.getSelection();//get the selection object (allows you to change selection)
         selection.removeAllRanges();//remove any selections already made
@@ -14,7 +14,7 @@ function setEndOfContenteditable(contentEditableElement)
     else if(document.selection)//IE 8 and lower
     { 
         range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)
-        range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range
+        range.moveToElementText(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         range.select();//Select the range (make it the visible selection
     }
index 995c2b656e953d6946fd021c942f6024115adb1d..686f1bbf7a34567d09fd1df0f4380b311a95e747 100644 (file)
@@ -4,7 +4,7 @@ function setEndOfContenteditable(contentEditableElement)
     if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
     {
         range = document.createRange();//Create a range (a range is a like the selection but invisible)
-        range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
+        range.selectNodeContents(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         selection = window.getSelection();//get the selection object (allows you to change selection)
         selection.removeAllRanges();//remove any selections already made
@@ -13,7 +13,7 @@ function setEndOfContenteditable(contentEditableElement)
     else if(document.selection)//IE 8 and lower
     { 
         range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)
-        range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range
+        range.moveToElementText(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         range.select();//Select the range (make it the visible selection
     }
index fae79483bf48db66df3f6b64a3522801a1ff4983..9a04fe2c19b8c1ac3fae414dc9d2f8f9fa1ad449 100644 (file)
@@ -4,7 +4,7 @@ function setEndOfContenteditable(contentEditableElement)
     if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
     {
         range = document.createRange();//Create a range (a range is a like the selection but invisible)
-        range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
+        range.selectNodeContents(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         selection = window.getSelection();//get the selection object (allows you to change selection)
         selection.removeAllRanges();//remove any selections already made
@@ -13,7 +13,7 @@ function setEndOfContenteditable(contentEditableElement)
     else if(document.selection)//IE 8 and lower
     { 
         range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)
-        range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range
+        range.moveToElementText(contentEditableElement.childNodes[0]);//Select the entire contents of the element with the range
         range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
         range.select();//Select the range (make it the visible selection
     }