el-text-editor 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,6 +76,7 @@ class ElTextEditorComponent {
76
76
  this.selectedItemIndex = null;
77
77
  this.parsedTable = null;
78
78
  this.isFullScreen = false;
79
+ this.userRole = [];
79
80
  this.getUserRoles();
80
81
  }
81
82
  themeMode() {
@@ -103,6 +104,9 @@ class ElTextEditorComponent {
103
104
  if (changes['reportId']) {
104
105
  sessionStorage.setItem('reportId', this.reportId);
105
106
  }
107
+ if (changes['UserRole']) {
108
+ this.getUserRoles();
109
+ }
106
110
  }
107
111
  ngAfterViewInit() {
108
112
  this.initEditor();
@@ -193,15 +197,20 @@ class ElTextEditorComponent {
193
197
  // }
194
198
  // }
195
199
  roleCheck() {
200
+ console.log('his.userRole => el => ', this.userRole);
196
201
  let userRoleName = [];
197
- for (let i = 0; i < this.userRole.length; ++i) {
202
+ for (let i = 0; i <= this.userRole.length; ++i) {
198
203
  userRoleName.push(this.userRole[i]?.name);
199
204
  }
200
205
  return userRoleName;
201
206
  }
202
207
  addClickListenerToImages() {
203
208
  const editor = document.getElementById('editor');
204
- if (this.roleCheck().includes('Creator') || this.roleCheck().includes('Admin')) {
209
+ const roles = this.roleCheck(); // Get user roles dynamically
210
+ const isAdmin = roles.includes('Admin');
211
+ const isCreator = roles.includes('Creator');
212
+ const isApprover = roles.includes('Approver');
213
+ if (isCreator || isAdmin) {
205
214
  if (editor) {
206
215
  editor.addEventListener('click', (event) => {
207
216
  const target = event.target;