diff --git a/projects/common/components/ui-elements/cloze.component.ts b/projects/common/components/ui-elements/cloze.component.ts index e1c0101dca30d116ce1596e5f1488c15dabd8170..d9b719e4c08517a4582081df26a86787eab5dc92 100644 --- a/projects/common/components/ui-elements/cloze.component.ts +++ b/projects/common/components/ui-elements/cloze.component.ts @@ -145,6 +145,18 @@ import { ClozeUtils } from '../../util/cloze'; {{subPart.text}} </span> </ng-container> + + <ng-container *ngIf="$any(subPart).type === 'text' && (subPart.marks | markList).includes('superscript')"> + <sup [ngStyle]="subPart.marks | styleMarks"> + {{subPart.text}} + </sup> + </ng-container> + <ng-container *ngIf="$any(subPart).type === 'text' && (subPart.marks | markList).includes('subscript')"> + <sub [ngStyle]="subPart.marks | styleMarks"> + {{subPart.text}} + </sub> + </ng-container> + <ng-container *ngIf="$any(subPart).type === 'image'"> <img [src]="subPart.attrs.src" [alt]="subPart.attrs.alt" [style.display]="'inline-block'" diff --git a/projects/common/pipes/mark-list.pipe.ts b/projects/common/pipes/mark-list.pipe.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ade8e8e985cb58addace1bdce0318ff61b29b05 --- /dev/null +++ b/projects/common/pipes/mark-list.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'markList' +}) +export class MarkListPipe implements PipeTransform { + transform(markList: Record<string, any>): any[] { + console.log('markList', markList); + + return markList ? markList.map((element: any) => element.type) : []; + } +} diff --git a/projects/common/shared.module.ts b/projects/common/shared.module.ts index 4a8d02fdfdfdabc029b8d198a30d2e916e4ff711..0f73c7a50e48cd5ffb516961f53cd0440731fd2e 100644 --- a/projects/common/shared.module.ts +++ b/projects/common/shared.module.ts @@ -52,6 +52,7 @@ import { MarkingBarComponent } from './components/marking-bar/marking-bar.compon import { StyleMarksPipe } from './pipes/styleMarks.pipe'; import { MarkingButtonComponent } from './components/marking-bar/marking-button.component'; import { CompoundChildOverlayComponent } from './components/compound-child-overlay.component'; +import { MarkListPipe } from './pipes/mark-list.pipe'; @NgModule({ imports: [ @@ -104,7 +105,8 @@ import { CompoundChildOverlayComponent } from './components/compound-child-overl MarkingBarComponent, StyleMarksPipe, MarkingButtonComponent, - CompoundChildOverlayComponent + CompoundChildOverlayComponent, + MarkListPipe ], exports: [ CommonModule,