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