Skip to content
Snippets Groups Projects
Commit 88c138e7 authored by rhenck's avatar rhenck
Browse files

[editor] Do not use the page width for the TextEditor dialog

This may destroy alignment of inputs and produce unwanted scrollbars.
parent fc9c5086
No related branches found
No related tags found
No related merge requests found
......@@ -49,24 +49,22 @@ export class DialogService {
return dialogRef.afterClosed();
}
showRichTextEditDialog(text: string, defaultFontSize: number, width: number): Observable<string> {
showRichTextEditDialog(text: string, defaultFontSize: number): Observable<string> {
const dialogRef = this.dialog.open(RichTextEditDialogComponent, {
data: {
content: text,
defaultFontSize,
clozeMode: false
},
autoFocus: false,
width: `${width}px`
autoFocus: false
});
return dialogRef.afterClosed();
}
showClozeTextEditDialog(document: ClozeDocument, defaultFontSize: number, width: number): Observable<string> {
showClozeTextEditDialog(document: ClozeDocument, defaultFontSize: number): Observable<string> {
const dialogRef = this.dialog.open(RichTextEditDialogComponent, {
data: { content: document, defaultFontSize, clozeMode: true },
autoFocus: false,
width: `${Math.max(870, width)}px`
autoFocus: false
});
return dialogRef.afterClosed();
}
......
......@@ -415,9 +415,7 @@ export class UnitService {
case 'text':
this.dialogService.showRichTextEditDialog(
(element as TextElement).text,
(element as TextElement).fontProps.fontSize as number,
this.unit.pages[this.selectionService.selectedPageIndex].maxWidth -
this.unit.pages[this.selectionService.selectedPageIndex].margin
(element as TextElement).fontProps.fontSize as number
).subscribe((result: string) => {
if (result) {
// TODO add proper sanitization
......@@ -432,9 +430,7 @@ export class UnitService {
case 'cloze':
this.dialogService.showClozeTextEditDialog(
element.document,
(element as ClozeElement).fontProps.fontSize as number,
this.unit.pages[this.selectionService.selectedPageIndex].maxWidth -
this.unit.pages[this.selectionService.selectedPageIndex].margin
(element as ClozeElement).fontProps.fontSize as number
).subscribe((result: string) => {
if (result) {
// TODO add proper sanitization
......
div.ProseMirror {
min-height: 250px;
min-height: 300px;
border: 1px solid;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment