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();
@@ -194,15 +198,20 @@ class ElTextEditorComponent {
194
198
  // }
195
199
  roleCheck() {
196
200
  var _a;
201
+ console.log('his.userRole => el => ', this.userRole);
197
202
  let userRoleName = [];
198
- for (let i = 0; i < this.userRole.length; ++i) {
203
+ for (let i = 0; i <= this.userRole.length; ++i) {
199
204
  userRoleName.push((_a = this.userRole[i]) === null || _a === void 0 ? void 0 : _a.name);
200
205
  }
201
206
  return userRoleName;
202
207
  }
203
208
  addClickListenerToImages() {
204
209
  const editor = document.getElementById('editor');
205
- if (this.roleCheck().includes('Creator') || this.roleCheck().includes('Admin')) {
210
+ const roles = this.roleCheck(); // Get user roles dynamically
211
+ const isAdmin = roles.includes('Admin');
212
+ const isCreator = roles.includes('Creator');
213
+ const isApprover = roles.includes('Approver');
214
+ if (isCreator || isAdmin) {
206
215
  if (editor) {
207
216
  editor.addEventListener('click', (event) => {
208
217
  var _a;