From d7a2f85379a72510bbf2e866f6b1dca84accc8f5 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Mon, 15 Jul 2024 16:08:31 +0200 Subject: [PATCH] [editor] Fix Droplist-Template to work with new numbering feature --- .../src/app/services/template.service.ts | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/projects/editor/src/app/services/template.service.ts b/projects/editor/src/app/services/template.service.ts index 021a0194c..b70dd3ff5 100644 --- a/projects/editor/src/app/services/template.service.ts +++ b/projects/editor/src/app/services/template.service.ts @@ -706,18 +706,13 @@ export class TemplateService { { gridRow: 1, gridColumn: 1, - gridColumnRange: config.numbering ? 2 : 1, + gridColumnRange: 1, marginBottom: { value: 20, unit: 'px' } }, { text: config.text1 }), this.createElement( 'drop-list', - { - gridRow: 2, - gridColumn: config.numbering ? 2 : 1, - gridRowRange: config.numbering ? config.options.length : 1, - marginBottom: { value: 40, unit: 'px' } - }, + { gridRow: 2, gridColumn: 1, marginBottom: { value: 40, unit: 'px' } }, { dimensions: { // eslint-disable-next-line no-nested-ternary @@ -726,23 +721,13 @@ export class TemplateService { value: config.options, orientation: 'vertical', isSortList: true, - highlightReceivingDropList: true + highlightReceivingDropList: true, + showNumbering: config.numbering }) ]; - if (config.numbering) { - for (let i = 0; i < config.options.length; i++) { - sectionElements.push( - this.createElement( - 'text', - { gridRow: i + 2, gridColumn: 1 }, - { text: `${i}.`, lineHeight: 260 }) - ); - } - } + return new Section({ - elements: sectionElements, - ...config.numbering && { autoColumnSize: false }, - ...config.numbering && { gridColumnSizes: [{ value: 25, unit: 'px' }, { value: 1, unit: 'fr' }] } + elements: sectionElements } as SectionProperties); } -- GitLab