From 357d6d7671bb80040c7291ef0075ec2a8a128d76 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Wed, 16 Oct 2024 18:33:40 +0200 Subject: [PATCH] Add place sensitive classes --- .../motion-slide/motion-slide.component.scss | 26 +++++----- .../motion-format.service.ts | 48 ++++++++++++++----- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.scss b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.scss index d1c305d9f8..5778887b18 100644 --- a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.scss +++ b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.scss @@ -73,25 +73,21 @@ } .amendment-nr-n-icon { - display: block; - //display: flex; - //align-items: center; - //justify-content: flex-start; - //border: 1px solid black; + display: flex; + align-items: center; + justify-content: flex-start; position: relative; left: -40px; - bottom: 12px; - height: 0; - margin-top: 45px; + height: 1.5em; + margin-top: 25px; +} - .amendment-nr { - position: relative; - bottom: 3px; - font-style: italic; - background-color: rgb(224, 224, 224); - } +.amendment-nr { + position: relative; + font-style: italic; + background-color: rgb(224, 224, 224); } -.os-linebreak { +.os-linebreak { display: none !important; } diff --git a/client/src/app/site/pages/meetings/pages/motions/services/common/motion-format.service/motion-format.service.ts b/client/src/app/site/pages/meetings/pages/motions/services/common/motion-format.service/motion-format.service.ts index 65129e9d15..a284086fc7 100644 --- a/client/src/app/site/pages/meetings/pages/motions/services/common/motion-format.service/motion-format.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/services/common/motion-format.service/motion-format.service.ts @@ -240,9 +240,6 @@ export class MotionFormatService { ); } text.push(...this.addAmendmentNr(changesToShow, changesToShow[i])); - if (text[text.length - 3]?.search(`:`)) { - text[text.length - 1] = text[text.length - 1].replace(`os-line-number `, ``); - } text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine)); lastLineTo = changesToShow[i].getLineTo(); } @@ -250,10 +247,7 @@ export class MotionFormatService { text.push( this.diffService.getTextRemainderAfterLastChange(motionText, changesToShow, lineLength, highlightedLine) ); - if (text[0].match(``)) { - text[0] = text[0].replace(`os-line-number `, ``); - } - return text.join(``); + return this.adjustDiffClasses(text).join(``); }; public hasCollissions(change: ViewUnifiedChange, changes: ViewUnifiedChange[]): boolean { @@ -263,14 +257,28 @@ export class MotionFormatService { private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string[] { const lineNumbering = this.settings.instant(`motions_default_line_numbering`); const amendmentNr: string[] = []; - amendmentNr.push(``); + if (this.hasCollissions(current_text, changesToShow)) { if (lineNumbering === LineNumberingMode.Outside) { - amendmentNr.push(`warning`); + amendmentNr.push( + `warning` + ); } else if (lineNumbering === LineNumberingMode.Inside) { - amendmentNr.push(`warning`); + amendmentNr.push( + `warning` + ); } else { - amendmentNr.push(`warning`); + amendmentNr.push( + `warning` + ); + } + } else { + if (lineNumbering === LineNumberingMode.Outside) { + amendmentNr.push(``); + } else if (lineNumbering === LineNumberingMode.Inside) { + amendmentNr.push(``); + } else { + amendmentNr.push(``); } } if (`amend_nr` in current_text) { @@ -284,4 +292,22 @@ export class MotionFormatService { } return amendmentNr; } + + private adjustDiffClasses(text: string[]): string[] { + for (let i = 0; i < text.length; i++) { + // Removes the unwanted gap between the paragraph and the amendment number + if (text[i]?.search(`amendment-nr-n-icon`) > -1) { + text[i + 4] = text[i + 4]?.replace(`os-split-after`, `os-split-after margin-top-0`); + if (i < 4) { + text[i + 3] = text[i + 3]?.replace(`os-split-after`, `os-split-after margin-top-0`); + } + } + + // Removes the doubled numbers + if (text[i]?.search(` -1) { + text[i] = text[i].replace(`os-line-number `, ``); + } + } + return text; + } }