diff --git a/plugin/editor/cheditor5/cheditor.js b/plugin/editor/cheditor5/cheditor.js
index 9e39e3408..58790b338 100644
--- a/plugin/editor/cheditor5/cheditor.js
+++ b/plugin/editor/cheditor5/cheditor.js
@@ -1,9 +1,9 @@
// ================================================================
-// CHEditor 5.1.9.3-p4
+// CHEditor 5.1.9.4
// ----------------------------------------------------------------
// Homepage: http://www.chcode.com
// EMail: support@chcode.com
-// Copyright (c) 1997-2020 CHSOFT
+// Copyright (c) 1997-2021 CHSOFT
// ================================================================
var GB = {
colors: ['#000000','#313131','#434343','#535353','#666666','#999999','#a0a0a0','#b5b5b5','#c0c0c0','#dcdcdc','#eeeeee','#ffffff',
@@ -568,6 +568,7 @@ function setConfig() {
this.cheditor.tabSpaces = '';
this.cheditor.modifyState = false;
this.cheditor.tabSpaces = new Array(this.config.tabIndent + 1).join(' ');
+ // this.URI = URI;
}
function cheditor() {
diff --git a/plugin/editor/cheditor5/icons/imageUpload/broken.png b/plugin/editor/cheditor5/icons/imageUpload/broken.png
new file mode 100644
index 000000000..3db85a171
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/broken.png differ
diff --git a/plugin/editor/cheditor5/imageUpload/config.php b/plugin/editor/cheditor5/imageUpload/config.php
index 0f81cdcb8..418c1bf5f 100644
--- a/plugin/editor/cheditor5/imageUpload/config.php
+++ b/plugin/editor/cheditor5/imageUpload/config.php
@@ -1,15 +1,15 @@
-
+
+
CHEditor
-
+
@@ -11,12 +11,12 @@
- <동영상 소스 코드> iframe 또는 object 태그를 입력하세요.
+ 동영상 링크 URL 또는 IFRAME이나 EMBED 소스 코드를 붙여 넣거나 입력하세요.
-
+
-
\ No newline at end of file
+
diff --git a/plugin/editor/cheditor5/popup/google_map.html b/plugin/editor/cheditor5/popup/google_map.html
index 5f7ed0955..def38e1cb 100644
--- a/plugin/editor/cheditor5/popup/google_map.html
+++ b/plugin/editor/cheditor5/popup/google_map.html
@@ -6,13 +6,13 @@
-
+
diff --git a/plugin/editor/cheditor5/popup/image.html5.m.html b/plugin/editor/cheditor5/popup/image.html5.m.html
index 0f9debb67..a2d7183c3 100644
--- a/plugin/editor/cheditor5/popup/image.html5.m.html
+++ b/plugin/editor/cheditor5/popup/image.html5.m.html
@@ -64,6 +64,7 @@
사진 여백 넣기
+
diff --git a/plugin/editor/cheditor5/popup/js/flash.js b/plugin/editor/cheditor5/popup/js/flash.js
index e18df665b..2b10818f9 100644
--- a/plugin/editor/cheditor5/popup/js/flash.js
+++ b/plugin/editor/cheditor5/popup/js/flash.js
@@ -1,5 +1,5 @@
// ================================================================
-// CHEditor 5
+// Movie
// ================================================================
var button = [
{ alt : '', img : 'play.gif', cmd : doPlay },
@@ -7,7 +7,10 @@ var button = [
{ alt : '', img : 'cancel.gif', cmd : popupClose }
],
oEditor = null,
- iframeSource = false;
+ iframeSource = null,
+ showMovie = false,
+ defaultMovieWidth = 640,
+ defaultMovieHeight = 360;
function init(dialog) {
var dlg = new Dialog(this);
@@ -17,52 +20,65 @@ function init(dialog) {
dlg.setDialogHeight();
}
-function doPlay()
-{
- var elem = oEditor.trimSpace(document.getElementById("fm_embed").value),
- embed = null, div = document.createElement('div'),
- pos, str, object, child, movieHeight, movieWidth, i, params = [];
+function getSource() {
+ return oEditor.trimSpace(document.getElementById("fm_source").value);
+}
- elem = oEditor.trimSpace(elem);
- if (elem == '') {
+function doPlay() {
+ var embed = null,
+ div = document.createElement('div'),
+ pos, str, object, child, movieHeight, movieWidth, params = [], showWrapper,
+ source = getSource(), iframe;
+
+ showMovie = true;
+ if (source === '') {
return;
}
- if (elem.toLowerCase().indexOf("iframe") !== -1) {
- document.getElementById('fm_player').innerHTML = elem;
- iframeSource = true;
+ showWrapper = document.getElementById('fm_player');
+ if (source.toLowerCase().indexOf("iframe") !== -1) {
+ showWrapper.innerHTML = source;
+ iframeSource = source;
return;
}
- pos = elem.toLowerCase().indexOf("embed");
+ if (/https?:\/\//.test(source)) {
+ iframe = createIframeElement(defaultMovieWidth, defaultMovieHeight, source);
+ if (iframe) {
+ showWrapper.innerHTML = '';
+ showWrapper.appendChild(iframe);
+ iframeSource = iframe;
+ }
+ return;
+ }
+
+ pos = source.toLowerCase().indexOf("embed");
if (pos !== -1) {
- str = elem.substr(pos);
+ str = source.substr(pos);
pos = str.indexOf(">");
div.innerHTML = "<" + str.substr(0, pos) + ">";
embed = div.firstChild;
} else {
- div.innerHTML = elem;
+ div.innerHTML = source;
object = div.getElementsByTagName('OBJECT')[0];
if (object && object.hasChildNodes()) {
child = object.firstChild;
- movieWidth = (isNaN(object.width) !== true) ? object.width : 320;
- movieHeight = (isNaN(object.height) !== true) ? object.height : 240;
+ movieWidth = (isNaN(object.width) !== true) ? object.width : defaultMovieWidth;
+ movieHeight = (isNaN(object.height) !== true) ? object.height : defaultMovieHeight;
do {
- if ((child.nodeName === 'PARAM') && (typeof child.name !== 'undefined') && (typeof child.value !== 'undefined')) {
- params.push({key: (child.name == 'movie') ? 'src' : child.name, val: child.value});
+ if (child.nodeName === 'PARAM' && typeof child.name !== 'undefined' && typeof child.value !== 'undefined')
+ {
+ params.push({
+ key: child.name === 'movie' ? 'src' : child.name,
+ val: child.value
+ });
}
child = child.nextSibling;
} while (child);
if (params.length > 0) {
- embed = document.createElement('embed');
- embed.setAttribute("width", movieWidth);
- embed.setAttribute("height", movieHeight);
- for (i = 0; i < params.length; i++) {
- embed.setAttribute(params[i].key, params[i].val);
- }
- embed.setAttribute("type", "application/x-shockwave-flash");
+ embed = createEmbedElement(movieWidth, movieHeight, params, null);
}
}
}
@@ -72,6 +88,89 @@ function doPlay()
}
}
+function createIframeElement(width, height, src) {
+ var iframe = document.createElement('iframe'), uri, query, id, movie = null;
+
+ uri = new oEditor.URI(src);
+ if (uri.path && uri.path.charAt(0) !== '/') {
+ uri.path = '/' + uri.path;
+ }
+
+ switch (uri.authority) {
+ case 'youtu.be' :
+ case 'youtube.com':
+ case 'www.youtube.com':
+ if (uri.path === '/watch' && uri.query) {
+ query = uri.query.split('=');
+ if (query[0] === 'v') {
+ movie = '/' + query[1];
+ }
+ }
+ if (!movie && uri.path) {
+ movie = uri.path;
+ if (uri.query) {
+ movie += '?' + uri.query;
+ }
+ }
+ if (movie) {
+ movie = 'https://www.youtube.com/embed' + movie;
+ }
+ break;
+ case 'vimeo.com' :
+ if (uri.path) {
+ movie = 'https://player.vimeo.com/video' + uri.path;
+ }
+ break;
+ case 'afree.ca' :
+ if (uri.path) {
+ movie = 'http://play.afreecatv.com' + uri.path + '/embed';
+ }
+ break;
+ case 'tv.naver.com' :
+ if (uri.path) {
+ id = uri.path.substring(uri.path.lastIndexOf('/'));
+ movie = 'https://tv.naver.com/embed' + id + '?autoPlay=true';
+ }
+ break;
+ case 'tv.kakao.com' :
+ if (uri.path) {
+ id = uri.path.substring(uri.path.lastIndexOf('/'));
+ movie = 'https://tv.kakao.com/embed/player/cliplink' + id;
+ }
+ break;
+ default :
+ movie = null;
+ }
+ if (!movie) {
+ return null;
+ }
+
+ iframe.setAttribute('width', width);
+ iframe.setAttribute('height', height);
+ iframe.setAttribute('frameborder', "0");
+ iframe.setAttribute('allowfullscreen', "true");
+ iframe.setAttribute('src', movie);
+ return iframe;
+}
+
+function createEmbedElement(width, height, params, src) {
+ var embed = document.createElement('embed'), i;
+
+ embed.setAttribute("type", "application/x-shockwave-flash");
+ embed.setAttribute('width', width);
+ embed.setAttribute('height', height);
+
+ if (src) {
+ embed.setAttribute('src', src);
+ }
+
+ for (i = 0; i < params.length; i++) {
+ embed.setAttribute(params[i].key, params[i].val);
+ }
+
+ return embed;
+}
+
function popupClose() {
document.getElementById('fm_player').innerHTML = '';
oEditor.popupWinCancel();
@@ -79,13 +178,17 @@ function popupClose() {
function doSubmit()
{
- var source = String(oEditor.trimSpace(document.getElementById("fm_embed").value));
+ var source = getSource();
if (source === '') {
popupClose();
}
+ if (!showMovie) {
+ document.getElementById('fm_player').style.visibility = 'hidden';
+ doPlay();
+ }
- if (iframeSource || source.indexOf("iframe") !== -1) {
- oEditor.insertHtmlPopup(source);
+ if (iframeSource) {
+ oEditor.insertHtmlPopup(iframeSource);
} else {
oEditor.insertFlash(source);
}
@@ -93,3 +196,4 @@ function doSubmit()
document.getElementById('fm_player').innerHTML = '';
oEditor.popupWinClose();
}
+
diff --git a/plugin/editor/cheditor5/popup/js/google_map.js b/plugin/editor/cheditor5/popup/js/google_map.js
index cf6109076..416b055b0 100644
--- a/plugin/editor/cheditor5/popup/js/google_map.js
+++ b/plugin/editor/cheditor5/popup/js/google_map.js
@@ -13,7 +13,9 @@ var oEditor = null,
mapWidth = 512,
mapHeight = 320,
panorama,
- panoramaVisible = false;
+ panoramaVisible = false,
+ marker,
+ staticMapsAPI = 'STATIC_MAPS_API_KEY';
function doSubmit() {
var mapImg = document.createElement("img"),
@@ -29,10 +31,9 @@ function doSubmit() {
mapImg.style.width = mapWidth + 'px';
mapImg.style.height = mapHeight + 'px';
mapImg.style.border = '1px #000 solid';
- mapImg.setAttribute("alt", "Google Map");
+ mapImg.setAttribute('alt', 'Google Map');
mapImg.onload = function () {
oEditor.insertHtmlPopup(mapImg);
- oEditor.setImageEvent(true);
oEditor.popupWinClose();
};
@@ -41,42 +42,46 @@ function doSubmit() {
panoramaHeading = panorama.getPov().heading;
panoramaZoom = panorama.getPov().zoom;
panoramaPosition = panorama.getPosition();
-
- mapImg.src = "http://maps.googleapis.com/maps/api/streetview?location=" + panoramaPosition +
+ mapImg.src = "http://maps.googleapis.com/maps/api/streetview?" +
+ "location=" + panoramaPosition.lat() + ',' + panoramaPosition.lng() +
"&pitch=" + panoramaPitch +
"&heading=" + panoramaHeading +
"&size=" + mapWidth + 'x' + mapHeight +
"&zoom=" + panoramaZoom +
"&sensor=false" +
- "®ion=KR";
+ "®ion=KR" +
+ "&key=" + staticMapsAPI;
} else {
- mapImg.src = "http://maps.google.com/maps/api/staticmap?center=" + centerLat + ',' + centerLng +
+ mapImg.src = "http://maps.google.com/maps/api/staticmap?" +
+ "center=" + centerLat + ',' + centerLng +
"&zoom=" + setZoom +
"&size=" + mapWidth + 'x' + mapHeight +
"&maptype=" + mapType +
- //"&markers=" + marker_lat + ',' + marker_lng +
+ "&markers=" + marker_lat + ',' + marker_lng +
"&sensor=false" +
"&language=ko" +
- "®ion=KR";
+ "®ion=KR" +
+ "&key=" + staticMapsAPI;
}
}
function searchAddress() {
var address = document.getElementById('fm_address').value,
geocoder = new google.maps.Geocoder();
- //var results, status;
- //var marker = new google.maps.Marker({ 'map': map, 'draggable': true });
geocoder.geocode({'address' : address},
- function (results, status) {
- if (status === google.maps.GeocoderStatus.OK) {
- centerLat = results[0].geometry.location.lat();
- centerLng = results[0].geometry.location.lng();
- latlng = new google.maps.LatLng(centerLat, centerLng);
- map.setCenter(latlng);
- map.setZoom(setZoom);
- }
- });
+ function (results, status) {
+ if (status === google.maps.GeocoderStatus.OK) {
+ centerLat = results[0].geometry.location.lat();
+ centerLng = results[0].geometry.location.lng();
+ latlng = new google.maps.LatLng(centerLat, centerLng);
+ map.setCenter(latlng);
+ map.setZoom(setZoom);
+ marker = new google.maps.Marker({ 'map': map, 'draggable': true, 'position': latlng,
+ animation: google.maps.Animation.DROP});
+ marker.setMap(map);
+ }
+ });
}
function initMap(zoom) {
diff --git a/plugin/editor/cheditor5/popup/js/image.html5.js b/plugin/editor/cheditor5/popup/js/image.html5.js
index c3e3f46c4..afa16b87e 100644
--- a/plugin/editor/cheditor5/popup/js/image.html5.js
+++ b/plugin/editor/cheditor5/popup/js/image.html5.js
@@ -36,7 +36,8 @@ var activeImage = null,
uploadImagePath = '',
uploadMaxNumber = 12,
uploadScript,
- useWebGL = false;
+ useWebGL = false,
+ supportImageOrientation;
if (ArrayBuffer && !ArrayBuffer.prototype.slice) {
ArrayBuffer.prototype.slice = function (start, end) {
@@ -437,11 +438,6 @@ function fileFilterError(file) {
"gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
}
-function explorerFileFilterError(file) {
- alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
- "익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
-}
-
function imgComplete(img, imgSize, boxId) {
var resizeW, resizeH, M, elem;
img.setAttribute("border", '0');
@@ -929,7 +925,7 @@ function DoUpload() {
blob = new Blob();
for (key in blob) {
- if (blob.hasOwnProperty(key)) {
+ if ({}.hasOwnProperty.call(blob, key)) {
(function (key) {
Object.defineProperty(MYBLOB.prototype,
key,
@@ -967,13 +963,7 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
- // 엣지를 제외한 ie브라우저인지 체크
- var agent = navigator.userAgent.toLowerCase();
- if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
- explorerFileFilterError(file.name);
- } else {
- FileFilterError(file.name);
- }
+ fileFilterError(file.name);
continue;
}
this.list.push(file);
@@ -1032,15 +1022,22 @@ DoUpload.prototype = {
offset = 2,
marker, little, tags, i;
+ // JPEG가 아닌 경우, 알 수 없음
if (view.getUint16(0, false) !== 0xffd8) {
return -2;
}
while (offset < length) {
+ // 알 수 없음
+ if (view.getUint16(offset + 2, false) <= 8) {
+ return -1;
+ }
+
marker = view.getUint16(offset, false);
offset += 2;
if (marker === 0xffe1) {
+ // 알 수 없음
if (view.getUint32(offset += 2, false) !== 0x45786966) {
return -1;
}
@@ -1061,7 +1058,7 @@ DoUpload.prototype = {
offset += view.getUint16(offset, false);
}
}
-
+ // 알 수 없음
return -1;
},
@@ -1076,7 +1073,7 @@ DoUpload.prototype = {
|| window.MSBlobBuilder;
if (e.name === 'TypeError' && window.BlobBuilder) {
- blobb = new BlobBuilder();
+ // eslint-disable-next-line no-undef
blobb.append(data);
blob = blobb.getBlob(datatype);
console.log("TypeError");
@@ -1089,50 +1086,46 @@ DoUpload.prototype = {
return blob;
},
- imageResize : function (image, filetype, resizeWidth, orientation, addWaterMark) {
- var canvas, source_w = image.width, source_h = image.height,
- resize_h, resize_w, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
+ imageResize : function (image, filetype, resize_w, orientation, addWaterMark) {
+ var canvas = document.createElement("canvas"),
+ ctx = canvas.getContext("2d"),
+ source_w = image.width,
+ source_h = image.height,
+ resize_h, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
source_img, resize_img, source_data, resize_data, j, i,
- x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r, center_x, center_y, x_start, x_stop,
- y_start, y_stop, y, dy, part_w, x, dx, w, pos_x,
- ctx, gl, imageData = null;
+ x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r,
+ center_x, center_y, x_start, x_stop,
+ y_start, y_stop, y, dy, part_w, x, dx, w, pos_x, gl, imageData = null;
// 카메라 로테이션 보정
- if (orientation > 0) {
- canvas = document.createElement("canvas");
- canvas.width = source_w;
- canvas.height = source_h;
- ctx = canvas.getContext("2d");
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- ctx.save();
+ if (orientation > 0 && !supportImageOrientation) {
+ if ([5,6,7,8].indexOf(orientation) > -1) {
+ canvas.width = source_h;
+ canvas.height = source_w;
+ } else {
+ canvas.width = source_w;
+ canvas.height = source_h;
+ }
switch (orientation) {
- case 2 :
- ctx.translate(-1, 0, 0, 1, canvas.width, 0); break;
- case 3 :
- ctx.translate(-1, 0, 0, -1, canvas.width, canvas.height); break;
- case 4 :
- ctx.translate(1, 0, 0, -1, 0, canvas.height); break;
- case 5 :
- ctx.translate(0, 1, 1, 0, 0, 0); break;
- case 6 :
- ctx.translate(0, 1, -1, 0, canvas.height, 0); break;
- case 7 :
- ctx.translate(0, -1, -1, 0, canvas.height, canvas.width); break;
- case 8 :
- ctx.translate(0, -1, 1, 0, 0, canvas.width); break;
+ case 2 : ctx.transform(-1, 0, 0, 1, source_w, 0); break;
+ case 3 : ctx.transform(-1, 0, 0, -1, source_w, source_h); break;
+ case 4 : ctx.transform(1, 0, 0, -1, 0, source_h); break;
+ case 5 : ctx.transform(0, 1, 1, 0, 0, 0); break;
+ case 6 : ctx.transform(0, 1, -1, 0, source_h, 0); break;
+ case 7 : ctx.transform(0, -1, -1, 0, source_h, source_w); break;
+ case 8 : ctx.transform(0, -1, 1, 0, 0, source_w); break;
default: break;
}
- ctx.drawImage(image, 0, 0);
+ ctx.drawImage(image, 0, 0, source_w, source_h);
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.restore();
source_w = canvas.width;
source_h = canvas.height;
}
- if (source_w > resizeWidth) {
- resize_w = resizeWidth;
+ if (source_w > resize_w) {
resize_h = Math.ceil(resize_w / source_w * source_h);
try {
@@ -1143,8 +1136,6 @@ DoUpload.prototype = {
canvas = gl_canvas;
});
} catch (ignore) {
- canvas = document.createElement("canvas");
- ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
@@ -1216,14 +1207,10 @@ DoUpload.prototype = {
canvas.height = resize_h;
ctx.putImageData(resize_img, 0, 0);
}
-
} else {
- canvas = document.createElement("canvas"),
- canvas.width = source_w; canvas.height = source_h;
- ctx = canvas.getContext("2d");
+ canvas.width = source_w;
+ canvas.height = source_h;
ctx.drawImage(image, 0, 0);
- resize_h = source_h;
- resize_w = source_w;
}
if (this.reader.watermark && addWaterMark) {
@@ -1276,7 +1263,8 @@ DoUpload.prototype = {
filename = evt.target.file.name,
filetype = evt.target.file.type,
file = evt.target.file,
- blob, image, orientation = 1, slice = 64 * 1024;
+ blob, image, orientation = 1,
+ slice = 64 * 1024;
if (slice > file.size - 1) {
slice = file.size;
@@ -1298,12 +1286,12 @@ DoUpload.prototype = {
xhr.open('POST', uploadScript, true);
- if (imageResizeWidth > 0) {
+ fileFormat = filename.substring(filename.lastIndexOf('.'));
+ if (imageResizeWidth > 0 && fileFormat !== '.gif') {
bitmapData = self.imageResize(this, filetype, imageResizeWidth, orientation, true);
file = self.canvasToBlob(bitmapData, filetype);
}
- fileFormat = filename.substring(filename.lastIndexOf('.'));
randomName = self.makeFilename(fileFormat);
data.append('origname', filename);
@@ -1375,7 +1363,6 @@ DoUpload.prototype = {
blob = null;
xhr.send(data);
};
-
image.src = blob.getURL();
}
},
@@ -1484,7 +1471,7 @@ function setResizeWidth() {
}
function init(dialog) {
- var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon;
+ var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon, testImg;
oEditor = this;
oEditor.dialog = dialog;
@@ -1588,8 +1575,24 @@ function init(dialog) {
xhr_f.send();
xhr_v.send();
}
+
glicon = new Image();
glicon.className = 'webgl_logo';
glicon.src = uploadImagePath + (useWebGL ? "/webgl.png" : "/webgl-off.png");
document.getElementById('webgl_logo_wrapper').appendChild(glicon);
+
+ // 브라우저가 사진 Orientation 보정을 자동으로 지원하지는지 확인
+ testImg = new Image();
+ testImg.onload = function () {
+ supportImageOrientation = testImg.width === 2 && testImg.height === 3;
+ };
+ testImg.src =
+ 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +
+ 'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +
+ 'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +
+ 'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAIAAwMBEQACEQEDEQH/x' +
+ 'ABRAAEAAAAAAAAAAAAAAAAAAAAKEAEBAQADAQEAAAAAAAAAAAAGBQQDCAkCBwEBAAAAAAA' +
+ 'AAAAAAAAAAAAAABEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AG8T9NfSMEVMhQ' +
+ 'voP3fFiRZ+MTHDifa/95OFSZU5OzRzxkyejv8ciEfhSceSXGjS8eSdLnZc2HDm4M3BxcXw' +
+ 'H/9k=';
}
diff --git a/plugin/editor/cheditor5/popup/js/image.html5.m.js b/plugin/editor/cheditor5/popup/js/image.html5.m.js
index e50c3389f..13549fd3e 100644
--- a/plugin/editor/cheditor5/popup/js/image.html5.m.js
+++ b/plugin/editor/cheditor5/popup/js/image.html5.m.js
@@ -35,8 +35,9 @@ var activeImage = null,
tmpTop = 0,
uploadImagePath = '',
uploadMaxNumber = 12,
- uploadScript;
- useWebGL = false;
+ uploadScript,
+ useWebGL = false,
+ supportImageOrientation;
if (ArrayBuffer && !ArrayBuffer.prototype.slice) {
ArrayBuffer.prototype.slice = function (start, end) {
@@ -434,12 +435,7 @@ function startUpload(list) {
function fileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
- "gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
-}
-
-function explorerFileFilterError(file) {
- alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
- "익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
+ "gif, png, jpg 사진 파일만 전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
@@ -967,16 +963,10 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
- // 엣지를 제외한 ie브라우저인지 체크
- var agent = navigator.userAgent.toLowerCase();
- if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
- explorerFileFilterError(file.name);
- } else {
- FileFilterError(file.name);
- }
+ fileFilterError(file.name);
continue;
}
- this.list.push(file);
+ this.list.push(file);
}
if (this.list.length < 1) {
@@ -1089,50 +1079,46 @@ DoUpload.prototype = {
return blob;
},
- imageResize : function (image, filetype, resizeWidth, orientation, addWaterMark) {
- var canvas, source_w = image.width, source_h = image.height,
- resize_h, resize_w, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
+ imageResize : function (image, filetype, resize_w, orientation, addWaterMark) {
+ var canvas = document.createElement("canvas"),
+ ctx = canvas.getContext("2d"),
+ source_w = image.width,
+ source_h = image.height,
+ resize_h, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
source_img, resize_img, source_data, resize_data, j, i,
- x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r, center_x, center_y, x_start, x_stop,
- y_start, y_stop, y, dy, part_w, x, dx, w, pos_x,
- ctx, gl, imageData = null;
+ x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r,
+ center_x, center_y, x_start, x_stop,
+ y_start, y_stop, y, dy, part_w, x, dx, w, pos_x, gl, imageData = null;
// 카메라 로테이션 보정
- if (orientation > 0) {
- canvas = document.createElement("canvas");
- canvas.width = source_w;
- canvas.height = source_h;
- ctx = canvas.getContext("2d");
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- ctx.save();
+ if (orientation > 0 && !supportImageOrientation) {
+ if ([5,6,7,8].indexOf(orientation) > -1) {
+ canvas.width = source_h;
+ canvas.height = source_w;
+ } else {
+ canvas.width = source_w;
+ canvas.height = source_h;
+ }
switch (orientation) {
- case 2 :
- ctx.translate(-1, 0, 0, 1, canvas.width, 0); break;
- case 3 :
- ctx.translate(-1, 0, 0, -1, canvas.width, canvas.height); break;
- case 4 :
- ctx.translate(1, 0, 0, -1, 0, canvas.height); break;
- case 5 :
- ctx.translate(0, 1, 1, 0, 0, 0); break;
- case 6 :
- ctx.translate(0, 1, -1, 0, canvas.height, 0); break;
- case 7 :
- ctx.translate(0, -1, -1, 0, canvas.height, canvas.width); break;
- case 8 :
- ctx.translate(0, -1, 1, 0, 0, canvas.width); break;
+ case 2 : ctx.transform(-1, 0, 0, 1, source_w, 0); break;
+ case 3 : ctx.transform(-1, 0, 0, -1, source_w, source_h); break;
+ case 4 : ctx.transform(1, 0, 0, -1, 0, source_h); break;
+ case 5 : ctx.transform(0, 1, 1, 0, 0, 0); break;
+ case 6 : ctx.transform(0, 1, -1, 0, source_h, 0); break;
+ case 7 : ctx.transform(0, -1, -1, 0, source_h, source_w); break;
+ case 8 : ctx.transform(0, -1, 1, 0, 0, source_w); break;
default: break;
}
- ctx.drawImage(image, 0, 0);
+ ctx.drawImage(image, 0, 0, source_w, source_h);
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.restore();
source_w = canvas.width;
source_h = canvas.height;
}
- if (source_w > resizeWidth) {
- resize_w = resizeWidth;
+ if (source_w > resize_w) {
resize_h = Math.ceil(resize_w / source_w * source_h);
try {
@@ -1143,8 +1129,6 @@ DoUpload.prototype = {
canvas = gl_canvas;
});
} catch (ignore) {
- canvas = document.createElement("canvas");
- ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
@@ -1216,14 +1200,10 @@ DoUpload.prototype = {
canvas.height = resize_h;
ctx.putImageData(resize_img, 0, 0);
}
-
} else {
- canvas = document.createElement("canvas"),
- canvas.width = source_w; canvas.height = source_h;
- ctx = canvas.getContext("2d");
+ canvas.width = source_w;
+ canvas.height = source_h;
ctx.drawImage(image, 0, 0);
- resize_h = source_h;
- resize_w = source_w;
}
if (this.reader.watermark && addWaterMark) {
@@ -1484,7 +1464,7 @@ function setResizeWidth() {
}
function init(dialog) {
- var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon;
+ var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon, testImg;
oEditor = this;
oEditor.dialog = dialog;
@@ -1556,11 +1536,6 @@ function init(dialog) {
}
}
- if (browser.mobile) {
- input = document.getElementById('inputImageUpload');
- input.setAttribute('capture', 'filesystem');
- }
-
tmpcanvas = document.createElement('canvas');
if (tmpcanvas.getContext('webgl', {preserveDrawingBuffer: true}) ||
tmpcanvas.getContext('experimental-webgl', {preserveDrawingBuffer: true}))
@@ -1588,8 +1563,24 @@ function init(dialog) {
xhr_f.send();
xhr_v.send();
}
+
glicon = new Image();
glicon.className = 'webgl_logo';
glicon.src = uploadImagePath + (useWebGL ? "/webgl.png" : "/webgl-off.png");
document.getElementById('webgl_logo_wrapper').appendChild(glicon);
+
+ // 브라우저가 사진 Orientation 보정을 자동으로 지원하지는지 확인
+ testImg = new Image();
+ testImg.onload = function () {
+ supportImageOrientation = testImg.width === 2 && testImg.height === 3;
+ };
+ testImg.src =
+ 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +
+ 'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +
+ 'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +
+ 'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAIAAwMBEQACEQEDEQH/x' +
+ 'ABRAAEAAAAAAAAAAAAAAAAAAAAKEAEBAQADAQEAAAAAAAAAAAAGBQQDCAkCBwEBAAAAAAA' +
+ 'AAAAAAAAAAAAAABEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AG8T9NfSMEVMhQ' +
+ 'voP3fFiRZ+MTHDifa/95OFSZU5OzRzxkyejv8ciEfhSceSXGjS8eSdLnZc2HDm4M3BxcXw' +
+ 'H/9k=';
}
diff --git a/plugin/editor/cheditor5/template.dtd b/plugin/editor/cheditor5/template.dtd
new file mode 100644
index 000000000..212845e57
--- /dev/null
+++ b/plugin/editor/cheditor5/template.dtd
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file