From 5bddc568348700949956aec83f5891ab8b80bad8 Mon Sep 17 00:00:00 2001 From: Stefan Hans Schonert Date: Sun, 19 Apr 2015 21:15:41 +0200 Subject: [PATCH] TextOnly option Option to use text() instead of html() --- angular-contenteditable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/angular-contenteditable.js b/angular-contenteditable.js index 49b59ee..1523356 100644 --- a/angular-contenteditable.js +++ b/angular-contenteditable.js @@ -21,6 +21,7 @@ angular.module('contenteditable', []) 'noLineBreaks', 'selectNonEditable', 'moveCaretToEndOnChange', + 'textOnly', ], function(opt) { var o = attrs[opt] opts[opt] = o && o !== 'false' @@ -30,7 +31,7 @@ angular.module('contenteditable', []) element.bind('input', function(e) { scope.$apply(function() { var html, html2, rerender - html = element.html() + html = opts.textOnly ? element.text() : element.html() rerender = false if (opts.stripBr) { html = html.replace(/
$/, '')