el-text-editor 0.0.76 → 0.0.78

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.
@@ -362,6 +362,13 @@ class ElTextEditorComponent {
362
362
  if (target.tagName === 'IMG') {
363
363
  this.selectedImage = target;
364
364
  this.imageEditUrl = this.selectedImage.src;
365
+ const images = editor.getElementsByTagName('img');
366
+ for (let i = 0; i < images.length; i++) {
367
+ if (images[i] === this.selectedImage) {
368
+ this.selectedItemIndex = i;
369
+ break;
370
+ }
371
+ }
365
372
  let container = this.selectedImage.parentElement;
366
373
  if (!container || container.className !== 'image-container') {
367
374
  container = document.createElement('div');
@@ -903,7 +910,7 @@ class ElTextEditorComponent {
903
910
  const imgWidth = img.width;
904
911
  // If the image width exceeds the editor's width, fit it to the editor
905
912
  const imgHTML = imgWidth > editorWidth
906
- ? `<img src="${img.src}" style="width: 100%; max-width: ${700}px; height: auto;">`
913
+ ? `<img src="${img.src}" style=" max-width: ${700}px; height: auto;">`
907
914
  : `<img src="${img.src}" style="width: ${imgWidth}px; height: auto;">`;
908
915
  this.newImageAdded.emit();
909
916
  // Insert the image into the editor