From 211c1c75213437062f51d6a12e4730403c4a7ba7 Mon Sep 17 00:00:00 2001 From: Hans Kerkhof Date: Fri, 23 May 2014 13:32:03 +0200 Subject: [PATCH 1/2] Update angular-redactor.js fix for html code view in redactor v9.2.1+ --- angular-redactor.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/angular-redactor.js b/angular-redactor.js index caac80b..0afdfb7 100644 --- a/angular-redactor.js +++ b/angular-redactor.js @@ -16,10 +16,13 @@ link: function (scope, element, attrs, ngModel) { var updateModel = function updateModel(value) { - scope.$apply(function () { - ngModel.$setViewValue(value); - }); - }, + /* fix for html code view in redactor v9.2.1+ */ + if(element.not(':visible')) { + scope.$apply(function () { + ngModel.$setViewValue(value); + }); + } + }, options = { changeCallback: updateModel }, From fd90400ac063d2fc31e2b7eaaa3220a4ad6f79d1 Mon Sep 17 00:00:00 2001 From: hanskerkhof Date: Sat, 20 Dec 2014 15:42:17 +0100 Subject: [PATCH 2/2] Set form pristine after init --- angular-redactor.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/angular-redactor.js b/angular-redactor.js index 0afdfb7..66b7ab2 100644 --- a/angular-redactor.js +++ b/angular-redactor.js @@ -1,6 +1,5 @@ (function () { 'use strict'; - /** * usage: * @@ -33,8 +32,7 @@ angular.extend(options, additionalOptions); - // put in timeout to avoid $digest collision. call render() to - // set the initial value. + // put in timeout to avoid $digest collision. call render() to set the initial value. $timeout(function () { editor = $_element.redactor(options); ngModel.$render(); @@ -44,6 +42,7 @@ if (angular.isDefined(editor)) { $timeout(function() { $_element.redactor('set', ngModel.$viewValue || ''); + ngForm.$setPristine(); }); } };