ngx-editor
المعتمد هو:
npm install ngx-editor@15.3.0 --save --force
المصدر:
https://www.npmjs.com/package/ngx-editor
مثال:
https://stackblitz.com/edit/ngx-editor-floating-menu-custom?file=src%2Fapp%2Fapp.component.ts
https://stackblitz.com/edit/ngx-editor-floating-menu-custom?file=src%2Fapp%2Fapp.component.html
كودي (HTML):
<div class="col-12" style="min-height: 150px;">
<label for="editor" class="mb-2">{{'LABELS.REPLY' | translate}}</label>
<div class="NgxEditor__Wrapper lh-lg d-block" [matTooltip]="'gdfgdg'">
<ngx-editor-menu [editor]="editor"> </ngx-editor-menu>
<ngx-editor id="editor" [editor]="editor" [ngModel]="data.body" [disabled]="true"
[placeholder]="'Type here...'"></ngx-editor>
</div>
</div>
<div class="col-12">
<label for="editor2" class="mb-2">{{'LABELS.REPLY' | translate}}</label>
<div class="NgxEditor__Wrapper lh-lg" [matTooltip]="'gdfgdg'">
<ngx-editor-menu [editor]="editor2" [toolbar]="toolbar"> </ngx-editor-menu>
<ngx-editor id="editor2" [editor]="editor2" [ngModel]="data.solution" [disabled]="false"
[placeholder]="'Type here...'"></ngx-editor>
</div>
</div>
كودي (TS):
toolbar: Toolbar = [
['bold', 'italic', 'underline', 'strike'],
// ['code', 'blockquote'],
['ordered_list', 'bullet_list'],
[{ heading: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] }],
['link', 'image'],
['text_color', 'background_color'],
['align_left', 'align_center', 'align_right', 'align_justify'],
];
editor: Editor;
editor2: Editor;
ngOnInit(): void {
this.editor = new Editor();
this.editor2 = new Editor();
}
تعليقات
إرسال تعليق