From 2b11c2a2297436a2c85cc5f683c036dc86fe54fd Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Wed, 27 May 2015 17:46:40 -0700 Subject: [PATCH] Make left/right arrows work --- dist/flowy.js | 4 ++-- dist/flowy.unwrapped.js | 4 ++-- src/library/cursorToEnd.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/flowy.js b/dist/flowy.js index da82859..8e202cd 100644 --- a/dist/flowy.js +++ b/dist/flowy.js @@ -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 } diff --git a/dist/flowy.unwrapped.js b/dist/flowy.unwrapped.js index 995c2b6..686f1bb 100644 --- a/dist/flowy.unwrapped.js +++ b/dist/flowy.unwrapped.js @@ -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 } diff --git a/src/library/cursorToEnd.js b/src/library/cursorToEnd.js index fae7948..9a04fe2 100644 --- a/src/library/cursorToEnd.js +++ b/src/library/cursorToEnd.js @@ -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 } -- 2.47.3