diff --git a/projects/editor/src/app/components/dialogs/rich-text-edit-dialog.component.ts b/projects/editor/src/app/components/dialogs/rich-text-edit-dialog.component.ts index 65f19fb8ffa7b7997fa6c2dfabed2e50ba686ce1..b94e7c9ef5c8d5cac36a76fda4d1acdbc698973e 100644 --- a/projects/editor/src/app/components/dialogs/rich-text-edit-dialog.component.ts +++ b/projects/editor/src/app/components/dialogs/rich-text-edit-dialog.component.ts @@ -6,7 +6,7 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog'; template: ` <mat-dialog-content> <app-rich-text-editor [(text)]="data.text" - [showCloseElements]="data.showCloseElements" + [clozeMode]="data.clozeMode" [defaultFontSize]="data.defaultFontSize"> </app-rich-text-editor> </mat-dialog-content> @@ -14,11 +14,11 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog'; <button mat-button [mat-dialog-close]="data.text">{{'save' | translate }}</button> <button mat-button mat-dialog-close>{{'cancel' | translate }}</button> </mat-dialog-actions> - ` + ` }) export class RichTextEditDialogComponent { constructor(@Inject(MAT_DIALOG_DATA) public data: { text: string, defaultFontSize: number, - showCloseElements?: boolean }) { } + clozeMode: boolean }) { } } diff --git a/projects/editor/src/app/services/dialog.service.ts b/projects/editor/src/app/services/dialog.service.ts index eb0e2cdfd9da8a9f580cb1fcdaba98760c6e3e52..c38e887a06bb6e48f856d185e3809a73719f3e4d 100644 --- a/projects/editor/src/app/services/dialog.service.ts +++ b/projects/editor/src/app/services/dialog.service.ts @@ -58,7 +58,7 @@ export class DialogService { showClozeTextEditDialog(text: string): Observable<string> { const dialogRef = this.dialog.open(RichTextEditDialogComponent, { - data: { text, showCloseElements: true }, + data: { text, clozeMode: true }, autoFocus: false }); return dialogRef.afterClosed(); diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.html b/projects/editor/src/app/text-editor/rich-text-editor.component.html index 869c43e66d3130a0352aa958304018d36cb7a851..e6c0c563ccfd70cdee7b66d9d31b9a7ed6c0281e 100644 --- a/projects/editor/src/app/text-editor/rich-text-editor.component.html +++ b/projects/editor/src/app/text-editor/rich-text-editor.component.html @@ -244,7 +244,7 @@ <mat-icon>format_quote</mat-icon> </button> </div> - <div *ngIf="showCloseElements" fxLayout="row" fxLayoutAlign="space-around center" > + <div *ngIf="clozeMode" fxLayout="row" fxLayoutAlign="space-around center" > <button mat-icon-button matTooltip="Eingabefeld" [matTooltipShowDelay]="300" (click)="insertTextField()"> <mat-icon>text_fields</mat-icon> @@ -260,6 +260,7 @@ </div> </div> <tiptap-editor [editor]="editor" [ngModel]="text" + [outputFormat]="clozeMode ? 'json' : 'html'" [style.font-size.px]="defaultFontSize" (ngModelChange)="textChange.emit($event)"> </tiptap-editor> diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.ts b/projects/editor/src/app/text-editor/rich-text-editor.component.ts index 4c97b21e3f0da9712cd76b3ddd6055718cc8923d..77feb20cdf11a7996197f00ba66906b2cfcb2951 100644 --- a/projects/editor/src/app/text-editor/rich-text-editor.component.ts +++ b/projects/editor/src/app/text-editor/rich-text-editor.component.ts @@ -35,7 +35,7 @@ import TextFieldComponentExtension from './node-views/text-field-component-exten export class RichTextEditorComponent implements AfterViewInit { @Input() text!: string; @Input() defaultFontSize!: number; - @Input() showCloseElements: boolean | undefined = false; + @Input() clozeMode: boolean = false; @Output() textChange = new EventEmitter<string>(); selectedFontColor = 'lightgrey';