From 9ed7fc4b56f3e350b93dc59a735fb06524973b81 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Tue, 1 Oct 2024 13:17:04 +0200 Subject: [PATCH 1/7] Add icon and amendment number --- .../amendment-paragraph-unified-change.ts | 2 ++ .../motion-slide/motion-slide.component.scss | 8 ++++++++ .../motion-slide/motion-slide.component.ts | 2 +- .../motion-format.service.ts | 18 +++++++++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/amendment-paragraph-unified-change.ts b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/amendment-paragraph-unified-change.ts index bf27087f30..b24705c9a8 100644 --- a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/amendment-paragraph-unified-change.ts +++ b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/amendment-paragraph-unified-change.ts @@ -13,6 +13,7 @@ export class AmendmentParagraphUnifiedChange implements ViewUnifiedChange { public type!: number; public merge_amendment_into_final: MergeAmendment; public merge_amendment_into_diff: MergeAmendment; + public amend_nr: string; public constructor( data: AmendmentData, @@ -23,6 +24,7 @@ export class AmendmentParagraphUnifiedChange implements ViewUnifiedChange { this.id = data.id; this.merge_amendment_into_final = data.merge_amendment_into_final; this.merge_amendment_into_diff = data.merge_amendment_into_diff; + this.amend_nr = data.number; } public getTitle(): string { 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 03c3bdc6df..184525fc57 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 @@ -68,3 +68,11 @@ } } } + +.amendment-nr { + display: block; + //border: 1px solid black; + position: relative; + left: -40px; + bottom:-30px +} diff --git a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.ts b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.ts index b1416817b2..c5a2e4f7d1 100644 --- a/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.ts +++ b/client/src/app/site/pages/meetings/modules/projector/modules/slides/components/motions/modules/motion-slide/components/motion-slide/motion-slide.component.ts @@ -365,7 +365,7 @@ export class MotionSlideComponent return html; } - public getAllTextChangingObjects(): ViewUnifiedChange[] { + private getAllTextChangingObjects(): ViewUnifiedChange[] { return this.allChangingObjects.filter((obj: ViewUnifiedChange) => !obj.isTitleChange()); } 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 586ba427e1..5abd58c967 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 @@ -239,9 +239,21 @@ export class MotionFormatService { ) ); } - + text.push(`
`); + if (this.hasCollissions(changesToShow[0], changesToShow)) { + text.push(`warning`); + } + const current_text = changesToShow[i]; + if (`amend_nr` in current_text) { + text.push(``, current_text.amend_nr); + if (current_text.amend_nr === `` && !this.hasCollissions(changesToShow[0], changesToShow)) { + text.push(`Amendment`); + } + text.push(`
`); + } text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine)); lastLineTo = changesToShow[i].getLineTo(); + console.log(`outside if `); } text.push( @@ -249,4 +261,8 @@ export class MotionFormatService { ); return text.join(``); }; + + public hasCollissions(change: ViewUnifiedChange, changes: ViewUnifiedChange[]): boolean { + return this.diffService.changeHasCollissions(change, changes); + } } From 63a10f89809c7a0cd99a1e0a453f8aeccfbf7433 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Tue, 1 Oct 2024 17:23:20 +0200 Subject: [PATCH 2/7] intermediate results --- .../motion-slide/motion-slide.component.scss | 20 +++++++++++++++++-- .../motion-diff.service.ts | 2 ++ .../motion-format.service.ts | 17 +++++++++------- 3 files changed, 30 insertions(+), 9 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 184525fc57..46feb5daa1 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 @@ -69,10 +69,26 @@ } } -.amendment-nr { +.amendment-nr-n-icon { display: block; + //display: flex; + //align-items: center; + //justify-content: flex-start; //border: 1px solid black; position: relative; left: -40px; - bottom:-30px + bottom: 12px; + height: 0; + margin-top: 45px; + + .amendment-nr { + position: relative; + bottom: 3px; + font-style: italic; + background-color: rgb(224, 224, 224); + } +} + +.os-linebreak { + display: none !important; } diff --git a/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts b/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts index 4b3601eaa3..f22cf36343 100644 --- a/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts @@ -2005,6 +2005,7 @@ export class MotionDiffService { firstLine: change.getLineFrom() }); let diff = this.diff(oldText, change.getChangeNewText()); + //console.log(diff); // If an insertion makes the line longer than the line length limit, we need two line breaking runs: // - First, for the official line numbers, ignoring insertions (that's been done some lines before) @@ -2022,6 +2023,7 @@ export class MotionDiffService { DomHelpers.addCSSClassToFirstTag(origBeginning, `merge-before`) + diff.substring(origBeginning.length); } + //console.log(diff); return diff; } 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 5abd58c967..d93be38767 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 @@ -215,7 +215,7 @@ export class MotionFormatService { private getDiffView = (targetMotion: MotionFormattingRepresentation, args: DifferedViewArguments): string => { const { changes, lineLength, highlightedLine, firstLine }: DifferedViewArguments = args; - const text = []; + const text: string[] = []; const changesToShow = changes.filter(change => change.showInDiffView()); const motionText = this.lineNumberingService.insertLineNumbers({ html: targetMotion.text, @@ -239,26 +239,29 @@ export class MotionFormatService { ) ); } - text.push(`
`); - if (this.hasCollissions(changesToShow[0], changesToShow)) { + text[text.length - 1] = text[text.length - 1].replace(`os-line-number `, ``); + text.push(``); + if (this.hasCollissions(changesToShow[i], changesToShow)) { text.push(`warning`); } const current_text = changesToShow[i]; if (`amend_nr` in current_text) { - text.push(``, current_text.amend_nr); - if (current_text.amend_nr === `` && !this.hasCollissions(changesToShow[0], changesToShow)) { + if (typeof current_text.amend_nr === `string`) { + text.push(``, current_text.amend_nr); + } + if (current_text.amend_nr === ``) { text.push(`Amendment`); } - text.push(`
`); + text.push(`:`); } text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine)); lastLineTo = changesToShow[i].getLineTo(); - console.log(`outside if `); } text.push( this.diffService.getTextRemainderAfterLastChange(motionText, changesToShow, lineLength, highlightedLine) ); + //console.log(text, text.join(``)); return text.join(``); }; From cfec3960d60ac1bb6887bf8d678c9f9213d123d6 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Wed, 16 Oct 2024 11:38:12 +0200 Subject: [PATCH 3/7] Create own function --- .../motion-diff.service.ts | 2 -- .../motion-format.service.ts | 35 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts b/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts index f22cf36343..4b3601eaa3 100644 --- a/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/modules/change-recommendations/services/motion-diff.service/motion-diff.service.ts @@ -2005,7 +2005,6 @@ export class MotionDiffService { firstLine: change.getLineFrom() }); let diff = this.diff(oldText, change.getChangeNewText()); - //console.log(diff); // If an insertion makes the line longer than the line length limit, we need two line breaking runs: // - First, for the official line numbers, ignoring insertions (that's been done some lines before) @@ -2023,7 +2022,6 @@ export class MotionDiffService { DomHelpers.addCSSClassToFirstTag(origBeginning, `merge-before`) + diff.substring(origBeginning.length); } - //console.log(diff); return diff; } 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 d93be38767..45fb026e8d 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 @@ -239,21 +239,7 @@ export class MotionFormatService { ) ); } - text[text.length - 1] = text[text.length - 1].replace(`os-line-number `, ``); - text.push(``); - if (this.hasCollissions(changesToShow[i], changesToShow)) { - text.push(`warning`); - } - const current_text = changesToShow[i]; - if (`amend_nr` in current_text) { - if (typeof current_text.amend_nr === `string`) { - text.push(``, current_text.amend_nr); - } - if (current_text.amend_nr === ``) { - text.push(`Amendment`); - } - text.push(`:`); - } + text.push(...this.addAmendmentNr(changesToShow, changesToShow[i])); text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine)); lastLineTo = changesToShow[i].getLineTo(); } @@ -261,11 +247,28 @@ export class MotionFormatService { text.push( this.diffService.getTextRemainderAfterLastChange(motionText, changesToShow, lineLength, highlightedLine) ); - //console.log(text, text.join(``)); return text.join(``); }; public hasCollissions(change: ViewUnifiedChange, changes: ViewUnifiedChange[]): boolean { return this.diffService.changeHasCollissions(change, changes); } + + private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string[] { + const amendmentNr: string[] = []; + amendmentNr.push(``); + if (this.hasCollissions(current_text, changesToShow)) { + amendmentNr.push(`warning`); + } + if (`amend_nr` in current_text) { + if (typeof current_text.amend_nr === `string`) { + amendmentNr.push(``, current_text.amend_nr); + } + if (current_text.amend_nr === ``) { + amendmentNr.push(`Amendment`); + } + amendmentNr.push(`:`); + } + return amendmentNr; + } } From a7fd7f74a6f99bcffdf1b5b872558cae672cdda9 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Wed, 16 Oct 2024 11:38:45 +0200 Subject: [PATCH 4/7] Remove wrong line numbers --- .../common/motion-format.service/motion-format.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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 45fb026e8d..b57e2d3f0e 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,6 +240,9 @@ 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(); } @@ -247,6 +250,9 @@ 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(``); }; From ddfd7311b19836dfa84b0ed103bce8754a64c761 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Wed, 16 Oct 2024 17:09:38 +0200 Subject: [PATCH 5/7] Add sensitivity to settings --- .../motion-format.service/motion-format.service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 b57e2d3f0e..65129e9d15 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 @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Id } from 'src/app/domain/definitions/key-types'; import { MotionFormattingRepresentation } from 'src/app/domain/models/motions/motion'; -import { ChangeRecoMode } from 'src/app/domain/models/motions/motions.constants'; +import { ChangeRecoMode, LineNumberingMode } from 'src/app/domain/models/motions/motions.constants'; import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service'; import { ViewUnifiedChange, ViewUnifiedChangeType } from '../../../modules'; @@ -261,10 +261,17 @@ 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)) { - amendmentNr.push(`warning`); + if (lineNumbering === LineNumberingMode.Outside) { + amendmentNr.push(`warning`); + } else if (lineNumbering === LineNumberingMode.Inside) { + amendmentNr.push(`warning`); + } else { + amendmentNr.push(`warning`); + } } if (`amend_nr` in current_text) { if (typeof current_text.amend_nr === `string`) { From 357d6d7671bb80040c7291ef0075ec2a8a128d76 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Wed, 16 Oct 2024 18:33:40 +0200 Subject: [PATCH 6/7] 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; + } } From f66d13dff31f9b4b2ec718488bd46866cb5b6b86 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Fri, 18 Oct 2024 10:56:05 +0200 Subject: [PATCH 7/7] CR --- .../motion-format.service.ts | 36 +++++++++---------- .../components/editor/extensions/office.ts | 4 +-- 2 files changed, 18 insertions(+), 22 deletions(-) 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 a284086fc7..034053255a 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 @@ -239,7 +239,7 @@ export class MotionFormatService { ) ); } - text.push(...this.addAmendmentNr(changesToShow, changesToShow[i])); + text.push(this.addAmendmentNr(changesToShow, changesToShow[i])); text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine)); lastLineTo = changesToShow[i].getLineTo(); } @@ -250,15 +250,11 @@ export class MotionFormatService { return this.adjustDiffClasses(text).join(``); }; - public hasCollissions(change: ViewUnifiedChange, changes: ViewUnifiedChange[]): boolean { - return this.diffService.changeHasCollissions(change, changes); - } - - private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string[] { + private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string { const lineNumbering = this.settings.instant(`motions_default_line_numbering`); const amendmentNr: string[] = []; - if (this.hasCollissions(current_text, changesToShow)) { + if (this.diffService.changeHasCollissions(current_text, changesToShow)) { if (lineNumbering === LineNumberingMode.Outside) { amendmentNr.push( `warning` @@ -282,32 +278,32 @@ export class MotionFormatService { } } if (`amend_nr` in current_text) { + amendmentNr.push(``); if (typeof current_text.amend_nr === `string`) { - amendmentNr.push(``, current_text.amend_nr); + amendmentNr.push(current_text.amend_nr); } if (current_text.amend_nr === ``) { amendmentNr.push(`Amendment`); } - amendmentNr.push(`:`); + amendmentNr.push(`:`); } - return amendmentNr; + amendmentNr.push(``); + return amendmentNr.join(``); } 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 `, ``); + if (text[i]?.indexOf(`amendment-nr-n-icon`) !== -1) { + text[i + 1] = text[i + 1]?.replace(`os-split-after`, `os-split-after margin-top-0`); } } + // Removes the doubled number from the first line + if ( + text[0].match(``) + ) { + text[0] = text[0].replace(` class=\"os-line-number line-number-1\"`, ``); + } return text; } } diff --git a/client/src/app/ui/modules/editor/components/editor/extensions/office.ts b/client/src/app/ui/modules/editor/components/editor/extensions/office.ts index ca1e5c068d..28be4d464a 100644 --- a/client/src/app/ui/modules/editor/components/editor/extensions/office.ts +++ b/client/src/app/ui/modules/editor/components/editor/extensions/office.ts @@ -15,13 +15,13 @@ export const MSOfficePaste = Extension.create({ const OfficePastePlugin = new Plugin({ props: { transformPastedHTML(html: string): string { - console.log([html]); + console.debug([html]); if (html.indexOf(`microsoft-com`) !== -1 && html.indexOf(`office`) !== -1) { html = transformLists(html); html = transformRemoveBookmarks(html); html = transformMsoStyles(html); } - console.log([html]); + console.debug([html]); return html; } }