Skip to content

Commit

Permalink
fix: kwic-word class reactivity
Browse files Browse the repository at this point in the history
Fixes #404
  • Loading branch information
arildm committed Nov 7, 2024
1 parent 28e31ab commit 651bb4a
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions app/scripts/components/kwic-word.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ angular.module("korpApp").component("kwicWord", {
$scope.word = $ctrl.word
$scope.sentence = $ctrl.sentence
$scope.sentenceIndex = $ctrl.sentenceIndex

// Produce applicable class names depending on token data.
$scope.class = {
reading_match: $ctrl.word._match,
punct: $ctrl.word._punct,
match_sentence: $ctrl.word._matchSentence,
link_selected: $ctrl.word._link_selected,
open_sentence: "_open_sentence" in $ctrl.word,
}
}

$scope.$watch(
"word",
(word: Token) => {
// Produce applicable class names depending on token data.
$scope.class = {
reading_match: word._match,
punct: word._punct,
match_sentence: word._matchSentence,
link_selected: word._link_selected,
open_sentence: "_open_sentence" in word,
}
},
true
)
},
],
})

0 comments on commit 651bb4a

Please sign in to comment.