Skip to content

Commit 7ea0b46

Browse files
committed
feat(octra): text editor in feedback modal is now WYSIWYG
1 parent 5fc3cb7 commit 7ea0b46

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

apps/octra/src/app/core/modals/bugreport-modal/bugreport-modal.component.html

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ <h5 class="modal-title" id="modal-title">
4646
[(ngModel)]="profile.username"
4747
/>
4848
<label for="inputName" class="form-label">{{
49-
'g.name' | transloco
50-
}}</label>
49+
'g.name' | transloco
50+
}}</label>
5151
</div>
5252
</div>
5353
<div class="col-6">
@@ -62,26 +62,25 @@ <h5 class="modal-title" id="modal-title">
6262
placeholder="[email protected]"
6363
/>
6464
<label for="inputEmail" class="form-label">{{
65-
'g.email' | transloco
66-
}}</label>
65+
'g.email' | transloco
66+
}}</label>
6767
</div>
6868
</div>
6969
</div>
7070
<div class="row">
7171
<div class="col-12">
72-
<div class="form-floating mb-3">
73-
<textarea
72+
<div class="d-block mb-3">
73+
<label for="bgDescr">{{ 'g.description' | transloco }}:</label>
74+
<ngx-jodit
7475
[(ngModel)]="bgdescr"
75-
class="form-control"
76+
[options]="joditOptions"
77+
class="w-100"
78+
style="display: flex !important; flex-direction: column; flex: auto; height: 100% !important;"
7679
aria-describedby="bgDescr"
77-
[placeholder]="'g.description' | transloco"
7880
id="bgDescr"
7981
maxlength="1000"
80-
rows="3"
8182
name="bgdescr"
82-
style="height: 100px"
83-
></textarea>
84-
<label for="bgDescr">{{ 'g.description' | transloco }}</label>
83+
></ngx-jodit>
8584
<div id="emailHelp" class="form-text">German or English</div>
8685
</div>
8786
</div>
@@ -99,7 +98,7 @@ <h5 class="modal-title" id="modal-title">
9998
class="upload-screenshot"
10099
>
101100
<span (click)="removeScreenshot(i)" class="cross rounded-circle"
102-
>X</span
101+
>X</span
103102
>
104103
<input
105104
#uploadInput2

apps/octra/src/app/core/modals/bugreport-modal/bugreport-modal.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BugReportService } from '../../shared/service/bug-report.service';
55
import { OctraModal } from '../types';
66
import { NgbActiveModal, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
77
import { AuthenticationStoreService } from '../../store/authentication';
8+
import { JoditConfig } from 'ngx-jodit';
89

910
@Component({
1011
selector: 'octra-bugreport-modal',
@@ -18,6 +19,11 @@ export class BugreportModalComponent extends OctraModal implements OnInit {
1819
backdrop: true,
1920
};
2021

22+
joditOptions: JoditConfig = {
23+
maxHeight: 300,
24+
statusbar: false,
25+
placeholder: 'Please write a message in German or English...',
26+
};
2127
public visible = false;
2228
public bgdescr = '';
2329
public sendProObj = true;
@@ -66,6 +72,15 @@ export class BugreportModalComponent extends OctraModal implements OnInit {
6672
}
6773

6874
sendBugReport() {
75+
if (this.bgdescr.length > 10000) {
76+
alert(
77+
`Please write a message with less 10000 letters. Remove ${
78+
this.bgdescr.length - 10000
79+
} letters.`
80+
);
81+
return;
82+
}
83+
6984
this.sendStatus = 'sending';
7085
this.subscrManager.add(
7186
this.bugService

apps/octra/src/app/core/modals/modals.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { ReAuthenticationModalComponent } from './re-authentication-modal/re-aut
4646
import { AuthenticationComponent } from '../component/authentication-component/authentication-component.component';
4747
import { AboutModalComponent } from './about-modal/about-modal.component';
4848
import { FeedbackNoticeModalComponent } from './feedback-notice-modal/feedback-notice-modal.component';
49+
import { NgxJoditComponent } from 'ngx-jodit';
4950

5051
@Injectable({ providedIn: 'root' })
5152
export class TranslocoHttpLoader implements TranslocoLoader {
@@ -100,6 +101,7 @@ export class TranslocoHttpLoader implements TranslocoLoader {
100101
NgbModalModule,
101102
OctraUtilitiesModule,
102103
NgbAccordionCollapse,
104+
NgxJoditComponent,
103105
],
104106
exports: [
105107
BugreportModalComponent,

0 commit comments

Comments
 (0)