Skip to content

Commit

Permalink
fix: v2.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Dec 2, 2019
1 parent 205e5c8 commit b4714a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/suneditor.min.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/plugins/dialog/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,13 @@ export default {
}.bind(this));
}.bind(this);

const container = this.util.getParentElement(img, this.util.isComponent);
img.setAttribute('origin-size', img.naturalWidth + ',' + img.naturalHeight);
img.setAttribute('data-origin', /%$/.test(img.style.width) ? (/%$/.test(container.style.width) ? container.style.width.match(/\d+/)[0] : '') : (img.offsetWidth + ',' + img.offsetHeight));
if (!img.getAttribute('origin-size')) {
img.setAttribute('origin-size', img.naturalWidth + ',' + img.naturalHeight);
}
if (!img.getAttribute('data-origin')) {
const container = this.util.getParentElement(img, this.util.isComponent);
img.setAttribute('data-origin', /%$/.test(img.style.width) ? (/%$/.test(container.style.width) ? container.style.width.match(/\d+/)[0] : '') : (img.offsetWidth + ',' + img.offsetHeight));
}

this._imageUpload(img, dataIndex, state, info, --this.context.image._uploadFileLength < 0 ? 0 : this.context.image._uploadFileLength);
},
Expand Down

0 comments on commit b4714a6

Please sign in to comment.