diff --git a/app/scripts/components/kwic.js b/app/scripts/components/kwic.js index 4c0ec6649..037c15a99 100644 --- a/app/scripts/components/kwic.js +++ b/app/scripts/components/kwic.js @@ -46,8 +46,8 @@ angular.module("korpApp").component("kwic", { hits-per-page="$ctrl.hitsPerPage" > - {{'show_reading' | loc:$root.lang}} - {{'show_kwic' | loc:$root.lang}} + {{'show_reading' | loc:$root.lang}} + {{'show_kwic' | loc:$root.lang}}
@@ -257,12 +257,10 @@ angular.module("korpApp").component("kwic", { $ctrl._settings = settings $ctrl.toggleReading = () => { - $ctrl.readingMode = !$ctrl.readingMode + // Emit event; parent should update isReading $ctrl.contextChangeEvent() } - $ctrl.readingMode = $location.search().reading_mode - $ctrl.download = { options: [ { value: "", label: "download_kwic" }, @@ -655,7 +653,7 @@ angular.module("korpApp").component("kwic", { function selectNext() { let next - if (!$ctrl.readingMode) { + if (!$ctrl.isReading) { const i = getCurrentRow().index($element.find(".token_selected").get(0)) next = getCurrentRow().get(i + 1) if (next == null) { @@ -670,7 +668,7 @@ angular.module("korpApp").component("kwic", { function selectPrev() { let prev - if (!$ctrl.readingMode) { + if (!$ctrl.isReading) { const i = getCurrentRow().index($element.find(".token_selected").get(0)) if (i === 0) { return @@ -686,7 +684,7 @@ angular.module("korpApp").component("kwic", { function selectUp() { let prevMatch const current = selectionManager.selected - if (!$ctrl.readingMode) { + if (!$ctrl.isReading) { prevMatch = getWordAt( current.offset().left + current.width() / 2, current.closest("tr").prevAll(":not(.corpus_info)").first() @@ -715,7 +713,7 @@ angular.module("korpApp").component("kwic", { function selectDown() { let nextMatch const current = selectionManager.selected - if (!$ctrl.readingMode) { + if (!$ctrl.isReading) { nextMatch = getWordAt( current.offset().left + current.width() / 2, current.closest("tr").nextAll(":not(.corpus_info)").first() diff --git a/app/scripts/controllers/kwic_controller.ts b/app/scripts/controllers/kwic_controller.ts index 48f7df1ef..0e4d37adb 100644 --- a/app/scripts/controllers/kwic_controller.ts +++ b/app/scripts/controllers/kwic_controller.ts @@ -140,11 +140,7 @@ export class KwicCtrl implements IController { s.reading_mode = $location.search().reading_mode s.toggleReading = function () { s.reading_mode = !s.reading_mode - if (s.reading_mode) { - $location.search("reading_mode", true) - } else { - $location.search("reading_mode", undefined) - } + $location.search("reading_mode", s.reading_mode || undefined) s.readingChange() }