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

Commit 010411c

Browse files
fixing bug. when setting the model first, we need to replace the newlines to <br>s
1 parent 9c75035 commit 010411c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

angular-contenteditable.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ angular.module('contenteditable', [])
6565
if (!!oldRender) {
6666
oldRender()
6767
}
68+
69+
if (opts.unformattedText) {
70+
ngModel.$viewValue = ngModel.$viewValue.replace(new RegExp('\n','g'), '<br>');
71+
}
72+
6873
element.html(ngModel.$viewValue || '')
6974
if (opts.moveCaretToEndOnChange) {
7075
el = element[0]

0 commit comments

Comments
 (0)