From 1a7cda317b080f59e8322cb3c69d9c7a097f450d Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Thu, 24 Nov 2022 16:15:05 +0100 Subject: [PATCH] [editor] Add comment for GetAnchorIdsPipe --- .../input-groups/button-properties.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/button-properties.component.ts b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/button-properties.component.ts index 591e851e4..36f5810bf 100644 --- a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/button-properties.component.ts +++ b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/button-properties.component.ts @@ -105,6 +105,9 @@ export class ButtonPropertiesComponent { name: 'getAnchorIds' }) export class GetAnchorIdsPipe implements PipeTransform { + // There can be multiple elements with the same data-anchor-id, + // since a selected range can include multiple HTMLElements. + // The first element is filtered out for display in the properties panel. transform(textComponents: { [id: string]: TextComponent }): string[] { return Object.values(textComponents) .map(textComponent => Array.from(textComponent.textContainerRef.nativeElement.querySelectorAll('aspect-anchor')) -- GitLab