From 76e0c0875be7ac8ee2ad075e5aceb438dc72dafe Mon Sep 17 00:00:00 2001 From: fsimonjetz Date: Wed, 31 Jul 2024 08:43:27 +0000 Subject: [PATCH] move isInLineGroup to class scope --- src/transliteration/domain/columns.ts | 3 +-- src/transliteration/ui/LineAccumulator.tsx | 10 ++++++---- src/transliteration/ui/line-tokens.tsx | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/transliteration/domain/columns.ts b/src/transliteration/domain/columns.ts index 263811ddc..16d2f792e 100644 --- a/src/transliteration/domain/columns.ts +++ b/src/transliteration/domain/columns.ts @@ -59,7 +59,6 @@ export function lineAccFromColumns({ acc.addColumnToken( token, index, - isInLineGroup, showMeter, showIpa, updatePhoneticPropsContext(column.content, index, phoneticProps), @@ -72,7 +71,7 @@ export function lineAccFromColumns({ acc ) return acc - }, new LineAccumulator()) + }, new LineAccumulator(isInLineGroup)) } export function numberOfColumns(columns: readonly TextLineColumn[]): number { diff --git a/src/transliteration/ui/LineAccumulator.tsx b/src/transliteration/ui/LineAccumulator.tsx index 10a16b6ec..a34bc8197 100644 --- a/src/transliteration/ui/LineAccumulator.tsx +++ b/src/transliteration/ui/LineAccumulator.tsx @@ -56,8 +56,13 @@ export class LineAccumulator { private enclosureOpened = false private protocol: Protocol | null = null private isFirstWord = true + private isInLineGroup = false lemmas: string[] = [] + constructor(isInLineGroup?: boolean) { + this.isInLineGroup = isInLineGroup || false + } + getColumns(maxColumns: number): React.ReactNode[] { return this.columns.map((column: ColumnData, index: number) => ( @@ -87,7 +92,6 @@ export class LineAccumulator { pushToken( token: Token, index: number, - isInLineGroup = false, showMeter = false, showIpa = false, phoneticProps?: PhoneticProps, @@ -100,7 +104,7 @@ export class LineAccumulator { this.pushSeparator() } - const DisplayTokenComponent = isInLineGroup + const DisplayTokenComponent = this.isInLineGroup ? DisplayLineGroupToken : DisplayToken @@ -139,7 +143,6 @@ export class LineAccumulator { addColumnToken( token: Token, index: number, - isInLineGroup?: boolean, showMeter?: boolean, showIpa?: boolean, phoneticProps?: PhoneticProps, @@ -161,7 +164,6 @@ export class LineAccumulator { this.pushToken( token, index, - isInLineGroup, showMeter, showIpa, phoneticProps, diff --git a/src/transliteration/ui/line-tokens.tsx b/src/transliteration/ui/line-tokens.tsx index 2699c216d..cf51f4393 100644 --- a/src/transliteration/ui/line-tokens.tsx +++ b/src/transliteration/ui/line-tokens.tsx @@ -30,7 +30,6 @@ export function LineTokens({ index, false, false, - false, {}, highlightTokens.includes(index) ? ['highlight'] : [] )