From ac5e84959ee9a5e7b8c84c820d36a7590b3f6f73 Mon Sep 17 00:00:00 2001 From: kkigomi Date: Thu, 16 May 2024 22:32:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=EC=B5=9C=EC=A0=81=ED=99=94=20?= =?UTF-8?q?=EC=98=B5=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이미지 업로드 패널에서 "이미지 최적화" 체크박스를 추가하여 이미지 파일 업로드 시 설정 값을 함께 전송하도록 함. --- src/plugins/dialog/image.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/dialog/image.js b/src/plugins/dialog/image.js index cc45383b..96f9ba21 100644 --- a/src/plugins/dialog/image.js +++ b/src/plugins/dialog/image.js @@ -29,6 +29,7 @@ export default { sizeUnit: options._imageSizeUnit, _linkElement: '', _altText: '', + _optimize: true, _align: 'none', _floatClassRegExp: '__se__float\\-[a-z]+', _v_src: {_linkValue: ''}, @@ -71,6 +72,7 @@ export default { contextImage.imgUrlFile = image_dialog.querySelector('._se_image_url'); contextImage.focusElement = contextImage.imgInputFile || contextImage.imgUrlFile; contextImage.altText = image_dialog.querySelector('._se_image_alt'); + contextImage.optimize = image_dialog.querySelector('._se_image_check_optimize'); contextImage.captionCheckEl = image_dialog.querySelector('._se_image_check_caption'); contextImage.previewSrc = image_dialog.querySelector('._se_tab_content_image .se-link-preview'); @@ -197,6 +199,7 @@ export default { html += '' + '' + '' + '' + @@ -366,6 +369,7 @@ export default { e.stopPropagation(); contextImage._altText = contextImage.altText.value; + contextImage._optimize = contextImage.optimize.checked; contextImage._align = contextImage.modal.querySelector('input[name="suneditor_image_radio"]:checked').value; contextImage._captionChecked = contextImage.captionCheckEl.checked; if (contextImage._resizing) contextImage._proportionChecked = contextImage.proportion.checked; @@ -480,9 +484,13 @@ export default { // server upload if (typeof imageUploadUrl === 'string' && imageUploadUrl.length > 0) { const formData = new FormData(); + const contextImage = this.context.image; for (let i = 0; i < filesLen; i++) { formData.append('file-' + i, files[i]); } + + formData.append('optimize', contextImage._optimize); + this.plugins.fileManager.upload.call(this, imageUploadUrl, this.options.imageUploadHeader, formData, this.plugins.image.callBack_imgUpload.bind(this, info), this.functions.onImageUploadError); } else { // base64 this.plugins.image.setup_reader.call(this, files, info.anchor, info.inputWidth, info.inputHeight, info.align, info.alt, filesLen, info.isUpdate); @@ -1119,6 +1127,7 @@ export default { } contextImage.altText.value = ''; + contextImage.optimize.checked = true; contextImage.modal.querySelector('input[name="suneditor_image_radio"][value="none"]').checked = true; contextImage.captionCheckEl.checked = false; contextImage._element = null;