@@ -10,12 +10,13 @@ import { KwicWordScope } from "./kwic-word"
1010import { SelectWordEvent } from "@/statemachine/types"
1111import { ApiKwic , Token } from "@/backend/types"
1212import { StoreService } from "@/services/store"
13- import { QueryParamSort , QueryResponse } from "@/backend/types/query"
13+ import { QueryParams , QueryParamSort , QueryResponse } from "@/backend/types/query"
1414import { CorpusTransformed } from "@/settings/config-transformed.types"
1515import { JQueryExtended , JQueryStaticExtended } from "@/jquery.types"
1616import { loc } from "@/i18n"
1717import { calculateHitsPicture , HitsPictureItem , isKwic , isLinkedKwic , massageData , Row } from "@/kwic/kwic"
1818import { corpusSelection } from "@/corpora/corpus_listing"
19+ import { RelationsSentencesParams } from "@/backend/types/relations-sentences"
1920
2021type KwicController = IController & {
2122 // Bindings
@@ -29,7 +30,7 @@ type KwicController = IController & {
2930 page : number
3031 pageEvent : ( page : number ) => void
3132 hitsPerPage : number
32- params : any
33+ params : QueryParams | RelationsSentencesParams
3334 response ?: QueryResponse
3435 corpusOrder : string [ ]
3536 /** Current page of results. */
@@ -622,7 +623,7 @@ angular.module("korpApp").component("kwic", {
622623 const next = getNextToken ( )
623624 if ( next ) {
624625 next . trigger ( "click" )
625- scrollToShowWord ( next )
626+ next . get ( 0 ) ?. scrollIntoView ( { block : "nearest" , inline : "nearest" } )
626627 // Return false to prevent default behavior
627628 return false
628629 }
@@ -694,28 +695,6 @@ angular.module("korpApp").component("kwic", {
694695
695696 return output
696697 }
697-
698- function scrollToShowWord ( word : JQLite ) {
699- if ( ! word . length ) return
700- const offset = 200
701-
702- if ( word . offset ( ) ! . top + word . height ( ) ! > window . scrollY + $ ( window ) . height ( ) ! ) {
703- $ ( "html, body" )
704- . stop ( true , true )
705- . animate ( { scrollTop : window . scrollY + offset } )
706- } else if ( word . offset ( ) ! . top < window . scrollY ) {
707- $ ( "html, body" )
708- . stop ( true , true )
709- . animate ( { scrollTop : window . scrollY - offset } )
710- }
711-
712- const area = $element . find ( ".table_scrollarea" )
713- if ( word . offset ( ) ! . left + word . width ( ) ! > area . offset ( ) ! . left + area . width ( ) ! ) {
714- area . stop ( true , true ) . animate ( { scrollLeft : area . scrollLeft ( ) ! + offset } )
715- } else if ( word . offset ( ) ! . left < area . offset ( ) ! . left ) {
716- area . stop ( true , true ) . animate ( { scrollLeft : area . scrollLeft ( ) ! - offset } )
717- }
718- }
719698 } ,
720699 ] ,
721700} )
@@ -757,7 +736,7 @@ class SelectionManager {
757736// Add download links for other formats, defined in
758737// settings["download_formats"] (Jyrki Niemi <[email protected] > 759738// 2014-02-26/04-30)
760- export function setDownloadLinks ( params : string , result_data : { kwic : Row [ ] ; corpus_order : string [ ] } ) : void {
739+ export function setDownloadLinks ( params : any , result_data : { kwic : Row [ ] ; corpus_order : string [ ] } ) : void {
761740 // If some of the required parameters are null, return without
762741 // adding the download links.
763742 if ( ! ( params != null && result_data != null && result_data . corpus_order != null && result_data . kwic != null ) ) {
0 commit comments