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