Commit 17a13f3e authored by csillag's avatar csillag

Restore the visual diff functionality

AngularJS has killed the ng-bind-html-unsafe directive, which we used
for displaying the visual diff. (See here: https://github.com/angular/angular.js/commit/dae694739b9581bea5dbc53522ec00d87b26ae55 )

Update the code to work with the new way.

Fixes #807.
parent 69499053
...@@ -494,8 +494,8 @@ class App ...@@ -494,8 +494,8 @@ class App
, 5000 , 5000
class Annotation class Annotation
this.$inject = ['$element', '$location', '$scope', 'annotator', 'drafts', '$timeout', '$window'] this.$inject = ['$element', '$location', '$sce', '$scope', 'annotator', 'drafts', '$timeout', '$window']
constructor: ($element, $location, $scope, annotator, drafts, $timeout, $window) -> constructor: ($element, $location, $sce, $scope, annotator, drafts, $timeout, $window) ->
threading = annotator.threading threading = annotator.threading
$scope.action = 'create' $scope.action = 'create'
$scope.editing = false $scope.editing = false
...@@ -611,6 +611,15 @@ class Annotation ...@@ -611,6 +611,15 @@ class Annotation
if annotation? and drafts.contains annotation if annotation? and drafts.contains annotation
$scope.editing = true $scope.editing = true
$scope.$watch 'model.$modelValue.target', (targets) ->
for target in targets
if target.diffHTML?
target.trustedDiffHTML = $sce.trustAsHtml target.diffHTML
target.showDiff = not target.diffCaseOnly
else
delete target.trustedDiffHTML
target.showDiff = false
$scope.$watch 'shared', (newValue) -> $scope.$watch 'shared', (newValue) ->
if newValue? is true if newValue? is true
$timeout -> $element.find('input').focus() $timeout -> $element.find('input').focus()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment