feat(editor): add self-hosted TinyMCE editor and remove API key

This commit is contained in:
chamikaJ
2024-06-17 11:37:12 +05:30
parent 5cce1f2d2c
commit eb39dc363f
9 changed files with 73 additions and 66 deletions

View File

@@ -11,7 +11,6 @@
class="description-editor"
[class.editing]="isEditing"
[init]="CONFIG"
[apiKey]="apiKey"
[(ngModel)]="service.model.task.description"
(onBlur)="onDescriptionInputBlur()"
#descriptionEditor

View File

@@ -25,8 +25,9 @@ export class TaskViewDescriptionComponent implements OnInit, OnDestroy {
@ViewChild("descriptionInput", {static: false}) descriptionInput!: ElementRef;
@ViewChild("descriptionEditor", {static: false}) descriptionEditor!: EditorComponent;
readonly apiKey = "4nquevykvy1i0q0v62ksxuu3nz1muy8i5fsqpj3wp9qm2mgp";
readonly CONFIG = {
base_url: '/tinymce',
suffix: '.min',
plugins: "lists link code wordcount",
toolbar: 'blocks bold italic underline strikethrough | checklist numlist bullist link | alignleft aligncenter alignright alignjustify',
menubar: false,

View File

@@ -51,7 +51,7 @@ import {NzPopconfirmModule} from 'ng-zorro-antd/popconfirm';
import {NzCardModule} from "ng-zorro-antd/card";
import {NzTableModule} from "ng-zorro-antd/table";
import {NzProgressModule} from "ng-zorro-antd/progress";
import {EditorModule} from '@tinymce/tinymce-angular';
import {EditorModule, TINYMCE_SCRIPT_SRC} from '@tinymce/tinymce-angular';
import {TaskViewTimeLogComponent} from './task-view-time-log/task-view-time-log.component';
import {NzListModule} from "ng-zorro-antd/list";
import {NzEmptyModule} from "ng-zorro-antd/empty";
@@ -99,60 +99,61 @@ import {TaskCommentMentionPipe} from "@pipes/task-comment-mention.pipe";
TaskViewComponent
],
providers: [
SearchByNamePipe
SearchByNamePipe,
{ provide: TINYMCE_SCRIPT_SRC, useValue: 'tinymce/tinymce.min.js' }
],
imports: [
CommonModule,
NzDrawerModule,
NzSkeletonModule,
NzFormModule,
FormsModule,
NzInputModule,
NzSelectModule,
NzTabsModule,
NzTagModule,
NzCollapseModule,
NzDropDownModule,
AvatarsComponent,
NzAvatarModule,
NzTypographyModule,
NzCheckboxModule,
SearchByNamePipe,
NzToolTipModule,
NzDatePickerModule,
NzInputNumberModule,
NzIconModule,
NzBadgeModule,
NzDividerModule,
FromNowPipe,
ReactiveFormsModule,
TaskPriorityLabelComponent,
NzButtonModule,
NzCommentModule,
RouterLink,
NzSpaceModule,
NzMentionModule,
NzAffixModule,
NzNoAnimationModule,
NzPopconfirmModule,
NzCardModule,
NzTableModule,
NzProgressModule,
EditorModule,
NzListModule,
NzEmptyModule,
TaskTimerComponent,
FirstCharUpperPipe,
TaskListAddTaskInputComponent,
SafeStringPipe,
DateFormatterPipe,
NgxDocViewerModule,
NzModalModule,
NzSpinModule,
NzTimelineModule,
NzTimePickerModule,
TaskCommentMentionPipe
]
imports: [
CommonModule,
NzDrawerModule,
NzSkeletonModule,
NzFormModule,
FormsModule,
NzInputModule,
NzSelectModule,
NzTabsModule,
NzTagModule,
NzCollapseModule,
NzDropDownModule,
AvatarsComponent,
NzAvatarModule,
NzTypographyModule,
NzCheckboxModule,
SearchByNamePipe,
NzToolTipModule,
NzDatePickerModule,
NzInputNumberModule,
NzIconModule,
NzBadgeModule,
NzDividerModule,
FromNowPipe,
ReactiveFormsModule,
TaskPriorityLabelComponent,
NzButtonModule,
NzCommentModule,
RouterLink,
NzSpaceModule,
NzMentionModule,
NzAffixModule,
NzNoAnimationModule,
NzPopconfirmModule,
NzCardModule,
NzTableModule,
NzProgressModule,
EditorModule,
NzListModule,
NzEmptyModule,
TaskTimerComponent,
FirstCharUpperPipe,
TaskListAddTaskInputComponent,
SafeStringPipe,
DateFormatterPipe,
NgxDocViewerModule,
NzModalModule,
NzSpinModule,
NzTimelineModule,
NzTimePickerModule,
TaskCommentMentionPipe
]
})
export class TaskViewModule {
}

View File

@@ -4,7 +4,6 @@ import {ProjectTemplateService} from "@services/project-template.service";
import {PtTaskPhasesApiService} from "@api/pt-task-phases-api.service";
import {ITaskPhase} from "@interfaces/api-models/task-phase";
import {PhaseColorCodes} from "@shared/constants";
import {load} from "@angular-devkit/build-angular/src/utils/server-rendering/esm-in-memory-file-loader";
@Component({
selector: 'worklenz-phase-settings-drawer',

View File

@@ -21,7 +21,6 @@
class="description-editor-list"
[class.editing]="isEditing"
[init]="CONFIG"
[apiKey]="apiKey"
[(ngModel)]="task.description"
(onBlur)="submit()"
#descriptionEditor

View File

@@ -28,8 +28,9 @@ export class TaskDescriptionComponent implements OnInit, OnDestroy {
show = false;
loading = false;
readonly apiKey = "4nquevykvy1i0q0v62ksxuu3nz1muy8i5fsqpj3wp9qm2mgp";
readonly CONFIG = {
base_url: '/tinymce',
suffix: '.min',
plugins: "lists link code wordcount",
toolbar: 'blocks bold italic underline strikethrough | checklist numlist bullist link | alignleft aligncenter alignright alignjustify',
menubar: false,