Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
fixing bug. when setting the model first, we need to replace the newl…
Browse files Browse the repository at this point in the history
…ines to <br>s
  • Loading branch information
davidecavaliere committed Aug 24, 2015
1 parent 9c75035 commit 010411c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions angular-contenteditable.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ angular.module('contenteditable', [])
if (!!oldRender) {
oldRender()
}

if (opts.unformattedText) {
ngModel.$viewValue = ngModel.$viewValue.replace(new RegExp('\n','g'), '<br>');
}

element.html(ngModel.$viewValue || '')
if (opts.moveCaretToEndOnChange) {
el = element[0]
Expand Down

0 comments on commit 010411c

Please sign in to comment.