Point to the first object of $element's array

fix-space-nbsp
Ryan Katkov 11 years ago
parent 7ba9e4abcb
commit d0cd823932

@ -38,8 +38,8 @@ angular.module('contenteditable', [])
// the cursor disappears if the contents is empty // the cursor disappears if the contents is empty
// so we need to refocus // so we need to refocus
$timeout(function(){ $timeout(function(){
$element.blur() $element[0].blur()
$element.focus() $element[0].focus()
}) })
} }
}) })
@ -53,7 +53,7 @@ angular.module('contenteditable', [])
oldRender() oldRender()
} }
$element.html(ngModel.$viewValue || '') $element.html(ngModel.$viewValue || '')
el = $element.get(0) el = $element[0]
range = document.createRange() range = document.createRange()
sel = window.getSelection() sel = window.getSelection()
if (el.childNodes.length > 0) { if (el.childNodes.length > 0) {