el-text-editor 0.0.65 → 0.0.66

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.
@@ -81,6 +81,7 @@ class ElTextEditorComponent {
81
81
  this.parsedTable = null;
82
82
  this.isFullScreen = false;
83
83
  this.userRole = [];
84
+ this.showEditButton = false;
84
85
  this.IsOpen = false;
85
86
  this.onFullscreenChange = () => {
86
87
  if (!document.fullscreenElement) {
@@ -457,6 +458,9 @@ class ElTextEditorComponent {
457
458
  if (value) {
458
459
  const VALUE = value;
459
460
  this.editorText = VALUE;
461
+ const editorContent = VALUE;
462
+ // Check if there's an image in the editor content
463
+ this.showEditButton = editorContent.includes('<img');
460
464
  this.onChange(VALUE);
461
465
  this.editorTextChange.emit(VALUE);
462
466
  }
@@ -1160,24 +1164,73 @@ class ElTextEditorComponent {
1160
1164
  document.execCommand('foreColor', false, event);
1161
1165
  // this.logs.unshift([this.logs.length + 1, trigger, event]);
1162
1166
  }
1167
+ // editImage() {
1168
+ // let data
1169
+ // console.log('this.editorFrom =',this.editorFrom)
1170
+ // switch (this.editorFrom.name) {
1171
+ // case 'section-content':
1172
+ // data = { editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex, id: this.editorFrom.id };
1173
+ // const compressedData: string = compress(JSON.stringify(this.imageEditUrl));
1174
+ // sessionStorage.setItem('editImageFromTemp', compressedData);
1175
+ // const compressedData2 = compress(JSON.stringify(this.sanitizedContent));
1176
+ // sessionStorage.setItem('textEditor', compressedData2);
1177
+ // // alert('go to editor!')
1178
+ // this.navigateToIMGEditor(data);
1179
+ // this.imageEdit.emit()
1180
+ // break;
1181
+ // case 'create-document':
1182
+ // this.imageEdit.emit()
1183
+ // data = { editIMG: true, from: 'createDocument', index: this.selectedItemIndex, id: this.editorFrom.id, section: this.editorFrom.section, reportSectionId: this.editorFrom.reportSectionId };
1184
+ // // this.openDialog(data)
1185
+ // const compressedData3 = compress(JSON.stringify(this.imageEditUrl));
1186
+ // const compressedData4 = compress(this.editorText);
1187
+ // sessionStorage.setItem('editImageFromTemp2', compressedData3);
1188
+ // sessionStorage.setItem('textEditor2', compressedData4);
1189
+ // this.navigateToIMGEditor(data);
1190
+ // break;
1191
+ // default:
1192
+ // null
1193
+ // // sessionStorage.removeItem('editImageFromTemp');
1194
+ // // sessionStorage.removeItem('editImageFromTemp2');
1195
+ // // sessionStorage.removeItem('templateEditor');
1196
+ // // sessionStorage.removeItem('textEditor');
1197
+ // break;
1198
+ // }
1199
+ // // if (this.editorFrom === 'section-content') {
1200
+ // // const data = {editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex}
1201
+ // // this.navigateToIMGEditor(data)
1202
+ // // sessionStorage.setItem('editImageFromTemp', JSON.stringify(this.imageEditUrl))
1203
+ // // sessionStorage.setItem('textEditor', this.editorText)
1204
+ // // }
1205
+ // }
1163
1206
  editImage() {
1164
1207
  let data;
1165
1208
  console.log('this.editorFrom =', this.editorFrom);
1166
1209
  switch (this.editorFrom.name) {
1167
1210
  case 'section-content':
1168
- data = { editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex, id: this.editorFrom.id };
1211
+ data = {
1212
+ editIMG: true,
1213
+ from: 'htmlEditor',
1214
+ index: this.selectedItemIndex,
1215
+ id: this.editorFrom.id,
1216
+ };
1169
1217
  const compressedData = compress(JSON.stringify(this.imageEditUrl));
1170
1218
  sessionStorage.setItem('editImageFromTemp', compressedData);
1171
1219
  const compressedData2 = compress(JSON.stringify(this.sanitizedContent));
1172
1220
  sessionStorage.setItem('textEditor', compressedData2);
1173
- // alert('go to editor!')
1174
1221
  this.navigateToIMGEditor(data);
1175
1222
  this.imageEdit.emit();
1176
1223
  break;
1177
1224
  case 'create-document':
1178
1225
  this.imageEdit.emit();
1179
- data = { editIMG: true, from: 'createDocument', index: this.selectedItemIndex, id: this.editorFrom.id, section: this.editorFrom.section, reportSectionId: this.editorFrom.reportSectionId };
1180
- // this.openDialog(data)
1226
+ data = {
1227
+ editIMG: true,
1228
+ from: 'createDocument',
1229
+ index: this.selectedItemIndex,
1230
+ id: this.editorFrom.id,
1231
+ section: this.editorFrom.section,
1232
+ reportSectionId: this.editorFrom.reportSectionId,
1233
+ };
1181
1234
  const compressedData3 = compress(JSON.stringify(this.imageEditUrl));
1182
1235
  const compressedData4 = compress(this.editorText);
1183
1236
  sessionStorage.setItem('editImageFromTemp2', compressedData3);
@@ -1186,18 +1239,8 @@ class ElTextEditorComponent {
1186
1239
  break;
1187
1240
  default:
1188
1241
  null;
1189
- // sessionStorage.removeItem('editImageFromTemp');
1190
- // sessionStorage.removeItem('editImageFromTemp2');
1191
- // sessionStorage.removeItem('templateEditor');
1192
- // sessionStorage.removeItem('textEditor');
1193
1242
  break;
1194
1243
  }
1195
- // if (this.editorFrom === 'section-content') {
1196
- // const data = {editIMG: true, from: 'htmlEditor', index: this.selectedItemIndex}
1197
- // this.navigateToIMGEditor(data)
1198
- // sessionStorage.setItem('editImageFromTemp', JSON.stringify(this.imageEditUrl))
1199
- // sessionStorage.setItem('textEditor', this.editorText)
1200
- // }
1201
1244
  }
1202
1245
  openDialog(item) {
1203
1246
  // let data: any;