]+)> <\/font>/mgi, '');
+ //text = text.replace(/\x22/g, '"');
+ return text;
+ },
+
+ checkDocLinks : function () {
+ var links = this.doc.links,
+ len = links.length,
+ host = location.host,
+ i, href;
+
+ this.cheditor.links = [];
+
+ for (i = 0; i < len; i++) {
+ if (!this.config.includeHostname) {
+ href = links[i].href;
+ if (href.indexOf(host) !== -1) {
+ links[i].setAttribute('href', href.substring(href.indexOf(host) + host.length));
+ }
+ }
+ if (this.config.linkTarget !== '' && this.config.linkTarget !== null) {
+ if (!(links[i].getAttribute('target'))) {
+ links[i].setAttribute('target', this.config.linkTarget);
+ }
+ }
+ if (GB.browser.msie) {
+ this.cheditor.links.push(links[i]);
+ }
+ }
+ },
+
+ checkDocImages : function () {
+ var img = this.doc.images,
+ len = img.length,
+ host = location.host,
+ i = 0, imgUrl;
+
+ for (; i < len; i++) {
+ if (!this.config.includeHostname) {
+ imgUrl = img[i].src;
+ if (imgUrl) {
+ if (imgUrl.indexOf(host) !== -1) {
+ img[i].src = imgUrl.substring(imgUrl.indexOf(host) + host.length);
+ }
+ }
+ }
+ if (img[i].style.width) {
+ img[i].removeAttribute('width');
+ }
+ if (img[i].style.height) {
+ img[i].removeAttribute('height');
+ }
+ }
+ },
+
+ createNbspTextNode : function () {
+ return this.doc.createTextNode('\u00a0');
+ },
+
+ getNodeTree : function (pNode, callback) {
+ function Node(node) {
+ this.node = node;
+ this.name = node.nodeName.toLowerCase();
+ this.type = node.nodeType;
+ this.parent = node.parentNode;
+ this.indent = 0;
+ }
+ (function recurse(cNode, indent) {
+ var i, child,
+ node = new Node(cNode),
+ children = cNode.childNodes,
+ len = children.length;
+
+ node.indent = indent;
+
+ for (i = 0; i < len; i++) {
+ child = children[i];
+ if (child) {
+ recurse(child, indent + 1);
+ }
+ }
+
+ if (node.name !== 'body') {
+ callback(node);
+ }
+ })(pNode, -1);
+ },
+
+ getContents : function (startEndNode) {
+ var self = this,
+ mydoc, indentNodes = [], i, node, msie_c = typeof this.browser.msie_c !== 'undefined',
+ allowedIndent = this.getContents.caller !== this.getBodyContents,
+ insertTabSpace = function (indent) {
+ return msie_c ? self.doc.createComment('Tab Size:' + indent) :
+ self.doc.createTextNode('\n' + self.tabRepeat(indent));
+ };
+
+ function checkChildNodes(child) {
+ if (!child) {
+ return null;
+ }
+ if (!startEndNode) {
+ return child;
+ }
+ do {
+ if (child !== startEndNode.startNode && child !== startEndNode.endNode) {
+ break;
+ }
+ child = child.nextSibling;
+ } while (child);
+
+ return child;
+ }
+
+ this.checkDocLinks();
+ this.checkDocImages();
+ this.getNodeTree(this.doc.body, function (node) {
+ if (!node.node) {
+ return;
+ }
+ if (self.config.exceptedElements[node.name]) {
+ node.parent.replaceChild(self.doc.createTextNode(''), node.node);
+ return;
+ }
+
+ switch (node.type) {
+ case GB.node.text :
+ if (!self.isTextVisible(node.node.nodeValue)) {
+ node.parent.replaceChild(self.doc.createTextNode(''), node.node);
+ }
+ break;
+ case GB.node.element :
+ if (node.node.className === self.cheditor.bogusSpacerName) {
+ if (node.node.firstChild === null) {
+ if (node.name === 'br') {
+ node.parent.removeChild(node.node);
+ if (!checkChildNodes(node.parent.firstChild)) {
+ node.parent.appendChild(self.createNbspTextNode());
+ }
+ } else {
+ node.node.appendChild(self.createNbspTextNode());
+ }
+ } else if (!checkChildNodes(node.node.firstChild)) {
+ node.node.appendChild(self.createNbspTextNode());
+ }
+ node.node.className = '';
+ }
+ if ((node.name === 'p' || node.name === 'div') && !checkChildNodes(node.node.firstChild)) {
+ node.node.appendChild(self.createNbspTextNode());
+ }
+ if (GB.newLineBeforeTags[node.name] && allowedIndent) {
+ if (node.node.firstChild && (node.node.firstChild.nodeType === GB.node.element)) {
+ node.node.insertBefore(insertTabSpace(node.indent + 1), node.node.firstChild);
+ node.node.appendChild(insertTabSpace(node.indent));
+ }
+ indentNodes.push(node);
+ }
+ if (GB.selfClosingTags[node.name]) {
+ node.node.setAttribute('self-close-tag', '1');
+ }
+ break;
+ case GB.node.comment :
+ if (node.node.nodeValue === self.cheditor.bogusSpacerName) {
+ node.parent.removeChild(node.node);
+ if (!checkChildNodes(node.parent.firstChild)) {
+ node.parent.appendChild(self.createNbspTextNode());
+ } else if (node.parent.firstChild.nodeName.toLowerCase() === 'br') {
+ node.parent.replaceChild(self.createNbspTextNode(), node.node.firstChild);
+ }
+ }
+ }
+ });
+
+ for (i in indentNodes) {
+ if (indentNodes.hasOwnProperty(i)) {
+ node = indentNodes[i];
+ node.parent.insertBefore(insertTabSpace(node.indent), node.node);
+
+ if (node.node.nextSibling) {
+ node.node.nextSibling.parentNode.insertBefore(insertTabSpace(node.indent), node.node.nextSibling);
+ } else {
+ node.parent.appendChild(insertTabSpace(node.indent));
+ }
+ }
+ }
+
+ indentNodes = [];
+ mydoc = this.doc.body.innerHTML;
+ mydoc = mydoc.replace(/^\s*[\r\n]/gm, '').replace(/\u200b/g, '');
+
+ if (msie_c) {
+ mydoc = mydoc.replace(/(?:[\r\n]*)/g,
+ function (a, b) {
+ return '\n' + self.tabRepeat(b);
+ }).replace(/<(\/?)([A-Za-z]+)([^>]*)>/g,
+ function (a, close, tag, attr) {
+ attr = attr.replace(/\s(\w+)=([^'"\s>]+)/g,
+ function (a, k, v) {
+ return ' ' + k.toLowerCase() + '="' + v + '"';
+ }).replace(/([A-Za-z\-]+)(?:\s*):\s+?/g,
+ function (a, k) {
+ return k.toLowerCase() + ': ';
+ });
+ return '<' + close + tag.toLowerCase() + attr + '>';
+ }
+ );
+ }
+
+ mydoc = mydoc.replace(/<[^>]+>/gm, function (match) {
+ match = match.replace(/\sself-close-tag="1"([^>]+)?/g, '$1 /');
+
+ if (self.config.allowedOnEvent !== true) {
+ match = match.replace(/\s+on([A-Za-z]+)=("[^"]*"|'[^']*'|[^\s>]*)/g, '');
+ }
+
+ if (self.config.colorToHex) {
+ match = match.replace(/(background-color|color)\s*([:=])\s*(rgba?)\(\s*(\d+)\s*,\s*(\d+),\s*(\d+)\)/ig,
+ function (all, p, s, rgb, r, g, b) {
+ return p + s + ' ' + self.colorConvert(rgb + '(' + r + ',' + g + ',' + b + ')', 'hex');
+ });
+ } else {
+ match = match.replace(/(background-color|color)\s*([:=])\s*(#[A-Fa-f0-9]{3,6})/ig,
+ function (all, p, s, hex) {
+ return p + s + ' ' + self.colorConvert(hex, 'rgb');
+ });
+ }
+
+ return match;
+ });
+
+ return mydoc;
+ },
+
+ returnContents : function (mydoc) {
+ mydoc = this.removeEmptyBogusTag(mydoc);
+ this.setDesignMode(true);
+ this.cheditor.textarea.value = mydoc;
+ return mydoc;
+ },
+
+ makeAmpTag : function (str) {
+ return str.replace(/</g, '<').replace(/>/g, '>');
+ },
+
+ removeAmpTag : function (str) {
+ if (this.config.removeIndent) {
+ str = str.replace(/^[\t]+/gm, '');
+ }
+ return str.replace (/</g, '<').replace(/>/g, '>');
+ },
+
+ getOutputContents : function () {
+ this.resetViewHTML();
+ return this.removeAmpTag(this.getContents(null));
+ },
+
+ outputHTML : function () {
+ return '\n' +
+ '\n' +
+ ' \n' +
+ ' ' + this.config.docTitle + '\n' +
+ ' \n' +
+ ' \n' +
+ this.returnContents(this.getOutputContents()) +
+ ' \n' +
+ '';
+ },
+
+ getBodyContents : function () {
+ return (this.cheditor.mode === 'code') ? this.makeHtmlContent() : this.getContents(null);
+ },
+
+ outputBodyHTML : function () {
+ return this.returnContents(this.getOutputContents());
+ },
+
+ outputBodyText : function () {
+ return this.returnContents(this.getBodyText());
+ },
+
+ getBodyText : function () {
+ this.resetViewHTML();
+ return this.trimSpace(String(GB.browser.msie ? this.doc.body.innerText : this.doc.body.textContent));
+ },
+
+ returnFalse : function () {
+ var img = this.doc.images, i;
+ this.editAreaFocus();
+
+ for (i = 0; i < img.length; i++) {
+ if (img[i].src) {
+ if (img[i].getAttribute('onload')) {
+ img[i].onload = 'true';
+ }
+ } else {
+ img[i].removeAttribute('onload');
+ img[i].removeAttribute('className');
+ }
+ }
+ return false;
+ },
+
+ trimZeroSpace : function (str) {
+ return str ? str.replace(/[\ufeff\u200b\xa0\u3000]+/gm, '') : '';
+ },
+
+ trimSpace : function (str) {
+ return str ? str.replace(/^[\s\ufeff\u200b\xa0\u3000]+|[\s\ufeff\u200b\xa0\u3000]+$/g, '') : '';
+ },
+
+ makeRandomString : function () {
+ var chars = '_-$@!#0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz',
+ len = 32,
+ clen = chars.length,
+ rData = '', i, rnum;
+
+ for (i = 0; i < len; i++) {
+ rnum = Math.floor(Math.random() * clen);
+ rData += chars.substring(rnum, rnum + 1);
+ }
+ return rData;
+ },
+
+ strLength : function (str) {
+ var len = str.length, mbytes = 0, i, c;
+ for (i = 0; i < len; i++) {
+ c = str.charCodeAt(i);
+ if (c > 128) {
+ mbytes++;
+ }
+ }
+ return (len - mbytes) + (mbytes * 2);
+ },
+
+ resetViewHTML : function () {
+ if (this.cheditor.mode === 'code') {
+ this.switchEditorMode('rich');
+ }
+ },
+
+ contentsLengthAll : function () {
+ return this.strLength(this.outputHTML());
+ },
+
+ contentsLength : function () {
+ var content = String(this.trimSpace(this.outputBodyHTML()));
+ if (!content) {
+ return 0;
+ }
+ return this.strLength(content);
+ },
+
+ inputLength : function () {
+ var content = this.getBodyText();
+ if (content === '') {
+ return 0;
+ }
+ return this.strLength(content);
+ },
+
+ displayWindow : function (pNode, id) {
+ var pullDown = this.pulldown[id];
+ this.editAreaFocus();
+ this.backupRange();
+ this.boxHideAll(id);
+ pullDown.style.visibility = 'visible';
+ pullDown.style.zIndex = 10002;
+ pullDown.focus();
+ },
+
+ pulldownMouseOver : function (el) {
+ if (el.className === 'cheditor-pulldown-selected') {
+ return;
+ }
+ el.className = 'cheditor-pulldown-mouseover';
+ },
+ pulldownMouseOut : function (el) {
+ if (el.className === 'cheditor-pulldown-selected') {
+ return;
+ }
+ el.className = 'cheditor-pulldown-mouseout';
+ },
+
+ windowPos : function (pNode, id) {
+ var left = pNode.offsetLeft, box = this.pulldown[id];
+
+ if (this.toolbar[id].type === 'combobox') {
+ left -= parseInt(this.toolbar[this.toolbar[id].node].width, 10);
+ }
+ if (this.toolbar[id].prev && !this.toolbar[id].next) {
+ left -= 1;
+ }
+ box.style.left = left + 'px';
+ box.style.top = pNode.offsetTop + parseInt(pNode.style.height, 10) + 'px';
+ },
+
+ boxHideAll : function (showId) {
+ var menu, box, ishide;
+ for (menu in this.pulldown) {
+ if (this.pulldown.hasOwnProperty(menu)) {
+ box = this.pulldown[menu];
+ if (box) {
+ box.style.visibility = 'hidden';
+ ishide = this.undefined(showId) ? true : (menu !== showId);
+ if (ishide && this.toolbar[menu].checked) {
+ this.toolbar[menu].checked = false;
+ this.toolbarButtonUnchecked(this.toolbar[menu]);
+ }
+ }
+ }
+ }
+ this.editAreaFocus();
+ },
+
+ createWindow : function (width, elem) {
+ elem.className = 'cheditor-pulldown-container';
+ elem.style.width = width + 'px';
+ },
+
+ setColorTable : function (menu) {
+ var self = this,
+ pulldown = document.createElement('div'),
+ len = GB.colors.length,
+ container = document.createElement('div'),
+ selected = document.createElement('input'),
+ selectedValue = document.createElement('input'),
+ cellWrapper = document.createElement('div'),
+ br = document.createElement('div'),
+ reset = document.createElement('span'),
+ pickerSwitch = document.createElement('span'),
+ button = document.createElement('img'),
+ showTooltip = '더 많은 색 보기',
+ hideTooltip = '감추기',
+ i, cell, color = 0, colorPicker, cellBorder,
+ onMouseOverEventHandler = function () {
+ colorPicker.fromString(this.id);
+ this.parentNode.className = 'cheditor-pulldown-color-cell-over';
+ },
+ onMouseOutEventHandler = function () {
+ this.parentNode.className = 'cheditor-pulldown-color-cell';
+ },
+ onClickEventHandler = function () {
+ self.doCmdPopup(menu, this.id);
+ },
+ onResetEventHandler = function () {
+ colorPicker.fromString(self.colorConvert(selectedValue.style.backgroundColor, 'hex'));
+ },
+ onPickerEventHandler = function () {
+ if (self.toolbar[menu].colorNode.showPicker) {
+ colorPicker.hidePicker();
+ self.toolbar[menu].colorNode.showPicker = false;
+ pickerSwitch.setAttribute('title', showTooltip);
+ } else {
+ colorPicker.showPicker();
+ self.toolbar[menu].colorNode.showPicker = true;
+ pickerSwitch.setAttribute('title', hideTooltip);
+ }
+ },
+ onSubmitEventHandler = function () {
+ self.doCmdPopup(menu, selected.value);
+ };
+
+ selected.setAttribute('type', 'text');
+ selected.setAttribute('maxlength', '7');
+ selected.className = 'cheditor-pulldown-color-selected';
+
+ selectedValue.setAttribute('type', 'text');
+ selectedValue.onfocus = function () {
+ selected.focus();
+ };
+
+ selectedValue.style.cursor = 'default';
+ selectedValue.className = 'cheditor-pulldown-color-selected';
+ selected.style.marginLeft = '-1px';
+ selected.style.borderLeft = 'none';
+ selected.spellcheck = false;
+
+ cellWrapper.style.margin = '2px';
+ cellWrapper.style.position = 'relative';
+ container.style.position = 'relative';
+
+ br.style.clear = 'both';
+ br.style.height = '0px';
+ colorPicker = new GB.colorDropper(selected, {'iconDir': this.config.iconPath});
+
+ for (i = 0; i < len; i++) {
+ if (i % 13 === 0) {
+ cellWrapper.appendChild(br.cloneNode(true));
+ if (i === 26) {
+ cellWrapper.lastChild.style.height = '4px';
+ }
+ len++;
+ continue;
+ }
+ cellBorder = document.createElement('span');
+ cellBorder.className = 'cheditor-pulldown-color-cell';
+ cell = document.createElement('span');
+ cell.id = GB.colors[color];
+ cell.style.backgroundColor = GB.colors[color++];
+ cell.appendChild(document.createTextNode('\u00a0'));
+ cellBorder.appendChild(cell);
+ cellWrapper.appendChild(cellBorder);
+ (function () {
+ cell.onclick = onClickEventHandler;
+ cell.onmouseover = onMouseOverEventHandler;
+ cell.onmouseout = onMouseOutEventHandler;
+ })();
+ }
+
+ cellWrapper.appendChild(br);
+ cellWrapper.appendChild(selectedValue);
+ cellWrapper.appendChild(selected);
+
+ reset.appendChild(document.createTextNode('\u00a0'));
+ reset.className = 'cheditor-pulldown-color-reset';
+ reset.onclick = onResetEventHandler;
+
+ cellWrapper.appendChild(reset);
+
+ pickerSwitch.appendChild(document.createTextNode('\u00a0'));
+ pickerSwitch.className = 'cheditor-pulldown-color-show-picker';
+ pickerSwitch.setAttribute('title', showTooltip);
+ pickerSwitch.onclick = onPickerEventHandler;
+ cellWrapper.appendChild(pickerSwitch);
+
+ button.className = 'cheditor-pulldown-color-submit';
+ button.src = this.config.iconPath + 'button/input_color.gif';
+ button.onclick = onSubmitEventHandler;
+ cellWrapper.appendChild(button);
+ container.appendChild(cellWrapper);
+
+ self.toolbar[menu].colorNode.selectedValue = selectedValue;
+ self.toolbar[menu].colorNode.colorPicker = colorPicker;
+
+ pulldown.appendChild(container);
+ return pulldown;
+ },
+
+ onKeyPressToolbarUpdate : function () {
+ var self = this;
+ if (this.tempTimer) {
+ clearTimeout(this.tempTimer);
+ }
+ this.tempTimer = setTimeout(function () {
+ if (self.config.showTagPath) {
+ self.doEditorEvent();
+ } else {
+ self.toolbarUpdate();
+ }
+ self.tempTimer = null;
+ }, 50);
+ },
+
+ doOnKeyDown : function (evt) {
+ switch (evt.keyCode) {
+ case 37: case 38: case 39: case 40: case 46: case 8:
+ this.onKeyPressToolbarUpdate(evt);
+ }
+ },
+
+ doOnKeyUp : function (evt) {
+ var caretRange, css, enterNode, i, keyCode = evt.keyCode, node, self = this, storedNode, storedRange,
+ clearBackgroundColor = function (cNode) {
+ if (cNode.nodeType !== GB.node.element || cNode.hasChildNodes() || !cNode.getAttribute('style')) {
+ return cNode;
+ }
+ if (GB.textFormatTags[cNode.nodeName.toLowerCase()]) {
+ css = self.checkCssValue(cNode, 'background-color');
+ if (css) {
+ css = self.clearCss(cNode, 'background-color');
+ if (cNode.nodeName.toLowerCase() === 'span' && !css) {
+ node = cNode.parentNode;
+ node.removeChild(cNode);
+ return node;
+ }
+ }
+ }
+ return cNode;
+ };
+
+ if (keyCode !== 13 || this.cheditor.mode !== 'rich') {
+ return;
+ }
+
+ if (typeof GB.browser.msie_c !== 'undefined') {
+ node = this.storedSelections[0];
+ if (!node) {
+ return;
+ }
+ if (node.className === this.cheditor.bogusSpacerName) {
+ node.className = '';
+ }
+ while (node.firstChild) {
+ node = node.firstChild;
+ }
+ if (node.nodeType === GB.node.element && node.canHaveChildren) {
+ node.className = this.cheditor.bogusSpacerName;
+ }
+ return;
+ }
+
+ caretRange = this.getRange();
+ enterNode = caretRange.commonAncestorContainer;
+
+ if (GB.browser.msie || GB.browser.edge) {
+ this.backupRange(caretRange);
+ if (enterNode.nodeType === GB.node.element) {
+ enterNode = clearBackgroundColor(enterNode);
+ enterNode.className = this.cheditor.bogusSpacerName;
+ }
+ for (i = 0; i < this.keyPressStoredSelections.length; i++) {
+ storedRange = this.keyPressStoredSelections[i];
+ storedNode = storedRange.commonAncestorContainer;
+ if (storedNode && storedNode.nodeType === GB.node.element) {
+ node = storedNode.childNodes[storedRange.startOffset];
+ if (!node) {
+ break;
+ }
+ while (node.firstChild) {
+ node = node.firstChild;
+ }
+ node = clearBackgroundColor(node);
+ node.className = this.cheditor.bogusSpacerName;
+ }
+ }
+ this.restoreRange();
+ this.keyPressStoredSelections = [];
+ } else {
+ this.applyBogusClassName(caretRange);
+ }
+ },
+
+ doOnKeyPress : function (evt) {
+ var keyCode = evt.keyCode, caretRange;
+ if (keyCode && keyCode === 13 && this.cheditor.mode === 'rich') {
+ caretRange = this.getRange();
+ if (typeof this.browser.msie_c !== 'undefined') {
+ try {
+ this.storedSelections[0] = caretRange.parentElement();
+ } catch (e) {
+ this.keyPressBackupRange();
+ }
+ } else if (GB.browser.msie || GB.browser.edge) {
+ this.keyPressBackupRange();
+ } else {
+ this.applyBogusClassName(caretRange);
+ }
+ }
+ },
+
+ applyBogusClassName : function (range) {
+ var node = range.commonAncestorContainer;
+ if (range.startOffset < 1 && (!node.lastChild || node.lastChild.nodeName.toLowerCase() !== 'br')) {
+ do {
+ if (node.parentNode.nodeName.toLowerCase() === 'body') {
+ break;
+ }
+ node = node.parentNode;
+ } while (GB.textFormatTags[node.nodeName.toLowerCase()]);
+
+ node = node.previousSibling;
+ if (node) {
+ while (node.firstChild) {
+ node = node.firstChild;
+ }
+ if (node.nodeType === GB.node.element && node.nodeName.toLowerCase() === 'br') {
+ node.className = this.cheditor.bogusSpacerName;
+ }
+ }
+ } else {
+ if (!node || node.nodeType !== GB.node.element) {
+ return;
+ }
+ if (node.lastChild
+ && node.lastChild.nodeName.toLowerCase() === 'br'
+ && node.lastChild.className !== this.cheditor.bogusSpacerName)
+ {
+ node.lastChild.className = this.cheditor.bogusSpacerName;
+ }
+ }
+ },
+
+ setWinPosition : function (oWin, popupAttr, windowSize) {
+ oWin.style.width = popupAttr.width + 'px';
+ oWin.style.left = Math.round(((this.cheditor.editArea.clientWidth - popupAttr.width) / 2) +
+ windowSize.offsetLeft) + 'px';
+ oWin.style.top = Math.round(windowSize.offsetTop) + 'px';
+ },
+
+ getWindowSize : function (doc) {
+ var mydoc = doc || document,
+ docMode = mydoc.compatMode === 'CSS1Compat',
+ docBody = mydoc.body,
+ docElem = mydoc.documentElement,
+ factor, rect, physicalWidth, logicalWidth,
+ editAreaRect,
+ rData = {
+ width: docMode ? docElem.clientWidth : docBody.clientWidth,
+ height: docMode ? docElem.clientHeight : docBody.clientHeight,
+ scrollHeight: docMode ? docElem.scrollHeight : docBody.scrollHeight,
+ scrollWidth: docMode ? docElem.scrollWidth : docBody.scrollWidth
+ };
+
+ if (this.undefined(window.pageXOffset)) {
+ factor = 1;
+ if (docBody.getBoundingClientRect) {
+ rect = docBody.getBoundingClientRect();
+ physicalWidth = rect.right - rect.left;
+ logicalWidth = mydoc.body.offsetWidth;
+ factor = Math.round ((physicalWidth / logicalWidth) * 100) / 100;
+ }
+ rData.scrollY = Math.round(docElem.scrollTop / factor);
+ rData.scrollX = Math.round(docElem.scrollLeft / factor);
+ } else {
+ rData.scrollY = window.pageYOffset;
+ rData.scrollX = window.pageXOffset;
+ }
+
+ editAreaRect = this.cheditor.editArea.getBoundingClientRect();
+ rData.clientTop = docElem.clientTop || docBody.clientTop || 0;
+ rData.clientLeft = docElem.clientLeft || docBody.clientLeft || 0;
+ rData.offsetTop = rData.scrollY + (rData.height / 2);
+ rData.offsetLeft = editAreaRect.left + rData.scrollX - rData.clientLeft;
+ return rData;
+ },
+
+ popupWinLoad : function (popupAttr) {
+ var self = this,
+ windowSize = self.getWindowSize(),
+ iframe = document.createElement('iframe'),
+ body = document.getElementsByTagName('body')[0],
+ done = false,
+
+ popWinResizeHeight = function (evt) {
+ iframe.contentWindow.focus();
+ iframe.contentWindow.init.call(self, iframe, popupAttr.argv || null);
+
+ if (self.cheditor.popupElem.style.visibility !== 'visible') {
+ self.cheditor.popupElem.style.top = Math.ceil(parseInt(self.cheditor.popupElem.style.top, 10) -
+ Math.ceil(self.cheditor.popupElem.clientHeight / 2)) + 'px';
+ self.cheditor.popupElem.style.visibility = 'visible';
+ }
+
+ self.stopEvent(evt);
+ },
+ modalResize = function () {
+ self.cheditor.modalBackground.style.height = (windowSize.scrollHeight > windowSize.height) ?
+ windowSize.scrollHeight : windowSize.height + 'px';
+
+ if (window.scrollWidth > window.width) {
+ self.cheditor.modalBackground.style.width = windowSize.width +
+ (windowSize.scrollWidth - windowSize.width) + 'px';
+ } else {
+ self.cheditor.modalBackground.style.width = windowSize.width + 'px';
+ }
+ self.cheditor.modalBackground.style.left = windowSize.scrollX + 'px';
+ },
+ onReadyStateChangeEventHandler = function (evt) {
+ if (!done && (!this.readyState || this.readyState === 'complete' || this.readyState === 'loaded')) {
+ popWinResizeHeight(evt);
+ done = true;
+ }
+ };
+
+ if (self.cheditor.popupTitle.hasChildNodes()) {
+ self.cheditor.popupTitle.removeChild(self.cheditor.popupTitle.firstChild);
+ }
+
+ if (self.cheditor.popupFrameWrapper.hasChildNodes()) {
+ self.cheditor.popupFrameWrapper.removeChild(self.cheditor.popupFrameWrapper.firstChild);
+ }
+
+ self.cheditor.popupTitle.appendChild(document.createTextNode(popupAttr.title));
+ self.cheditor.popupElem.style.zIndex = self.modalElementZIndex + 1;
+ self.setWinPosition(self.cheditor.popupElem, popupAttr, windowSize);
+
+ iframe.setAttribute('frameBorder', '0');
+ iframe.setAttribute('height', '0');
+ iframe.setAttribute('width', String(popupAttr.width - 22));
+ iframe.setAttribute('name', popupAttr.tmpl);
+ iframe.setAttribute('src', self.config.popupPath + popupAttr.tmpl);
+ iframe.id = popupAttr.tmpl;
+
+ self.cheditor.modalBackground.style.zIndex = self.modalElementZIndex;
+ body.insertBefore(self.cheditor.modalBackground, body.firstChild);
+ body.insertBefore(self.cheditor.popupElem, body.firstChild);
+
+ self.cheditor.popupFrameWrapper.appendChild(iframe);
+ self.cheditor.popupElem.style.visibility = 'hidden';
+ self.cheditor.popupElem.style.display = 'block';
+ self.cheditor.modalBackground.style.display = 'block';
+ GB.dragWindow.init(self.cheditor.dragHandle, self.cheditor.popupElem);
+
+ (function () {
+ if (GB.browser.msie && !(self.undefined(iframe.onreadystatechange))) {
+ iframe.onreadystatechange = onReadyStateChangeEventHandler;
+ } else {
+ iframe.onload = popWinResizeHeight;
+ }
+
+ if (GB.browser.msie && GB.browser.version < 9) {
+ window.onresize = function () {
+ windowSize = self.getWindowSize();
+ modalResize();
+ };
+ modalResize();
+ self.cheditor.modalBackground.style.filter = 'alpha(opacity=50)';
+ self.cheditor.modalBackground.style.opacity = 0.5;
+ } else {
+ self.cheditor.modalBackground.style.opacity = 0.5;
+ }
+ self.cheditor.modalBackground.focus();
+ })();
+ },
+
+ popupWinCancel : function () {
+ this.restoreRange();
+ this.popupWinClose();
+ },
+
+ popupWinClose : function () {
+ if (!this.cheditor.popupElem) {
+ return;
+ }
+ this.cheditor.popupElem.style.display = 'none';
+ this.cheditor.popupElem.style.zIndex = -1;
+ this.cheditor.popupFrameWrapper.src = '';
+
+ if (this.cheditor.popupFrameWrapper.hasChildNodes()) {
+ this.cheditor.popupFrameWrapper.removeChild(this.cheditor.popupFrameWrapper.firstChild);
+ }
+
+ this.cheditor.modalBackground.style.display = 'none';
+ this.cheditor.modalBackground.style.zIndex = -1;
+
+ if (this.modalReSize !== null) {
+ if (GB.browser.opera) {
+ window.removeEventListener('resize', this.modaReSize, false);
+ }
+ this.modalReSize = null;
+ }
+ this.editAreaFocus();
+ },
+
+ clearStoredSelections : function () {
+ this.storedSelections.splice(0, this.storedSelections.length);
+ },
+
+ restoreRange : function () {
+ var range = null, selection = null;
+ if (this.storedSelections[0]) {
+ if (this.W3CRange) {
+ selection = this.getSelection();
+ if (selection.rangeCount > 0) {
+ selection.removeAllRanges();
+ }
+ selection.addRange(this.storedSelections[0]);
+ range = selection.getRangeAt(0);
+ } else {
+ range = this.createRange();
+ if (this.storedSelections[0]) {
+ if (typeof this.storedSelections[0] === 'string') {
+ range.moveToBookmark(this.storedSelections[0]);
+ } else {
+ range = this.storedSelections[0];
+ }
+ }
+ range.select();
+ }
+ }
+ return range;
+ },
+
+ keyPressBackupRange : function (range) {
+ var selection = null, i;
+ if (this.W3CRange) {
+ selection = this.getSelection();
+ if (selection) {
+ for (i = 0; i < selection.rangeCount; i++) {
+ this.keyPressStoredSelections.push(selection.getRangeAt(i));
+ }
+ }
+ } else {
+ range = range || this.getRange();
+ switch (this.getSelectionType()) {
+ case GB.selection.none:
+ case GB.selection.text:
+ this.storedSelections[0] = range.getBookmark();
+ break;
+ case GB.selection.element:
+ this.storedSelections[0] = range;
+ break;
+ default:
+ this.storedSelections[0] = null;
+ }
+ }
+ },
+
+ backupRange : function (range) {
+ var selection = null;
+ if (this.W3CRange) {
+ selection = this.getSelection();
+ if (selection && selection.rangeCount > 0) {
+ this.storedSelections[0] = selection.getRangeAt(0);
+ }
+ } else {
+ range = range || this.getRange();
+ switch (this.getSelectionType()) {
+ case GB.selection.none:
+ case GB.selection.text:
+ this.storedSelections[0] = range.getBookmark();
+ break;
+ case GB.selection.element:
+ this.storedSelections[0] = range;
+ break;
+ default:
+ this.storedSelections[0] = null;
+ }
+ }
+ },
+
+ getSelection : function () {
+ return this.W3CRange ? this.editArea.getSelection() : this.doc.selection;
+ },
+
+ clearSelection : function () {
+ var sel = this.getSelection();
+ if (!sel) {
+ return;
+ }
+ if (this.W3CRange) {
+ sel.removeAllRanges();
+ } else {
+ sel.empty();
+ }
+ return sel;
+ },
+
+ getRange : function () {
+ var selection = this.getSelection(), range = null;
+ if (this.W3CRange) {
+ if (selection.getRangeAt) {
+ range = selection.rangeCount ? selection.getRangeAt(0) : this.doc.createRange();
+ } else {
+ range = this.doc.createRange();
+ range.setStart(selection.anchorNode, selection.anchorOffset);
+ range.setEnd(selection.focusNode, selection.focusOffset);
+ if (range.collapsed !== selection.isCollapsed) {
+ range.setStart(selection.focusNode, selection.focusOffset);
+ range.setEnd(selection.anchorNode, selection.anchorOffset);
+ }
+ }
+ } else {
+ range = selection.createRange ? selection.createRange() : this.doc.createRange();
+ if (!range) {
+ range = this.doc.body.createTextRange();
+ }
+ }
+ this.range = range;
+ return range;
+ },
+
+ createRange : function () {
+ return this.W3CRange ? this.doc.createRange() : this.doc.body.createTextRange();
+ },
+
+ rangeCollapsed : function (range) {
+ return this.W3CRange ?
+ range.collapsed :
+ (!this.undefined(range.text) && range.text.length === 0 && range.boundingWidth === 0);
+ },
+
+ getRangeElement : function (range) {
+ return this.W3CRange ? this.getW3CRangeElement(range) : this.getIeRangeElement(range);
+ },
+
+ getIeRangeElement : function (range) {
+ var sType = this.getSelectionType(),
+ node;
+
+ if (!range) {
+ range = this.createRange();
+ }
+
+ switch (sType) {
+ case GB.selection.text :
+ node = range.parentElement();
+ break;
+ case GB.selection.element :
+ node = range.item(0);
+ break;
+ case GB.selection.none :
+ if (!this.undefined(range.parentElement)) {
+ node = range.parentElement();
+ } else {
+ node = range.item(0);
+ }
+ }
+ return node;
+ },
+
+ getW3CRangeElement : function (range) {
+ var ancestorContainer = range.commonAncestorContainer,
+ startContainer = range.startContainer,
+ startOffset = range.startOffset,
+ endContainer = range.endContainer,
+ endOffset = range.endOffset,
+ docFragment = null, node = startContainer;
+
+ if (GB.browser.msie || GB.browser.edge) {
+ if (!range.collapsed && ancestorContainer.nodeType === GB.node.element) {
+ if (ancestorContainer === endContainer) {
+ node = ancestorContainer.childNodes[endOffset - 1];
+ } else if (ancestorContainer === startContainer) {
+ node = ancestorContainer.childNodes[startOffset];
+ } else {
+ docFragment = range.cloneContents();
+ node = (docFragment.childNodes.length === 1) ? startContainer.nextSibling : ancestorContainer;
+ }
+ }
+ } else {
+ if (!range.collapsed
+ && startContainer.nodeType === GB.node.element
+ && startContainer === endContainer
+ && endOffset - startOffset === 1
+ && startContainer.hasChildNodes())
+ {
+ node = startContainer.childNodes[startOffset];
+ }
+ }
+
+ if (node.nodeType === GB.node.text) {
+ node = node.parentNode;
+ }
+ return node;
+ },
+
+ getSelectionType : function () {
+ var selection = this.getSelection(), type;
+
+ if (this.W3CRange) {
+ if (!selection) {
+ type = GB.selection.none;
+ } else if (selection.rangeCount && !selection.isCollapsed && !selection.toString()) {
+ type = GB.selection.element;
+ } else {
+ type = GB.selection.text;
+ }
+ } else {
+ switch (selection.type) {
+ case 'Text' : type = GB.selection.text; break;
+ case 'Control' : type = GB.selection.element; break;
+ default : type = GB.selection.none;
+ }
+ if (selection.createRange().parentElement) {
+ type = GB.selection.text;
+ }
+ }
+ return type;
+ },
+
+ windowOpen : function (popupName) {
+ this.editAreaFocus();
+ this.boxHideAll();
+ this.backupRange();
+ if (!(this.undefined(GB.popupWindow[popupName]))) {
+ var popup = GB.popupWindow[popupName];
+ if (popupName === 'ImageUpload' && window.File && window.FileReader && window.FileList && window.Blob) {
+ popup.tmpl = 'image.html5.html';
+ }
+ this.popupWinLoad(popup);
+ } else {
+ alert('사용할 수 없는 명령입니다.');
+ }
+ },
+
+ doCmd : function (cmd, opt) {
+ var self = this, range = this.range,
+ i, keyboard = '', command = '', pNode, node, tmpframe, tmpdoc, html, content,
+ hr, newHr, para, next = null, nNode, tagName, style, id, hRule, nodeType, css, found = false,
+ isEmpty = false, selectionType, selection, nodeRange,
+ cleanPaste = function () {
+ self.editAreaFocus();
+ var tmpDoc = self.cheditor.tmpdoc;
+ tmpDoc.execCommand('SelectAll');
+ tmpDoc.execCommand('Paste');
+ return self.cleanFromWord(tmpDoc);
+ },
+ isTextVisible = function (elem) {
+ return (!(elem.firstChild.nodeType === GB.node.text && elem.firstChild === elem.lastChild &&
+ elem.firstChild.nodeValue === ''));
+ };
+
+ this.editAreaFocus();
+ this.boxHideAll();
+
+ if (!range) {
+ return;
+ }
+
+ if (cmd === 'NewDocument') {
+ if (confirm('글 내용이 모두 사라집니다. 계속하시겠습니까?')) {
+ this.doc.body.innerHTML = '';
+ }
+ this.images = [];
+ this.editImages = {};
+ this.editAreaFocus();
+ this.toolbarUpdate();
+ this.initDefaultParagraphSeparator();
+ return;
+ }
+
+ if (cmd === 'ClearTag') {
+ if (confirm('모든 HTML 태그를 삭제합니다. 계속하시겠습니까?\n(P, DIV, BR 태그와 텍스트는 삭제하지 않습니다.)')) {
+ content = this.doc.body.innerHTML;
+ this.doc.body.innerHTML = content.replace(/<(\/?)([^>]*)>/g,
+ function (a, b, c) {
+ var el = c.toLowerCase().split(/ /)[0];
+ if (el !== 'p' && el !== 'div' && el !== 'br') {
+ return '';
+ }
+ return '<' + b + el + '>';
+ });
+ }
+ this.editAreaFocus();
+ this.toolbarUpdate();
+ return;
+ }
+
+ if (cmd === 'Print') {
+ this.editArea.print();
+ return;
+ }
+
+ if (cmd === 'PageBreak') {
+ this.printPageBreak();
+ this.editAreaFocus();
+ return;
+ }
+
+ selectionType = this.getSelectionType();
+ if (this.W3CRange || selectionType === GB.selection.none) {
+ range = this.doc;
+ }
+
+ if (!GB.browser.msie && (cmd === 'Cut' || cmd === 'Copy' || cmd === 'Paste')) {
+ if ((range.execCommand(cmd, false, opt)) !== true) {
+ switch (cmd) {
+ case 'Cut' : keyboard = 'x'; command = '자르기'; break;
+ case 'Copy' : keyboard = 'c'; command = '복사'; break;
+ case 'Paste': keyboard = 'v'; command = '붙이기'; break;
+ }
+ alert('사용하고 계신 브라우저는 보안 상의 이유로 \'' + command + '\' 명령을 사용하실 수 없습니다. \n\n' +
+ '키보드 단축키를 이용하여 주십시오.\n단축키: Windows: Ctrl+' + keyboard + ', Mac OS X: Command+' + keyboard);
+ this.editAreaFocus();
+
+ }
+ return;
+ }
+
+ try {
+ if (cmd === 'PasteFromWord') {
+ if (this.undefined(this.cheditor.tmpdoc)) {
+ tmpframe = this.doc.createElement('iframe');
+ tmpframe.setAttribute('contentEditable', 'true');
+ tmpframe.style.visibility = 'hidden';
+ tmpframe.style.height = tmpframe.style.width = '0px';
+ tmpframe.setAttribute('frameBorder', '0');
+ this.cheditor.editWrapper.appendChild(tmpframe);
+
+ tmpdoc = tmpframe.contentWindow.document;
+ tmpdoc.designMode = 'On';
+ tmpdoc.open();
+ tmpdoc.close();
+ this.cheditor.tmpdoc = tmpdoc;
+ }
+
+ if (this.W3CRange) {
+ html = cleanPaste();
+ // range = this.restoreRange();
+ this.insertNodeAtSelection(html);
+ } else {
+ range = this.getRange();
+ range.pasteHTML(cleanPaste());
+ range.select();
+ }
+ } else if (cmd === 'Paste') {
+ this.cheditor.paste = 'text';
+ this.handlePaste(null);
+ this.cheditor.paste = 'html';
+ } else if (cmd === 'InsertHorizontalRule') {
+ hr = this.doc.createElement('hr');
+ hr.style.height = '1px';
+ hr.style.backgroundColor = '#999';
+ hr.style.border = 'none';
+
+ this.unselectionElement(hr);
+ range = this.getRange();
+
+ if (this.W3CRange) {
+ range.insertNode(hr);
+ } else {
+ nodeType = this.getSelectionType();
+ id = this.makeRandomString();
+ range.execCommand('InsertHorizontalRule', false, id);
+ switch (nodeType) {
+ case GB.selection.none :
+ case GB.selection.text :
+ node = range.parentElement();
+ break;
+ case GB.selection.element :
+ node = range.item(0);
+ break;
+ default :
+ return;
+ }
+ newHr = this.$(id);
+ newHr.parentNode.replaceChild(hr, newHr);
+ }
+
+ hRule = hr;
+ pNode = hRule.parentNode;
+ para = this.makeSpacerElement();
+
+ while (pNode && GB.textFormatTags[pNode.nodeName.toLowerCase()]) {
+ pNode = pNode.parentNode;
+ }
+
+ tagName = pNode.tagName.toLowerCase();
+ if (GB.textFormatBlockTags[tagName]) {
+ if (hr.nextSibling) {
+ next = this.doc.createElement(tagName);
+ pNode.parentNode.insertBefore(next, pNode.nextSibling);
+ while (hr.nextSibling) {
+ if (hr.nextSibling.nodeType === GB.node.text && hr.nextSibling.nodeValue === '') {
+ hr = hr.nextSibling;
+ continue;
+ }
+ if (hr.nextSibling.parentNode !== pNode) {
+ node = hr.nextSibling.parentNode;
+ while (node !== pNode && GB.textFormatTags[node.nodeName.toLowerCase()]) {
+ nNode = this.doc.createElement(node.nodeName);
+ style = this.getCssValue(node);
+ if (style) {
+ for (i = 0; i < style.length; i++) {
+ nNode.style[style[i].name] = style[i].value;
+ }
+ }
+ if (next.hasChildNodes() === false) {
+ next.appendChild(nNode);
+ while (hr.nextSibling) {
+ nNode.appendChild(hr.nextSibling);
+ }
+ } else {
+ next.appendChild(nNode);
+ nNode.appendChild(next.firstChild);
+ }
+ node = node.parentNode;
+ }
+ } else {
+ next.appendChild(hr.nextSibling);
+ }
+ }
+ }
+ node = hr.parentNode;
+ pNode.parentNode.insertBefore(hRule, pNode.nextSibling);
+
+ while (node && node !== pNode) {
+ if (node.hasChildNodes() === false || (isTextVisible(node)) === false) {
+ nNode = node.parentNode;
+ node.parentNode.removeChild(node);
+ node = nNode;
+ continue;
+ }
+ node = node.parentNode;
+ }
+
+ if (pNode.hasChildNodes() === false || (isTextVisible(pNode)) === false) {
+ pNode.parentNode.replaceChild(para.cloneNode(true), pNode);
+ }
+ if (next === null || next.hasChildNodes() === false) {
+ hRule.parentNode.insertBefore(para.cloneNode(true), hRule.nextSibling);
+ }
+
+ node = hRule.nextSibling;
+ while (node.firstChild) {
+ node = node.firstChild;
+ }
+ if (node && node.nodeType !== GB.node.text) {
+ node = node.parentNode;
+ }
+ this.placeCaretAt(this.W3CRange ? node : hRule.nextSibling, true);
+ } else {
+ if (!hRule.previousSibling) {
+ hRule.parentNode.insertBefore(para.cloneNode(true), hRule);
+ }
+ if (!hRule.nextSibling) {
+ hRule.parentNode.insertBefore(para.cloneNode(true), hRule.nextSibling);
+ }
+ this.placeCaretAt(hRule.nextSibling, hRule.nextSibling.nodeType === GB.node.text);
+ }
+ } else {
+ switch (cmd) {
+ case 'JustifyLeft' :
+ case 'JustifyCenter' :
+ case 'JustifyRight' :
+ case 'JustifyFull' :
+ pNode = this.getRangeElement(this.range);
+ node = null;
+
+ if (GB.offElementTags[pNode.nodeName.toLowerCase()]) {
+ nodeRange = this.createRange();
+ selection = this.clearSelection();
+ if (this.W3CRange) {
+ nodeRange.selectNode(pNode);
+ selection.addRange(nodeRange);
+ } else {
+ nodeRange.moveToElementText(pNode);
+ nodeRange.select();
+ range = nodeRange;
+ }
+ }
+ // Caption
+ if (pNode.nodeName.toLowerCase() === 'img') {
+ if (pNode.parentNode.nodeName.toLowerCase() === 'figure') {
+ node = pNode.parentNode;
+ if (node.parentNode.nodeName.toLowerCase() === 'div') {
+ node = node.parentNode;
+ node.style.textAlign = GB.textAlign[cmd];
+ break;
+ }
+ }
+ } else if (pNode.nodeName.toLowerCase() === 'figure') {
+ node = pNode.parentNode;
+ if (node.nodeName.toLowerCase() === 'div') {
+ node.style.textAlign = GB.textAlign[cmd];
+ break;
+ }
+ }
+
+ do {
+ if (pNode.nodeName.toLowerCase() === 'li') {
+ node = pNode;
+ break;
+ }
+ pNode = pNode.parentNode;
+ } while (pNode && pNode.nodeName.toLowerCase() !== 'body');
+
+
+ if (node) {
+ node.style.textAlign = GB.textAlign[cmd];
+ break;
+ }
+
+ range.execCommand(cmd, false, opt);
+ pNode = this.getRangeElement(this.W3CRange ? this.getRange() : range);
+
+ while (pNode && pNode.nodeName.toLowerCase() !== 'body') {
+ if (typeof pNode.getAttribute !== 'undefined' && pNode.getAttribute('align')) {
+ node = pNode;
+ break;
+ } else {
+ css = this.getCssValue(pNode);
+ if (css) {
+ for (i = 0; i < css.length; i++) {
+ if (css[i].name === 'text-align') {
+ node = pNode;
+ break;
+ }
+ }
+ }
+ }
+ pNode = pNode.parentNode;
+ }
+
+ if (node) {
+ pNode.style.textAlign = GB.textAlign[cmd];
+ pNode.removeAttribute('align');
+ break;
+ }
+ break;
+ case 'InsertOrderedList' :
+ case 'InsertUnOrderedList' :
+ range.execCommand(cmd, false, opt);
+ if (this.W3CRange) {
+ range = this.getRange();
+ node = range.commonAncestorContainer;
+ if (node.nodeType === GB.node.element && node.lastChild &&
+ node.lastChild.nodeName.toLowerCase() === 'br') {
+ node.lastChild.className = this.cheditor.bogusSpacerName;
+ isEmpty = true;
+ }
+ found = false;
+ while (node) {
+ if (node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol') {
+ found = true;
+ break;
+ }
+ node = node.parentNode;
+ }
+ if (found) {
+ node.style.listStyleType = '';
+ if (!GB.browser.msie) {
+ if (node.parentNode.nodeName.toLowerCase() === 'p' ||
+ node.parentNode.nodeName.toLowerCase() === 'div') {
+ pNode = node.parentNode;
+ if (pNode.lastChild && pNode.lastChild.nodeName.toLowerCase() === 'br') {
+ pNode.removeChild(pNode.lastChild);
+ }
+ if (pNode.firstChild === node && pNode.lastChild === node) {
+ pNode.parentNode.insertBefore(node, pNode);
+ pNode.parentNode.removeChild(pNode);
+ this.placeCaretAt(node.lastChild, isEmpty);
+ }
+ }
+ }
+ }
+ }
+ break;
+ default :
+ if (range.queryCommandSupported(cmd)) {
+ range.execCommand(cmd, false, opt);
+ }
+ }
+ }
+ } catch (e) {
+ alert(cmd + ': 지원되지 않는 명령입니다. ' + e.toString());
+ }
+
+ this.toolbarUpdate();
+ },
+
+ cleanFromWord : function (tmpDoc) {
+ var doc = tmpDoc.body.innerHTML;
+ doc = doc.replace(/MsoNormal/g, ''); doc = doc.replace(/<\\?\?xml[^>]*>/g, ''); doc = doc.replace(/<\/?o:p[^>]*>/g, '');
+ doc = doc.replace(/<\/?v:[^>]*>/g, ''); doc = doc.replace(/<\/?o:[^>]*>/g, ''); doc = doc.replace(/<\/?st1:[^>]*>/g, '');
+ doc = doc.replace(//g, ''); doc = doc.replace(//g, '');
+ doc = doc.replace(/<\\?\?xml[^>]*>/g, ''); doc = doc.replace(/<\/?o:p[^>]*>/g, ''); doc = doc.replace(/<\/?v:[^>]*>/g, '');
+ doc = doc.replace(/<\/?o:[^>]*>/g, ''); doc = doc.replace(/<\/?st1:[^>]*>/g, ''); //doc = doc.replace(/lang=.?[^' >]*/ig, '');
+ doc = doc.replace(/type=.?[^' >]*/g, ''); doc = doc.replace(/href='#[^']*'/g, ''); doc = doc.replace(/href='#[^']*'/g, '');
+ doc = doc.replace(/name=.?[^' >]*/g, ''); doc = doc.replace(/ clear='all'/g, ''); doc = doc.replace(/id='[^']*'/g, '');
+ doc = doc.replace(/title='[^']*'/g, ''); doc = doc.replace(/\n/g, ''); doc = doc.replace(/\r/g, '');
+ doc = doc.replace(/mso\-[^'>;]*/g, ''); doc = doc.replace(/]*/ig, '
]*<\/span>/ig, '');
+ return doc;
+ },
+
+ printPageBreak : function () {
+ var hr = document.createElement('hr'),
+ div = this.doc.createElement('div');
+ hr.style.pageBreakAfter = 'always';
+ hr.style.border = '1px #999 dotted';
+ this.insertHTML(hr);
+ div.appendChild(this.doc.createTextNode('\u00a0'));
+ this.insertHTML(div);
+ },
+
+ doCmdPaste : function (html) {
+ var range = null;
+ this.editAreaFocus();
+ if (!this.W3CRange) {
+ if (this.range.item) {
+ range = this.doc.body.createTextRange();
+ if (range) {
+ range.moveToElementText(this.range.item(0));
+ range.select();
+ this.range.item(0).outerHTML = html;
+ }
+ this.toolbarUpdate();
+ } else {
+ this.range.pasteHTML(html);
+ this.range.select();
+ }
+ } else {
+ this.insertNodeAtSelection(html);
+ }
+ },
+
+ getPreviousLeaf : function (node) {
+ var leaf;
+ while (!node.previousSibling) {
+ node = node.parentNode;
+ if (!node) {
+ return node;
+ }
+ }
+ leaf = node.previousSibling;
+ while (leaf.lastChild) {
+ leaf = leaf.lastChild;
+ }
+ return leaf;
+ },
+
+ getNextLeaf : function (node, breakNode) {
+ var leaf;
+ while (!node.nextSibling) {
+ node = node.parentNode;
+ if ((breakNode && breakNode === node) || !node) {
+ return node;
+ }
+ }
+ leaf = node.nextSibling;
+ if (breakNode && leaf === breakNode) {
+ return node;
+ }
+ while (leaf.firstChild) {
+ leaf = leaf.firstChild;
+ }
+ return leaf;
+ },
+
+ isTextVisible : function (text) {
+ var i, found = false, len = text.length;
+ for (i = 0; i < len; i++) {
+ if (text.charAt(i) !== ' ' && text.charAt(i) !== '\t' && text.charAt(i) !== '\r' && text.charAt(i) !== '\n') {
+ found = true;
+ break;
+ }
+ }
+ return found;
+ },
+
+ checkCssValue : function (elem, prop) {
+ var css = this.getCssValue(elem), i;
+ if (!css) {
+ return null;
+ }
+ for (i = 0; i < css.length; i++) {
+ if (css[i].name === prop) {
+ return css[i];
+ }
+ }
+ return null;
+ },
+
+ getCssValue : function (elem) {
+ var i, q, style = [], len, css;
+
+ css = elem.getAttribute('style');
+ if (!css) {
+ return null;
+ }
+ if (typeof css === 'object') {
+ css = css.cssText;
+ }
+ if (this.trimSpace(css) === '') {
+ return null;
+ }
+
+ css = css.replace(/;$/, '').split(';');
+ len = css.length;
+
+ for (i = 0; i < len; i++) {
+ q = css[i].split(':');
+ style.push({'name': this.trimSpace(q[0]).toLowerCase(), 'value': this.trimSpace(q[1]).toLowerCase()});
+ }
+ return style;
+ },
+
+ makeFontCss : function (cmd, opt, elem) {
+ switch (cmd) {
+ case 'font-size' : elem.style.fontSize = opt; break;
+ case 'font-family' : elem.style.fontFamily = opt; break;
+ case 'color': elem.style.color = opt; break;
+ case 'background-color': elem.style.backgroundColor = opt; break;
+ }
+ },
+
+ insertStartEndNode : function (range) {
+ var startNode = this.doc.createElement('span'),
+ startRange, endRange, endNode, collapsed, node = null;
+
+ startNode.id = 'startNode';
+
+ if (!this.W3CRange) {
+ startNode.appendChild(this.doc.createTextNode('\u200b'));
+ try {
+ endRange = range.duplicate();
+ startRange = range.duplicate();
+ endRange.collapse(false);
+ startRange.collapse(true);
+ } catch (e) {
+ node = this.getRangeElement(range);
+ if (node.nodeType === GB.node.element) {
+
+ } else {
+ return null;
+ }
+ }
+
+ endNode = startNode.cloneNode(true);
+ endNode.id = 'endNode';
+
+ if (node) {
+ node.parentNode.insertBefore(startNode, node);
+ node.parentNode.insertBefore(endNode, node.nextSibling);
+ collapsed = false;
+ } else {
+ collapsed = startRange.isEqual(endRange);
+ endRange.pasteHTML(endNode.outerHTML);
+ endRange.moveStart('character', -1);
+ endNode = endRange.parentElement();
+
+ if (collapsed || range.text.length === 0) {
+ endNode.parentNode.insertBefore(startNode, endNode);
+ } else {
+ startNode = endNode.cloneNode(true);
+ startNode.id = 'startNode';
+ startRange.pasteHTML(startNode.outerHTML);
+ startRange.moveStart('character', -1);
+ startNode = startRange.parentElement();
+ }
+ }
+ endRange = null;
+ startRange = null;
+ } else {
+ endRange = range.cloneRange();
+ startRange = range.cloneRange();
+ startRange.collapse(true);
+
+ endRange.collapse(false);
+ endNode = startNode.cloneNode(false);
+ endNode.id = 'endNode';
+
+ collapsed = range.collapsed;
+ if (collapsed) {
+ endRange.insertNode(endNode);
+ endNode.parentNode.insertBefore(startNode, endNode);
+ } else {
+ endRange.insertNode(endNode);
+ startRange.insertNode(startNode);
+ }
+
+ if (startNode.previousSibling && startNode.previousSibling.nodeType === GB.node.text &&
+ startNode.previousSibling.nodeValue === '') {
+ startNode.previousSibling.parentNode.removeChild(startNode.previousSibling);
+ }
+ if (endNode.nextSibling && endNode.nextSibling.nodeType === GB.node.text &&
+ endNode.nextSibling.nodeValue === '') {
+ endNode.nextSibling.parentNode.removeChild(endNode.nextSibling);
+ }
+ startRange.detach(); endRange.detach();
+ endRange = null; startRange = null;
+ }
+ return {startNode: startNode, endNode: endNode, collapsed: collapsed};
+ },
+
+ removeStartEndNode : function (nodes) {
+ if (nodes.startNode) {
+ nodes.startNode.parentNode.removeChild(nodes.startNode);
+ }
+ if (nodes.endNode) {
+ nodes.endNode.parentNode.removeChild(nodes.endNode);
+ }
+ },
+
+ clearCss : function (node, name) {
+ var i, css, styles = [];
+
+ if (!node || node.nodeType !== GB.node.element) {
+ return null;
+ }
+
+ css = this.getCssValue(node);
+ if (!css) {
+ return null;
+ }
+
+ node.removeAttribute('style');
+ for (i = 0; i < css.length; i++) {
+ if (css[i].name !== name) {
+ node.style[css[i].name] = css[i].value;
+ styles.push(css[i]);
+ }
+ }
+
+ return styles.length ? styles : null;
+ },
+
+ doCmdPopup : function (cmd, opt, checked) {
+ var self = this,
+ range, cursor, selectionType, pNode, node, found, isEmpty, span, endNode, startNode, i, endNodeAncestorRange,
+ startNodeRange, endNodeRange, compare, tNode, len, selection, child, css, tempNodes, endNodeAncestor,
+ backupRange, removeNodes = [], spanNodes = [], applyTextNodes = [], tailNodes = [], headNodes = [], rootNode = null,
+ zeroWidth = this.doc.createTextNode('\u200b'), inRange,
+
+ makeSpanText = function (elem, ancestor) {
+ if (self.undefined(ancestor)) {
+ ancestor = elem.parentNode;
+ }
+ span = self.doc.createElement('span');
+ self.makeFontCss(cmd, opt, span);
+ ancestor.insertBefore(span, elem);
+ span.appendChild(elem);
+ spanNodes.push(span);
+ return span;
+ },
+ searchTextNode = function (node, match) {
+ var i = 0, len = node.childNodes.length;
+ for (; i < len; i++) {
+ child = node.childNodes[i];
+ match = searchTextNode(child, match);
+ if (child === startNode) {
+ break;
+ }
+ if (child.nodeType === GB.node.text) {
+ match = true;
+ break;
+ }
+ if (child.nodeType === GB.node.element && child.hasChildNodes() === false &&
+ GB.textFormatTags[child.nodeName.toLowerCase()]) {
+ removeNodes.push(child);
+ }
+ }
+ return match;
+ },
+ compareBoundaryPoints = function (range, type, source) {
+ var values = {
+ 'StartToStart': 0, //Range.START_TO_START,
+ 'StartToEnd': 1, //Range.START_TO_END,
+ 'EndToEnd': 2, //Range.END_TO_END,
+ 'EndToStart': 3 //Range.END_TO_START
+ };
+
+ if (self.W3CRange) {
+ return range.compareBoundaryPoints(values[type], source);
+ }
+
+ type = type === 'StartToEnd' ? 'EndToStart' : (type === 'EndToStart' ? 'StartToEnd' : type);
+ return range.compareEndPoints(type, source);
+ },
+ rangeSelectNode = function (range, node) {
+ if (self.W3CRange) {
+ range.selectNode(node);
+ } else {
+ if (node.nodeType === GB.node.text) {
+ node = node.parentNode;
+ }
+ range.moveToElementText(node);
+ }
+ },
+ clearPreviousLeaf = function (node) {
+ var leaf, css = [];
+ while (!node.previousSibling) {
+ node = node.parentNode;
+ if (!node || node.nodeName.toLowerCase() === 'body') {
+ return null;
+ }
+ }
+
+ leaf = node.previousSibling;
+
+ while (leaf.lastChild && leaf.nodeType === GB.node.element && leaf !== startNode) {
+ rangeSelectNode(cursor, leaf);
+ compare = compareBoundaryPoints(cursor, 'StartToStart', startNodeRange);
+ if (compare === 1) {
+ css = self.clearCss(leaf, cmd);
+ if (!css && (leaf.nodeName.toLowerCase() === 'span' || leaf.nodeName.toLowerCase() === 'font')) {
+ while (leaf.firstChild) {
+ leaf.parentNode.insertBefore(leaf.firstChild, leaf);
+ }
+ removeNodes.push(leaf);
+ break;
+ }
+ } else if (compare === 0) {
+ self.clearCss(leaf, cmd);
+ if (!rootNode && leaf.nodeName.toLowerCase() === 'span') {
+ rootNode = leaf;
+ }
+ } else { // -1
+ node = startNode;
+ found = false;
+ while (node) {
+ if (node.nodeType === GB.node.text) {
+ found = true;
+ break;
+ }
+ node = checkPreviousLeaf(node, leaf);
+ }
+ if (!found) {
+ self.clearCss(leaf, cmd);
+ if (!rootNode && leaf.nodeName.toLowerCase() === 'span') {
+ rootNode = leaf;
+ }
+ }
+ }
+
+ leaf = leaf.lastChild;
+ }
+
+ if (leaf.nodeType === GB.node.text && self.isTextVisible(leaf.nodeValue)) {
+ applyTextNodes.push(leaf);
+ }
+
+ return leaf;
+ },
+ checkPreviousLeaf = function (node, breakNode) {
+ var leaf;
+ while (!node.previousSibling) {
+ node = node.parentNode;
+ if (node === breakNode || node.nodeName.toLowerCase() === 'body') {
+ return null;
+ }
+ }
+ leaf = node.previousSibling;
+ while (leaf.lastChild) {
+ leaf = leaf.lastChild;
+ }
+ return leaf;
+ },
+ checkInRange = function (range, source) {
+ return (typeof range.inRange !== 'undefined') ? range.inRange(source) :
+ (compareBoundaryPoints(range, 'StartToStart', source) < 1
+ && compareBoundaryPoints(range, 'EndToEnd', source) > -1);
+ },
+ checkNextLeaf = function (node) {
+ var leaf, inRange;
+ while (!node.nextSibling) {
+ node = node.parentNode;
+
+ if (!node || node.nodeName.toLowerCase() === 'body') {
+ return null;
+ }
+
+ rangeSelectNode(cursor, node);
+ inRange = checkInRange(cursor, endNodeRange);
+ if (inRange) {
+ inRange = checkInRange(cursor, startNodeRange);
+ if (!inRange) {
+ tailNodes.push(node);
+ } else {
+ headNodes.push(node);
+ }
+ }
+
+ if (node === endNodeAncestor) {
+ return null;
+ }
+ }
+
+ leaf = node.nextSibling;
+ if (leaf.nodeType === GB.node.text || !endNodeAncestor) {
+ return null;
+ }
+
+ rangeSelectNode(cursor, leaf);
+ inRange = checkInRange(endNodeAncestorRange, cursor);
+ if (!inRange) {
+ return null;
+ }
+
+ while (leaf.firstChild) {
+ leaf = leaf.firstChild;
+ }
+
+ if (leaf.nodeType === GB.node.text) {
+ tailNodes = [];
+ return null;
+ }
+ return leaf;
+ },
+ checkParentSpan = function (node) {
+ var len = spanNodes.length, i = 0;
+ for (; i < len; i++) {
+ if (spanNodes[i] === node) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ this.editAreaFocus();
+
+ backupRange = this.restoreRange();
+ selectionType = this.getSelectionType();
+
+ if (this.W3CRange) {
+ range = this.doc;
+ } else {
+ range = (selectionType === GB.selection.none) ? this.doc : backupRange;
+ }
+
+ try {
+ if (cmd === 'LineHeight') {
+ this.applyLineHeight(opt);
+ } else {
+ if (cmd === 'InsertOrderedList' || cmd === 'InsertUnOrderedList') {
+ if (checked !== true) {
+ range.execCommand(cmd, false, opt);
+ if (!GB.browser.msie) {
+ range = this.getRange();
+ node = range.commonAncestorContainer;
+ found = isEmpty = false;
+
+ if (node.nodeType === GB.node.element && node.lastChild &&
+ node.lastChild.nodeName.toLowerCase() === 'br') {
+ node.lastChild.className = this.cheditor.bogusSpacerName;
+ isEmpty = true;
+ }
+ while (node) {
+ if (node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol') {
+ found = true;
+ break;
+ }
+ node = node.parentNode;
+ }
+
+ if (found) {
+ if (node.parentNode.nodeName.toLowerCase() === 'p' ||
+ node.parentNode.nodeName.toLowerCase() === 'div') {
+ pNode = node.parentNode;
+ if (pNode.lastChild && pNode.lastChild.nodeName.toLowerCase() === 'br') {
+ pNode.removeChild(pNode.lastChild);
+ }
+ if (pNode.firstChild === node && pNode.lastChild === node) {
+ pNode.parentNode.insertBefore(node, pNode);
+ pNode.parentNode.removeChild(pNode);
+ this.placeCaretAt(node.lastChild, isEmpty);
+ }
+ }
+ }
+ }
+ }
+ cursor = this.getRange();
+ pNode = this.W3CRange ? cursor.commonAncestorContainer : cursor.parentElement();
+ if (pNode.nodeType === GB.node.text) {
+ pNode = pNode.parentNode;
+ }
+ while (pNode) {
+ if (pNode.nodeName.toLowerCase() === 'ol' || pNode.nodeName.toLowerCase() === 'ul') {
+ if (opt === 'desc' || opt === 'decimal') {
+ opt = '';
+ }
+ pNode.style.listStyleType = opt;
+ break;
+ }
+ pNode = pNode.parentNode;
+ }
+ } else if (cmd === 'FontSize' || cmd === 'FontName' || cmd === 'ForeColor' || cmd === 'BackColor') {
+ if (cmd === 'ForeColor' || cmd === 'BackColor') {
+ opt = this.colorConvert(opt, 'hex');
+ } else if (cmd === 'FontName' && opt === '맑은 고딕') {
+ opt += ', "Malgun Gothic"';
+ }
+
+ cmd = GB.fontStyle[cmd];
+
+ range = this.getRange();
+ tempNodes = this.insertStartEndNode(range);
+ startNode = tempNodes.startNode;
+ endNode = tempNodes.endNode;
+
+ cursor = this.createRange();
+ startNodeRange = this.createRange();
+ rangeSelectNode(startNodeRange, startNode);
+
+ endNodeRange = this.createRange();
+ endNodeAncestorRange = this.createRange();
+
+ if (!tempNodes.collapsed) {
+ tailNodes = [];
+ endNodeAncestor = null;
+ rangeSelectNode(endNodeRange, endNode);
+ node = endNode.parentNode;
+
+ while (node && node.nodeName.toLowerCase() !== 'body') {
+ endNodeAncestor = node;
+ node = node.parentNode;
+ }
+
+ if (endNodeAncestor) {
+ rangeSelectNode(endNodeAncestorRange, endNodeAncestor);
+ }
+
+ node = endNode;
+ while (node) {
+ node = checkNextLeaf(node);
+ }
+
+ for (i = 0; i < tailNodes.length; i++) {
+ this.clearCss(tailNodes[i], cmd);
+ }
+
+ node = endNode;
+ while (node && node !== startNode) {
+ node = clearPreviousLeaf(node);
+ }
+
+ if (headNodes.length) {
+ found = false;
+ node = startNode;
+ while (node) {
+ if (node.nodeType === GB.node.text) {
+ found = true;
+ break;
+ }
+ node = checkPreviousLeaf(node, endNodeAncestor);
+ }
+ if (!found) {
+ for (i = 0; i < headNodes.length; i++) {
+ self.clearCss(headNodes[i], cmd);
+ css = self.getCssValue(headNodes[i]);
+ if (!css && headNodes[i].nodeName.toLowerCase() === 'span') {
+ child = headNodes[i];
+ while (child.firstChild) {
+ child.parentNode.insertBefore(child.firstChild, child);
+ }
+ child.parentNode.removeChild(child);
+ headNodes.splice(i);
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < removeNodes.length; i++) {
+ removeNodes[i].parentNode.removeChild(removeNodes[i]);
+ }
+ removeNodes = [];
+
+ len = applyTextNodes.length;
+ if (rootNode) {
+ rangeSelectNode(startNodeRange, rootNode);
+ }
+
+ for (i = 0; i < len; i++) {
+ tNode = applyTextNodes[i];
+
+ if (tNode.previousSibling && tNode.previousSibling.nodeType === GB.node.text) {
+ if (applyTextNodes[i + 1] && tNode.previousSibling === applyTextNodes[i + 1]) {
+ applyTextNodes[i + 1].nodeValue += tNode.nodeValue;
+ tNode.parentNode.removeChild(tNode);
+ } else {
+ tNode.nodeValue = tNode.previousSibling.nodeValue + tNode.nodeValue;
+ tNode.previousSibling.parentNode.removeChild(tNode.previousSibling);
+ i--;
+ }
+ continue;
+ }
+
+ pNode = tNode.parentNode;
+
+ if (rootNode) {
+ rangeSelectNode(cursor, pNode);
+ inRange = checkInRange(startNodeRange, cursor);
+ if (inRange) {
+ self.makeFontCss(cmd, '', pNode);
+ self.makeFontCss(cmd, opt, rootNode);
+ continue;
+ }
+ }
+ if (pNode.nodeName.toLowerCase() === 'span'
+ && (pNode.firstChild === tNode || pNode.firstChild === startNode)
+ && (pNode.lastChild === tNode || pNode.lastChild === endNode)) {
+ self.makeFontCss(cmd, opt, pNode);
+ spanNodes.push(pNode);
+ continue;
+ }
+ makeSpanText(tNode);
+ }
+
+ len = spanNodes.length;
+ for (i = 0; i < len; i++) {
+ child = spanNodes[i];
+ pNode = child.parentNode;
+ if (pNode.nodeName.toLowerCase() === 'span') {
+ if (checkParentSpan(pNode)) {
+ self.makeFontCss(cmd, '', child);
+ css = self.getCssValue(child);
+ if (!css) {
+ while (child.firstChild) {
+ pNode.insertBefore(child.firstChild, child);
+ }
+ pNode.removeChild(child);
+ continue;
+ }
+ }
+ while (pNode && pNode.nodeName.toLowerCase() === 'span') {
+ if (pNode.firstChild === child && pNode.lastChild === child) {
+ css = self.getCssValue(pNode);
+ if (css) {
+ self.makeFontCss(cmd, '', pNode);
+ css = self.getCssValue(pNode);
+ if (!css) {
+ pNode.parentNode.insertBefore(child, pNode);
+ pNode.parentNode.removeChild(pNode);
+ pNode = child;
+ continue;
+ }
+ }
+ }
+ pNode = pNode.parentNode;
+ }
+ }
+ }
+
+ if (this.W3CRange) {
+ selection = this.getSelection();
+ if (selection.rangeCount > 0) {
+ selection.removeAllRanges();
+ }
+ range = this.createRange();
+ range.setStartAfter(startNode);
+ range.setEndBefore(endNode);
+ selection.addRange(range);
+ } else {
+ startNodeRange = this.createRange();
+ endNodeRange = startNodeRange.duplicate();
+ startNodeRange.moveToElementText(startNode);
+ endNodeRange.moveToElementText(endNode);
+ startNodeRange.setEndPoint('StartToEnd', startNodeRange);
+ startNodeRange.setEndPoint('EndToStart', endNodeRange);
+ startNodeRange.select();
+ }
+ } else {
+ pNode = startNode.parentNode;
+ found = false;
+ while (pNode && pNode.nodeName.toLowerCase() === 'span' && !found) {
+ css = self.getCssValue(pNode);
+ if (css) {
+ len = css.length;
+ for (i = 0; i < len; i++) {
+ if (css[i].name === cmd && css[i].value === opt) {
+ found = true;
+ break;
+ }
+ }
+ }
+ pNode = pNode.parentNode;
+ }
+
+ if (!found) {
+ span = this.doc.createElement('span');
+ this.makeFontCss(cmd, opt, span);
+ span.appendChild(zeroWidth);
+ endNode.parentNode.insertBefore(span, endNode);
+
+ if (this.W3CRange) {
+ selection = this.getSelection();
+ selection.collapse(zeroWidth, 1);
+ } else {
+ range = this.getRange();
+ range.moveToElementText(span);
+ range.collapse(false);
+ range.select();
+ }
+ }
+ }
+ this.removeStartEndNode(tempNodes);
+ } else {
+ range.execCommand(cmd, false, opt);
+ }
+ }
+ } catch (e) {
+ alert(e.toString());
+ }
+
+ this.toolbarUpdate();
+ this.boxHideAll();
+ },
+
+ modifyImage : function (img) {
+ var self = this,
+ idx, div, ico, inputCaption, wrapTextSpan, wrapTextCheckBox, wrapTextIcon, wrapTextChecked,
+ width = 0, height = 0, wrapElem, currentCaption = '', caption = null, inputAlt, inputTitle, cssFloat,
+ wrapperClassName = 'cheditor-caption-wrapper',
+ figureClassName = 'cheditor-caption',
+ figCaptionClassName = 'cheditor-caption-text',
+ imageWidthOpt = {
+ orig : { size: 'normal', desc: '원본 크기' },
+ fitpage : { size: '100%', desc: '페이지 크기에 맞춤' },
+ px160 : { size: 160, desc: '썸네일, 160 픽셀' },
+ px320 : { size: 320, desc: '작은 크기, 320 픽셀' },
+ px640 : { size: 640, desc: '중간 크기, 640 픽셀' },
+ px1024 : { size: 1024, desc: '크게, 1024 픽셀' },
+ px1600 : { size: 1600, desc: '아주 크게, 1600 픽셀' }
+ },
+ captionAlignOpt = { left: '왼쪽', center: '가운데', right: '오른쪽' },
+ imageFloatOpt = {
+ left : {
+ value : '왼쪽',
+ input : null
+ },
+ right : {
+ value : '오른쪽',
+ input : null
+ }
+ },
+ fmSelectWidth = document.createElement('select'),
+ fmSelectCaptionAlign = document.createElement('select'),
+
+ onChangeEventHandler = function () {
+ if (self.editImages[img.src] && self.editImages[img.src].width) {
+ width = self.editImages[img.src].width;
+ if (self.editImages[img.src] && self.editImages[img.src].height) {
+ height = self.editImages[img.src].height;
+ } else {
+ height = img.height;
+ }
+ } else if (img.width) {
+ width = img.width;
+ } else {
+ return;
+ }
+
+ switch (this.value) {
+ case 'orig' :
+ width = width + 'px';
+ height = (height || img.height) + 'px';
+ break;
+ case 'fitpage' :
+ width = '100%';
+ height = 'auto';
+ break;
+ default :
+ width = imageWidthOpt[this.value].size;
+ if (img.height) {
+ height = Math.round((img.height * width) / img.width) + 'px';
+ }
+ width += 'px';
+ }
+
+ if (width) {
+ img.style.width = width;
+ if (caption && caption.figure) {
+ caption.figure.style.width = width;
+ }
+ }
+ if (height) {
+ img.style.height = height;
+ }
+ },
+ setCssFloat = function (elem, css) {
+ if (typeof elem.style.styleFloat === 'undefined') {
+ elem.style.cssFloat = css;
+ } else {
+ elem.style.styleFloat = css;
+ }
+ },
+ getCssFloat = function (elem) {
+ return (typeof elem.style.styleFloat === 'undefined') ? elem.style.cssFloat : elem.style.styleFloat;
+ },
+ clearCssFloat = function (elem) {
+ setCssFloat(elem, '');
+ elem.style.marginLeft = '';
+ elem.style.marginRight = '';
+ },
+ createInputForm = function (type, name, value, classname) {
+ var input = document.createElement('input');
+ input.setAttribute('type', type);
+ input.setAttribute('name', name);
+ input.setAttribute('value', value);
+ input.className = classname;
+ return input;
+ },
+ applyWrapText = function (elem) {
+ if (!elem) {
+ return;
+ }
+ wrapElem = (caption && caption.wrapper) ? caption.wrapper : img;
+ if (elem.checked) {
+ imageFloatOpt[(elem.name === 'left' ? 'right' : 'left')].input.checked = false;
+ setCssFloat(wrapElem, elem.name);
+ if (elem.name === 'left') {
+ wrapElem.style.marginRight = '1em';
+ wrapElem.style.marginLeft = '';
+ } else {
+ wrapElem.style.marginLeft = '1em';
+ wrapElem.style.marginRight = '';
+ }
+ if (caption && caption.wrapper) {
+ clearCssFloat(img);
+ }
+ } else {
+ clearCssFloat(wrapElem);
+ }
+ },
+ getCaptionNodes = function (img) {
+ var nodes = { figure: null, figCaption: [], captionText: '', img: null, wrapper: null},
+ pNode, node;
+ pNode = img.parentNode;
+ if (!pNode || pNode.nodeName.toLowerCase() !== 'figure') {
+ return null;
+ }
+ nodes.figure = pNode;
+ nodes.figCaption = pNode.getElementsByTagName('figcaption');
+ for (idx = 0; idx < nodes.figCaption.length; idx++) {
+ node = nodes.figCaption[idx].firstChild;
+ while (node) {
+ if (node.nodeType === GB.node.text) {
+ nodes.captionText += self.trimSpace(node.nodeValue);
+ }
+ node = node.nextSibling;
+ }
+ }
+ if (pNode.parentNode.nodeName.toLowerCase() === 'div' && pNode.parentNode.className === wrapperClassName) {
+ nodes.wrapper = pNode.parentNode;
+ }
+ nodes.img = img;
+ return nodes;
+ },
+ applyAlt = function () {
+ var alt = self.trimSpace(inputAlt.value);
+ if (alt !== '') {
+ img.setAttribute('alt', alt);
+ }
+ self.removeEvent(inputAlt, 'blur', applyAlt);
+ self.cheditor.modifyState = false;
+ },
+ applyTitle = function () {
+ var title = self.trimSpace(inputTitle.value);
+ if (title !== '') {
+ img.setAttribute('title', title);
+ }
+ self.removeEvent(inputTitle, 'blur', applyTitle);
+ self.cheditor.modifyState = false;
+ },
+ applyCaption = function () {
+ var figure = self.doc.createElement('figure'),
+ figCaption = self.doc.createElement('figcaption'),
+ wrapper = self.doc.createElement('div'),
+ pNode = img.parentNode, i, para = self.doc.createElement('p');
+
+ self.removeEvent(inputCaption, 'blur', applyCaption);
+
+ wrapper.className = wrapperClassName;
+ figure.className = figureClassName;
+ figCaption.className = figCaptionClassName;
+
+ this.value = self.trimSpace(inputCaption.value);
+ if (!self.isTextVisible(this.value) && caption) {
+ caption.wrapper.parentNode.insertBefore(para, caption.wrapper);
+ para.appendChild(caption.img);
+ cssFloat = getCssFloat(caption.wrapper);
+ caption.wrapper.parentNode.removeChild(caption.wrapper);
+ caption = getCaptionNodes(img);
+ if (cssFloat && (cssFloat === 'left' || cssFloat === 'right')) {
+ applyWrapText(imageFloatOpt[cssFloat].input);
+ }
+ self.cheditor.modifyState = false;
+ return;
+ }
+ if (currentCaption === this.value) {
+ self.cheditor.modifyState = false;
+ return;
+ }
+
+ if (caption && caption.figure) {
+ for (i = 0; i < caption.figCaption.length; i++) {
+ caption.figure.removeChild(caption.figCaption[i]);
+ }
+ figure = caption.figure;
+ } else {
+ if (pNode.nodeName.toLowerCase() !== 'body') {
+ pNode.parentNode.insertBefore(wrapper, pNode.nextSibling);
+ } else {
+ pNode.insertBefore(wrapper, img);
+ }
+
+ if (self.config.imgCaptionWrapper !== '') {
+ wrapper.setAttribute('style', self.config.imgCaptionWrapper);
+ }
+
+ wrapper.appendChild(figure);
+ figure.setAttribute('style', self.config.imgCaptionFigure);
+ figure.style.display = 'inline-block';
+ figure.style.width = img.width;
+ figure.appendChild(img);
+ para.appendChild(self.createNbspTextNode());
+ wrapper.parentNode.insertBefore(para, wrapper.nextSibling);
+ }
+
+ figure.appendChild(figCaption);
+ figCaption.setAttribute('style', self.config.imgCaptionText);
+ figCaption.appendChild(self.doc.createTextNode(this.value));
+
+ if (!pNode.hasChildNodes()) {
+ pNode.parentNode.removeChild(pNode);
+ }
+
+ caption = getCaptionNodes(img);
+ cssFloat = getCssFloat(img);
+ if (cssFloat && (cssFloat === 'left' || cssFloat === 'right')) {
+ applyWrapText(imageFloatOpt[cssFloat].input);
+ }
+ self.cheditor.modifyState = false;
+ };
+
+ for (idx in imageWidthOpt) {
+ if (imageWidthOpt.hasOwnProperty(idx)) {
+ fmSelectWidth.options[fmSelectWidth.options.length] = new Option(imageWidthOpt[idx].desc, idx);
+ }
+ }
+
+ fmSelectWidth.onchange = onChangeEventHandler;
+ caption = getCaptionNodes(img);
+
+ div = document.createElement('div');
+ div.style.textAlign = 'left';
+ ico = new Image();
+ ico.src = this.config.iconPath + 'image_resize.png';
+ ico.className = 'cheditor-ico';
+ div.appendChild(ico);
+ div.appendChild(fmSelectWidth);
+
+ wrapTextChecked = getCssFloat((caption && caption.wrapper) ? caption.wrapper : img);
+
+ for (idx in imageFloatOpt) {
+ if (imageFloatOpt.hasOwnProperty(idx)) {
+ wrapTextCheckBox = createInputForm('checkbox', idx, '1', 'wrap-checked');
+ wrapTextCheckBox.setAttribute('id', 'idWrapText-' + idx);
+ wrapTextCheckBox.onclick = function () {
+ applyWrapText(this);
+ };
+ imageFloatOpt[idx].input = wrapTextCheckBox;
+ wrapTextSpan = document.createElement('span');
+ wrapTextIcon = new Image();
+ wrapTextSpan.className = 'wrap-text-desc';
+
+ if (idx === 'left') {
+ wrapTextSpan.style.marginLeft = '20px';
+ }
+ if (wrapTextChecked === idx) {
+ wrapTextCheckBox.checked = 'checked';
+ }
+ wrapTextSpan.appendChild(wrapTextCheckBox);
+ wrapTextIcon.className = 'cheditor-ico';
+ wrapTextIcon.src = this.config.iconPath + 'image_align_' + idx + '_wt.png';
+ wrapTextSpan.appendChild(wrapTextIcon);
+ div.appendChild(wrapTextSpan);
+ }
+ }
+
+ if (self.undefined(self.editImages[img.src])) {
+ self.editImages[img.src] = { width: img.width, height: img.height };
+ }
+
+ div.appendChild(document.createTextNode('\u00a0\u00a0Alt:'));
+ inputAlt = createInputForm('text', 'inputAlt', '', 'user-input-alt');
+ inputAlt.onfocus = function () {
+ self.cheditor.modifyState = true;
+ self.addEvent(inputAlt, 'blur', applyAlt);
+ };
+ div.appendChild(inputAlt);
+ if (img.getAttribute('alt')) {
+ inputAlt.value = img.getAttribute('alt');
+ }
+
+ div.appendChild(document.createTextNode('타이틀:'));
+ inputTitle = createInputForm('text', 'inputTitle', '', 'user-input-alt');
+ inputTitle.onfocus = function () {
+ self.cheditor.modifyState = true;
+ self.addEvent(inputTitle, 'blur', applyTitle);
+ };
+ div.appendChild(inputTitle);
+ if (img.getAttribute('title')) {
+ inputTitle.value = img.getAttribute('title');
+ }
+
+ div.appendChild(document.createElement('br'));
+ div.appendChild(document.createTextNode('사진 캡션:'));
+
+ inputCaption = createInputForm('text', 'inputCaption', '', 'user-input-caption');
+ inputCaption.onfocus = function () {
+ caption = getCaptionNodes(img);
+ self.cheditor.modifyState = true;
+ self.addEvent(inputCaption, 'blur', applyCaption);
+
+ };
+ div.appendChild(inputCaption);
+
+ div.appendChild(document.createTextNode('캡션 텍스트 정렬:'));
+ for (idx in captionAlignOpt) {
+ if (captionAlignOpt.hasOwnProperty(idx)) {
+ fmSelectCaptionAlign.options[fmSelectCaptionAlign.options.length] = new Option(captionAlignOpt[idx], idx);
+ if (caption && caption.figCaption[0] && caption.figCaption[0].style.textAlign) {
+ if (idx === caption.figCaption[0].style.textAlign) {
+ fmSelectCaptionAlign.options[fmSelectCaptionAlign.options.length - 1].selected = true;
+ }
+ }
+ }
+ }
+
+ fmSelectCaptionAlign.className = 'caption-align';
+ fmSelectCaptionAlign.onchange = function () {
+ caption = getCaptionNodes(img);
+ if (!caption) {
+ return;
+ }
+ for (idx = 0; idx < caption.figCaption.length; idx++) {
+ caption.figCaption[idx].style.textAlign = this.value;
+ }
+ };
+ div.appendChild(fmSelectCaptionAlign);
+
+ if (caption && caption.captionText) {
+ currentCaption = self.trimSpace(caption.captionText);
+ inputCaption.value = currentCaption;
+ }
+
+ while (self.cheditor.editBlock.firstChild) {
+ self.cheditor.editBlock.removeChild(self.cheditor.editBlock.firstChild);
+ }
+ self.cheditor.editBlock.appendChild(div);
+ },
+
+ modifyCell : function (ctd) {
+ var self = this,
+ ctb = ctd,
+ ctr = ctb,
+ tm = [], i, jr, j, jh, jv, rowIndex = 0, realIndex = 0, newc, newr, nc, tempr, rows, span, icon,
+ div = document.createElement('div'),
+
+ getCellMatrix = function () {
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
+ for (i = 0; i < rows.length; i++) {
+ tm[i] = [];
+ }
+ for (i = 0; i < rows.length; i++) {
+ jr = 0;
+ for (j = 0; j < rows[i].cells.length; j++) {
+ while (!(self.undefined(tm[i][jr]))) {
+ jr++;
+ }
+ for (jh = jr; jh < jr + (rows[i].cells[j].colSpan || 1); jh++) {
+ for (jv = i; jv < i + (rows[i].cells[j].rowSpan || 1); jv++) {
+ tm[jv][jh] = (jv === i) ? rows[i].cells[j].cellIndex : -1;
+ }
+ }
+ }
+ }
+ return tm;
+ },
+ insertColumn = function () {
+ tm = getCellMatrix();
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ for (j = 0; j < tm[rowIndex].length; j++) {
+ if (tm[rowIndex][j] === ctd.cellIndex) {
+ realIndex = j;
+ break;
+ }
+ }
+
+ for (i = 0; i < rows.length; i++) {
+ if (tm[i][realIndex] !== -1) {
+ if (rows[i].cells[tm[i][realIndex]].colSpan > 1) {
+ rows[i].cells[tm[i][realIndex]].colSpan++;
+ } else {
+ newc = rows[i].insertCell(tm[i][realIndex] + 1);
+ nc = rows[i].cells[tm[i][realIndex]].cloneNode(false);
+ nc.innerHTML = ' ';
+ rows[i].replaceChild(nc, newc);
+ }
+ }
+ }
+ },
+ insertRow = function (idx) {
+ newr = ctb.insertRow(ctr.rowIndex + 1);
+ for (i = 0; i < ctr.cells.length; i++) {
+ if (ctr.cells[i].rowSpan > 1) {
+ ctr.cells[i].rowSpan++;
+ } else {
+ newc = ctr.cells[i].cloneNode(false);
+ newc.innerHTML = ' ';
+ newr.appendChild(newc);
+ }
+ }
+
+ for (i = 0; i < ctr.rowIndex; i++) {
+ if (ctb.rows && ctb.rows.length > 0) {
+ tempr = ctb.rows[i];
+ } else {
+ tempr = ctb.getElementsByTagName('tr')[i];
+ }
+ for (j = 0; j < tempr.cells.length; j++) {
+ if (tempr.cells[j].rowSpan > (ctr.rowIndex - i)) {
+ tempr.cells[j].rowSpan++;
+ }
+ }
+ }
+ },
+ deleteColumn = function () {
+ tm = getCellMatrix(ctb);
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
+ rowIndex = 0; realIndex = 0;
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ if (tm[0].length <= 1) {
+ ctb.parentNode.removeChild(ctb);
+ } else {
+ for (j = 0; j < tm[rowIndex].length; j++) {
+ if (tm[rowIndex][j] === ctd.cellIndex) {
+ realIndex = j;
+ break;
+ }
+ }
+
+ for (i = 0; i < rows.length; i++) {
+ if (tm[i][realIndex] !== -1) {
+ if (rows[i].cells[tm[i][realIndex]].colSpan > 1) {
+ rows[i].cells[tm[i][realIndex]].colSpan--;
+ } else {
+ rows[i].deleteCell(tm[i][realIndex]);
+ }
+ }
+ }
+ }
+ },
+ deleteRow = function () {
+ var curCI = -1, prevCI, ni, nrCI, cs, nj;
+
+ tm = getCellMatrix(ctb);
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
+ rowIndex = 0;
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ if (rows.length <= 1) {
+ ctb.parentNode.removeChild(ctb);
+ } else {
+ for (i = 0; i < rowIndex; i++) {
+ tempr = rows[i];
+ for (j = 0; j < tempr.cells.length; j++) {
+ if (tempr.cells[j].rowSpan > (rowIndex - i)) {
+ tempr.cells[j].rowSpan--;
+ }
+ }
+ }
+
+ for (i = 0; i < tm[rowIndex].length; i++) {
+ prevCI = curCI;
+ curCI = tm[rowIndex][i];
+
+ if (curCI !== -1 && curCI !== prevCI && ctr.cells[curCI].rowSpan > 1 && (rowIndex + 1) < rows.length) {
+ ni = i;
+ nrCI = tm[rowIndex + 1][ni];
+ while (nrCI === -1) {
+ ni++;
+ nrCI = (ni < rows[rowIndex + 1].cells.length) ? tm[rowIndex + 1][ni] : rows[rowIndex + 1].cells.length;
+ }
+
+ newc = rows[rowIndex + 1].insertCell(nrCI);
+ rows[rowIndex].cells[curCI].rowSpan--;
+ nc = rows[rowIndex].cells[curCI].cloneNode(false);
+ rows[rowIndex + 1].replaceChild(nc, newc);
+
+ cs = (ctr.cells[curCI].colSpan > 1) ? ctr.cells[curCI].colSpan : 1;
+ nj = 0;
+
+ for (j = i; j < (i + cs); j++) {
+ tm[rowIndex + 1][j] = nrCI;
+ nj = j;
+ }
+ for (j = nj; j < tm[rowIndex + 1].length; j++) {
+ if (tm[rowIndex + 1][j] !== -1) {
+ tm[rowIndex + 1][j]++;
+ }
+ }
+ }
+ }
+
+ if (ctb.rows && ctb.rows.length > 0) {
+ ctb.deleteRow(rowIndex);
+ } else {
+ ctb.removeChild(rows[rowIndex]);
+ }
+ }
+ },
+ mergeCellRight = function () {
+ tm = getCellMatrix(ctb);
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
+ rowIndex = 0; realIndex = 0;
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ for (j = 0; j < tm[rowIndex].length; j++) {
+ if (tm[rowIndex][j] === ctd.cellIndex) {
+ realIndex = j;
+ break;
+ }
+ }
+
+ if (ctd.cellIndex + 1 < ctr.cells.length) {
+ var ccrs = ctd.rowSpan || 1,
+ cccs = ctd.colSpan || 1,
+ ncrs = ctr.cells[ctd.cellIndex + 1].rowSpan || 1,
+ nccs = ctr.cells[ctd.cellIndex + 1].colSpan || 1,
+ html;
+
+ j = realIndex;
+
+ while (tm[rowIndex][j] === ctd.cellIndex) {
+ j++;
+ }
+
+ if (tm[rowIndex][j] === ctd.cellIndex + 1) {
+ if (ccrs === ncrs) {
+ if (rows.length > 1) {
+ ctd.colSpan = cccs + nccs;
+ }
+ html = self.trimSpace(ctr.cells[ctd.cellIndex + 1].innerHTML);
+ html = html.replace(/^ /, '');
+ ctd.innerHTML += html;
+ ctr.deleteCell(ctd.cellIndex + 1);
+ }
+ }
+ }
+ },
+ mergeCellDown = function () {
+ var crealIndex = 0,
+ ccrs = ctd.rowSpan || 1,
+ cccs = ctd.colSpan || 1,
+ ncellIndex, html, ncrs, nccs;
+
+ tm = getCellMatrix(ctb);
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('tr');
+ rowIndex = 0;
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ for (i = 0; i < tm[rowIndex].length; i++) {
+ if (tm[rowIndex][i] === ctd.cellIndex) {
+ crealIndex = i;
+ break;
+ }
+ }
+
+ if (rowIndex + ccrs < rows.length) {
+ ncellIndex = tm[rowIndex + ccrs][crealIndex];
+ if (ncellIndex !== -1 &&
+ (crealIndex === 0 || (crealIndex > 0 &&
+ (tm[rowIndex + ccrs][crealIndex - 1] !== tm[rowIndex + ccrs][crealIndex]))))
+ {
+ ncrs = rows[rowIndex + ccrs].cells[ncellIndex].rowSpan || 1;
+ nccs = rows[rowIndex + ccrs].cells[ncellIndex].colSpan || 1;
+ if (cccs === nccs) {
+ html = self.trimSpace(rows[rowIndex + ccrs].cells[ncellIndex].innerHTML);
+ html = html.replace(/^ /, '');
+ ctd.innerHTML += html;
+ rows[rowIndex + ccrs].deleteCell(ncellIndex);
+ ctd.rowSpan = ccrs + ncrs;
+ }
+ }
+ }
+ },
+ splitCellVertical = function () {
+ var ri, cs;
+ tm = getCellMatrix();
+ rowIndex = 0; realIndex = 0;
+
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (ri = 0; ri < rows.length; ri++) {
+ if (rows[ri] === ctr) {
+ rowIndex = ri;
+ break;
+ }
+ }
+ }
+
+ for (j = 0; j < tm[rowIndex].length; j++) {
+ if (tm[rowIndex][j] === ctd.cellIndex) {
+ realIndex = j;
+ break;
+ }
+ }
+
+ if (ctd.colSpan > 1) {
+ newc = rows[rowIndex].insertCell(ctd.cellIndex + 1);
+ ctd.colSpan--;
+ nc = ctd.cloneNode(false);
+ nc.innerHTML = ' ';
+ rows[rowIndex].replaceChild(nc, newc);
+ ctd.colSpan = 1;
+ ctd.removeAttribute('colSpan');
+ } else {
+ newc = rows[rowIndex].insertCell(ctd.cellIndex + 1);
+ nc = ctd.cloneNode(false);
+ nc.innerHTML = ' ';
+ rows[rowIndex].replaceChild(nc, newc);
+ for (i = 0; i < tm.length; i++) {
+ if (i !== rowIndex && tm[i][realIndex] !== -1) {
+ cs = (rows[i].cells[tm[i][realIndex]].colSpan > 1) ? rows[i].cells[tm[i][realIndex]].colSpan : 1;
+ rows[i].cells[tm[i][realIndex]].colSpan = cs + 1;
+ }
+ }
+ }
+ },
+ splitCellHorizontal = function () {
+ var ni, rs;
+ tm = getCellMatrix();
+ rowIndex = 0; realIndex = 0;
+ rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName('TR');
+
+ if (ctr.rowIndex >= 0) {
+ rowIndex = ctr.rowIndex;
+ } else {
+ for (i = 0; i < rows.length; i++) {
+ if (rows[i] === ctr) {
+ rowIndex = i;
+ break;
+ }
+ }
+ }
+
+ for (j = 0; j < tm[rowIndex].length; j++) {
+ if (tm[rowIndex][j] === ctd.cellIndex) {
+ realIndex = j;
+ break;
+ }
+ }
+
+ if (ctd.rowSpan > 1) {
+ i = realIndex;
+ while (tm[rowIndex + 1][i] === -1) {
+ i++;
+ }
+
+ ni = (i === tm[rowIndex + 1].length) ? rows[rowIndex + 1].cells.length : tm[rowIndex + 1][i];
+
+ newc = rows[rowIndex + 1].insertCell(ni);
+ ctd.rowSpan--;
+
+ nc = ctd.cloneNode(false);
+ nc.innerHTML = ' ';
+ rows[rowIndex + 1].replaceChild(nc, newc);
+ ctd.rowSpan = 1;
+ } else {
+ if (ctb.rows && ctb.rows.length > 0) {
+ ctb.insertRow(rowIndex + 1);
+ } else {
+ if (rowIndex < (rows.length - 1)) {
+ ctb.insertBefore(document.createElement('TR'), rows[rowIndex + 1]);
+ } else {
+ ctb.appendChild(document.createElement('TR'));
+ }
+ }
+ for (i = 0; i < ctr.cells.length; i++) {
+ if (i !== ctd.cellIndex) {
+ rs = ctr.cells[i].rowSpan > 1 ? ctr.cells[i].rowSpan : 1;
+ ctr.cells[i].rowSpan = rs + 1;
+ }
+ }
+
+ for (i = 0; i < rowIndex; i++) {
+ tempr = rows[i];
+ for (j = 0; j < tempr.cells.length; j++) {
+ if (tempr.cells[j].rowSpan > (rowIndex - i)) {
+ tempr.cells[j].rowSpan++;
+ }
+ }
+ }
+
+ newc = rows[rowIndex + 1].insertCell(0);
+ nc = ctd.cloneNode(false);
+ nc.innerHTML = ' ';
+ rows[rowIndex + 1].replaceChild(nc, newc);
+ }
+ },
+ tblReflash = function () {
+ self.editAreaFocus(); self.doEditorEvent();
+ },
+ colorPickerEventHandler = function () {
+ GB.popupWindow.ColorPicker.argv = {
+ func: function (color) {
+ ctd.setAttribute('bgColor', color);
+ document.getElementById('fm_cell_bgcolor').value = color;
+ },
+ selectedCell : ctd
+ };
+ self.windowOpen('ColorPicker');
+ },
+ editSubmitEventHandler = function () {
+ var width = self.trimSpace(document.getElementById('fm_cell_width').value),
+ height = self.trimSpace(document.getElementById('fm_cell_height').value),
+ bgcolor = self.trimSpace(document.getElementById('fm_cell_bgcolor').value);
+ if (width) {
+ ctd.setAttribute('width', width);
+ }
+ if (height) {
+ ctd.setAttribute('height', height);
+ }
+ if (bgcolor) {
+ ctd.setAttribute('bgcolor', bgcolor);
+ }
+ },
+ deleteSubmitEventHandler = function () {
+ ctb.parentNode.removeChild(ctb);
+ self.doEditorEvent();
+ },
+ funcs = {
+ add_cols_after: { icon: 'table_insert_column.png', title: '열 삽입',
+ func: function () {
+ insertColumn(ctd.cellIndex); tblReflash();
+ }},
+ add_rows_after: { icon: 'table_insert_row.png', title: '행 삽입',
+ func: function () {
+ insertRow(ctr.rowIndex); tblReflash();
+ }},
+ remove_cols: { icon: 'table_delete_column.png', title: '열 삭제',
+ func: function () {
+ deleteColumn(ctd.cellIndex); tblReflash();
+ }},
+ remove_rows: { icon: 'table_delete_row.png', title: '행 삭제',
+ func: function () {
+ deleteRow(); tblReflash();
+ }},
+ sp1: { icon: 'dot.gif' },
+ merge_cell_right: { icon: 'table_join_row.png', title: '오른쪽 셀과 병합',
+ func: function () {
+ mergeCellRight(); tblReflash();
+ }},
+ merge_cell_down: { icon: 'table_join_column.png', title: '아래 셀과 병합',
+ func: function () {
+ mergeCellDown(); tblReflash();
+ }},
+ split_cell_v: { icon: 'table_split_row.png', title: '셀 열로 나누기',
+ func: function () {
+ splitCellVertical(); tblReflash();
+ }},
+ split_cell_h: { icon: 'table_split_column.png', title: '셀 행으로 나누기',
+ func: function () {
+ splitCellHorizontal(); tblReflash();
+ }}
+ },
+ attrFuncs = {
+ setWidth: {
+ txt: '가로폭',
+ id: 'fm_cell_width',
+ marginRight: '10px',
+ value: ctd.getAttribute('width')
+ },
+ setHeight: {
+ txt: '세로폭',
+ id: 'fm_cell_height',
+ marginRight: '10px',
+ value: ctd.getAttribute('height')
+ },
+ setBgcolor: {
+ txt: '배경색',
+ id: 'fm_cell_bgcolor',
+ marginRight: '2px',
+ value: ctd.getAttribute('bgcolor')
+ }
+ },
+ deleteSubmit = new Image(),
+ spliter = document.createElement('div'), txt, input,
+ colorPicker = new Image(),
+ editSubmit = new Image();
+
+
+ while (ctb && ctb.tagName.toLowerCase() !== 'table') {
+ ctb = ctb.parentNode;
+ }
+ while (ctr && ctr.tagName.toLowerCase() !== 'tr') {
+ ctr = ctr.parentNode;
+ }
+
+ self.cheditor.editBlock.innerHTML = '';
+ div.style.padding = '6px';
+
+ for (i in funcs) {
+ if (!funcs.hasOwnProperty(i)) {
+ continue;
+ }
+ span = document.createElement('span');
+ icon = document.createElement('img');
+ icon.src = self.config.iconPath + funcs[i].icon;
+
+ if (i === 'sp1' || i === 'sp2') {
+ icon.className = 'edit-table-ico';
+ } else {
+ icon.setAttribute('title', funcs[i].title);
+ icon.className = 'edit-table-ico';
+ icon.setAttribute('alt', '');
+ icon.onclick = funcs[i].func;
+ }
+ div.appendChild(span.appendChild(icon));
+ }
+
+ deleteSubmit.src = this.config.iconPath + 'delete_table.png';
+ deleteSubmit.style.marginLeft = '22px';
+ deleteSubmit.className = 'edit-table-ico';
+ deleteSubmit.setAttribute('title', '테이블 삭제');
+ deleteSubmit.onclick = deleteSubmitEventHandler;
+ div.appendChild(deleteSubmit);
+
+ spliter.style.padding = '10px 0px 0px 0px';
+ spliter.style.marginTop = '5px';
+ spliter.style.borderTop = '1px solid #ccc';
+ spliter.style.textAlign = 'center';
+
+ for (i in attrFuncs) {
+ if (!attrFuncs.hasOwnProperty(i)) {
+ continue;
+ }
+ txt = document.createTextNode(attrFuncs[i].txt + ' ');
+ spliter.appendChild(txt);
+ input = document.createElement('input');
+ input.style.marginRight = attrFuncs[i].marginRight;
+ input.setAttribute('type', 'text');
+ input.setAttribute('name', i);
+ input.setAttribute('id', attrFuncs[i].id);
+ input.setAttribute('size', 7);
+ input.setAttribute('value', attrFuncs[i].value || '');
+ spliter.appendChild(input);
+ }
+
+ colorPicker.src = this.config.iconPath + 'button/color_picker.gif';
+ colorPicker.className = 'color-picker';
+ colorPicker.onclick = colorPickerEventHandler;
+ spliter.appendChild(colorPicker);
+
+ editSubmit.src = this.config.iconPath + 'button/edit_cell.gif';
+ editSubmit.className = 'input-submit';
+ editSubmit.style.verticalAlign = 'top';
+ editSubmit.onclick = editSubmitEventHandler;
+
+ spliter.appendChild(editSubmit);
+ div.appendChild(spliter);
+ self.cheditor.editBlock.appendChild(div);
+ },
+
+ doEditorEvent : function (evt) {
+ var self = this,
+ cmd = null, ancestors = [], node, el, pNode, range, sType, links, span, tag, remove, bText,
+ srcElement = evt.target || evt.srcElement,
+ block = self.cheditor.editBlock,
+ status = self.cheditor.tagPath,
+ linkOnClickEventHandler = function () {
+ if (bText) {
+ document.getElementById('removeSelected').style.display = 'inline';
+ self.tagSelector(this.el);
+ }
+ },
+ removeOnClickEventHandler = function () {
+ self.doc.execCommand('RemoveFormat', false, null);
+ remove.style.display = 'none';
+ self.editAreaFocus();
+ self.doEditorEvent();
+ };
+
+ if (!this.undefined(srcElement) && srcElement.nodeType === GB.node.element) {
+ pNode = srcElement;
+ } else {
+ range = self.getRange();
+ sType = self.getSelectionType();
+ bText = sType === GB.selection.text;
+
+ if (!self.W3CRange) {
+ switch (sType) {
+ case GB.selection.none :
+ case GB.selection.text :
+ pNode = range.parentElement();
+ break;
+ case GB.selection.element :
+ pNode = range.item(0);
+ break;
+ default :
+ pNode = self.editArea.document.body;
+ }
+ } else {
+ pNode = range.commonAncestorContainer;
+ if (!range.collapsed &&
+ range.startContainer === range.endContainer &&
+ range.startOffset - range.endOffset < 2 &&
+ range.startContainer.hasChildNodes())
+ {
+ pNode = range.startContainer.childNodes[range.startOffset];
+ }
+ while (pNode.nodeType === GB.node.text) {
+ pNode = pNode.parentNode;
+ }
+ }
+ }
+
+ node = pNode;
+ while (pNode && pNode.nodeType === GB.node.element) {
+ if (pNode.tagName.toLowerCase() === 'body') {
+ break;
+ }
+ if (pNode.tagName.toLowerCase() === 'img') {
+ cmd = 'img'; break;
+ }
+ if (pNode.tagName.toLowerCase() === 'td' || pNode.tagName.toLowerCase() === 'th') {
+ cmd = 'cell'; break;
+ }
+ pNode = pNode.parentNode;
+ }
+
+ if (!cmd) {
+ block.style.display = 'none';
+ block.innerHTML = '';
+ } else {
+ if (cmd === 'cell') {
+ block.style.display = 'block';
+ self.modifyCell(pNode);
+ }
+ }
+
+ if (self.config.showTagPath) {
+ while (node && node.nodeType === GB.node.element) {
+ ancestors.push(node);
+ if (node.tagName.toLowerCase() === 'body') {
+ break;
+ }
+ node = node.parentNode;
+ }
+
+ status.innerHTML = '';
+ status.appendChild(document.createTextNode(' '));
+ el = ancestors.pop();
+
+ while (el) {
+ status.appendChild(document.createTextNode('<'));
+ tag = el.nodeName.toLowerCase();
+
+ links = document.createElement('a');
+ links.el = el;
+ links.href = 'javascript:void%200';
+ links.className = 'cheditor-tag-path-elem';
+ links.title = el.style.cssText;
+ (function () {
+ links.onclick = linkOnClickEventHandler;
+ })();
+ links.appendChild(document.createTextNode(tag));
+ status.appendChild(links);
+ status.appendChild(document.createTextNode('> '));
+ el = ancestors.pop();
+ }
+
+ if (bText) {
+ remove = document.createElement('a');
+ remove.href = 'javascript:void%200';
+ remove.id = 'removeSelected';
+ remove.style.display = 'none';
+ remove.className = 'cheditor-tag-path-elem';
+ remove.style.color = '#cc3300';
+ remove.appendChild(document.createTextNode(''));
+ (function () {
+ remove.onclick = removeOnClickEventHandler;
+ })();
+ span = document.createElement('span');
+ span.style.marginTop = '2px';
+ span.appendChild(remove);
+ self.cheditor.tagPath.appendChild(span);
+ }
+ }
+
+ self.toolbarUpdate(srcElement);
+ },
+
+ tagSelector : function (node) {
+ var rng, selection;
+ this.editAreaFocus();
+
+ if (this.W3CRange) {
+ selection = this.editArea.getSelection();
+ if (this.undefined(selection)) {
+ return;
+ }
+ try {
+ rng = selection.getRangeAt(0);
+ } catch (e) {
+ return;
+ }
+ rng.selectNodeContents(node);
+ selection.removeAllRanges();
+ selection.addRange(rng);
+ } else {
+ rng = this.doc.body.createTextRange();
+ if (rng) {
+ rng.moveToElementText(node);
+ rng.select();
+ }
+ }
+ },
+
+ getBrowser : function () {
+ return GB.browser;
+ },
+ $ : function (id) {
+ return this.doc.getElementById(id);
+ }
+};
+
+(function () {
+ var dragWindow = {
+ obj: null,
+ init: function (o, oRoot, minX, maxX, minY, maxY) {
+ o.style.curser = 'default';
+ o.onmousedown = dragWindow.start;
+ o.onmouseover = function () {
+ this.style.cursor = 'move';
+ };
+ o.hmode = true;
+ o.vmode = true;
+ o.root = (oRoot && oRoot !== null) ? oRoot : o;
+ o.transId = oRoot.id + '_Trans';
+
+ if (o.hmode && isNaN(parseInt(o.root.style.left, 10))) {
+ o.root.style.left = '0px';
+ }
+ if (o.vmode && isNaN(parseInt(o.root.style.top, 10))) {
+ o.root.style.top = '0px';
+ }
+ if (!o.hmode && isNaN(parseInt(o.root.style.right, 10))) {
+ o.root.style.right = '0px';
+ }
+ if (!o.vmode && isNaN(parseInt(o.root.style.bottom, 10))) {
+ o.root.style.bottom = '0px';
+ }
+
+ o.minX = minX !== undefined ? minX : null;
+ o.minY = minY !== undefined ? minY : null;
+ o.maxX = maxX !== undefined ? maxX : null;
+ o.maxY = maxY !== undefined ? maxY : null;
+ o.root.onDragStart = new Function();
+ o.root.onDragEnd = new Function();
+ o.root.onDrag = new Function();
+ },
+ start: function (e) {
+ var o = dragWindow.obj = this,
+ dragTransBg = document.createElement('div'),
+ y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom, 10),
+ x = parseInt(o.hmode ? o.root.style.left : o.root.style.right, 10);
+
+ e = dragWindow.fixEv(e);
+ o.root.onDragStart(x, y);
+ o.lastMouseX = e.clientX;
+ o.lastMouseY = e.clientY;
+
+ document.onmousemove = dragWindow.drag;
+ document.onmouseup = dragWindow.end;
+
+ if (o.root.lastChild.id === o.transId) {
+ return false;
+ }
+
+ dragTransBg.className = 'cheditor-dragWindowTransparent';
+ if (GB.browser.msie && GB.browser.version < 10) {
+ dragTransBg.style.filter = 'alpha(opacity=0)';
+ } else {
+ dragTransBg.style.opacity = 0;
+ }
+ dragTransBg.id = o.transId;
+ dragTransBg.style.width = o.root.lastChild.firstChild.style.width;
+ dragTransBg.style.height = o.root.lastChild.firstChild.style.height;
+ o.root.appendChild(dragTransBg);
+ return false;
+ },
+ drag: function (e) {
+ e = dragWindow.fixEv(e);
+ var o = dragWindow.obj,
+ ey = e.clientY,
+ ex = e.clientX,
+ y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom, 10),
+ x = parseInt(o.hmode ? o.root.style.left : o.root.style.right, 10),
+ nx, ny;
+
+ nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
+ ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
+
+ dragWindow.obj.root.style.left = nx + 'px';
+ dragWindow.obj.root.style.top = ny + 'px';
+ dragWindow.obj.lastMouseX = ex;
+ dragWindow.obj.lastMouseY = ey;
+ dragWindow.obj.root.onDrag(nx, ny);
+ return false;
+ },
+ end: function () {
+ document.onmousemove = null;
+ document.onmouseup = null;
+ dragWindow.obj.root.onDragEnd(parseInt(dragWindow.obj.root.style[dragWindow.obj.hmode ? 'left' : 'right'], 10),
+ parseInt(dragWindow.obj.root.style[dragWindow.obj.vmode ? 'top' : 'bottom'], 10));
+
+ if (dragWindow.obj.root.lastChild.id === dragWindow.obj.transId) {
+ dragWindow.obj.root.removeChild(dragWindow.obj.root.lastChild);
+ }
+ dragWindow.obj = null;
+ },
+ fixEv: function (e) {
+ if (e === undefined) {
+ e = window.event;
+ }
+ if (e.layerX === undefined) {
+ e.layerX = e.offsetX;
+ }
+ if (e.layerY === undefined) {
+ e.layerY = e.offsetY;
+ }
+ return e;
+ }
+ };
+ GB.dragWindow = dragWindow;
+})();
+
+// --------------------------------------------------------------------------
+// W3C DOM Range
+//
+
+// --------------------------------------------------------------------------
+// Table
+//
+
+// --------------------------------------------------------------------------
+// Color Picker
+//
+(function () {
+ var colorDropper = {
+ images: {pad: [181, 101], sld: [16, 101], cross: [15, 15], arrow: [7, 11]},
+ fetchElement: function (mixed) {
+ return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
+ },
+
+ addEvent: function (el, evnt, func) {
+ if (el.addEventListener) {
+ el.addEventListener(evnt, func, false);
+ } else if (el.attachEvent) {
+ el.attachEvent('on' + evnt, func);
+ }
+ },
+
+ fireEvent: function (el, evnt) {
+ if (!el) {
+ return;
+ }
+ var ev;
+ if (document.createEvent) {
+ ev = document.createEvent('HTMLEvents');
+ ev.initEvent(evnt, true, true);
+ el.dispatchEvent(ev);
+ } else if (document.createEventObject) {
+ ev = document.createEventObject();
+ el.fireEvent('on' + evnt, ev);
+ } else if (el['on' + evnt]) {
+ el['on' + evnt]();
+ }
+ },
+
+ getElementPos: function (e) {
+ var e1 = e, e2 = e, x = 0, y = 0;
+ if (e1.offsetParent) {
+ do {
+ x += e1.offsetLeft;
+ y += e1.offsetTop;
+ e1 = e1.offsetParent;
+ } while (e1);
+ }
+
+ while (e2 && e2.nodeName.toLowerCase() !== 'body') {
+ x -= e2.scrollLeft;
+ y -= e2.scrollTop;
+ e2 = e2.parentNode;
+ }
+ return [x, y];
+ },
+
+ getElementSize: function (e) {
+ return [e.offsetWidth, e.offsetHeight];
+ },
+
+ getRelMousePos: function (e) {
+ var x = 0, y = 0;
+ if (!e) {
+ e = window.event;
+ }
+ if (typeof e.offsetX === 'number') {
+ x = e.offsetX;
+ y = e.offsetY;
+ } else if (typeof e.layerX === 'number') {
+ x = e.layerX;
+ y = e.layerY;
+ }
+ return {x: x, y: y};
+ },
+
+ color: function (target, prop) {
+ this.required = true;
+ this.adjust = true;
+ this.hash = true;
+ this.caps = false;
+ this.valueElement = target;
+ this.styleElement = target;
+ this.onImmediateChange = null;
+ this.hsv = [0, 0, 1];
+ this.rgb = [1, 1, 1];
+ this.minH = 0;
+ this.maxH = 6;
+ this.minS = 0;
+ this.maxS = 1;
+ this.minV = 0;
+ this.maxV = 1;
+
+ this.pickerOnfocus = true;
+ this.pickerMode = 'HSV';
+ this.pickerFace = 3;
+ this.pickerFaceColor = '#fff';
+ this.pickerInset = 1;
+ this.pickerInsetColor = '#999';
+ this.pickerZIndex = 10003;
+
+ var p,
+ self = this,
+ modeID = this.pickerMode.toLowerCase() === 'hvs' ? 1 : 0,
+ abortBlur = false,
+ valueElement = colorDropper.fetchElement(this.valueElement), styleElement = colorDropper.fetchElement(this.styleElement),
+ holdPad = false, holdSld = false, touchOffset = {},
+ leaveValue = 1 << 0, leaveStyle = 1 << 1, leavePad = 1 << 2, leaveSld = 1 << 3,
+ updateFieldEventHandler = function () {
+ self.fromString(valueElement.value, leaveValue);
+ dispatchImmediateChange();
+ };
+
+ colorDropper.addEvent(target, 'blur', function () {
+ if (!abortBlur) {
+ window.setTimeout(function () {
+ abortBlur || blurTarget();
+ abortBlur = false;
+ }, 0);
+ } else {
+ abortBlur = false;
+ }
+ });
+
+ for (p in prop) {
+ if (prop.hasOwnProperty(p)) {
+ this[p] = prop[p];
+ }
+ }
+
+ this.hidePicker = function () {
+ if (isPickerOwner()) {
+ removePicker();
+ }
+ };
+
+ this.showPicker = function () {
+ if (!isPickerOwner()) {
+ drawPicker();
+ }
+ };
+
+ this.importColor = function () {
+ if (!valueElement) {
+ this.exportColor();
+ } else {
+ if (!this.adjust) {
+ if (!this.fromString(valueElement.value, leaveValue)) {
+ styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+ }
+ } else if (!this.required && /^\s*$/.test(valueElement.value)) {
+ valueElement.value = '';
+ styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+ } else if (this.fromString(valueElement.value)) {
+ // ignore
+ } else {
+ this.exportColor();
+ }
+ }
+ };
+
+ this.exportColor = function (flags) {
+ if (!(flags & leaveValue) && valueElement) {
+ var value = this.toString();
+ if (this.caps) {
+ value = value.toUpperCase();
+ }
+ if (this.hash) {
+ value = '#' + value;
+ }
+ valueElement.value = value;
+ }
+ if (!(flags & leaveStyle) && styleElement) {
+ styleElement.style.backgroundImage = 'none';
+ styleElement.style.backgroundColor = '#' + this.toString();
+ styleElement.style.color = 0.213 * this.rgb[0] + 0.715 * this.rgb[1] + 0.072 * this.rgb[2] < 0.5 ? '#FFF' : '#000';
+ }
+ if (!(flags & leavePad) && isPickerOwner()) {
+ redrawPad();
+ }
+ if (!(flags & leaveSld) && isPickerOwner()) {
+ redrawSld();
+ }
+ };
+
+ this.fromHSV = function (h, s, v, flags) {
+ if (h) {
+ h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h));
+ }
+ if (s) {
+ s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s));
+ }
+ if (v) {
+ v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v));
+ }
+
+ this.rgb = this.HSV_RGB(
+ h === null ? this.hsv[0] : (this.hsv[0] = h),
+ s === null ? this.hsv[1] : (this.hsv[1] = s),
+ v === null ? this.hsv[2] : (this.hsv[2] = v)
+ );
+ this.exportColor(flags);
+ };
+
+ this.fromRGB = function (r, g, b, flags) {
+ if (r) {
+ r = Math.max(0.0, Math.min(1.0, r));
+ }
+ if (g) {
+ g = Math.max(0.0, Math.min(1.0, g));
+ }
+ if (b) {
+ b = Math.max(0.0, Math.min(1.0, b));
+ }
+
+ var hsv = this.RGB_HSV(
+ r === null ? this.rgb[0] : r,
+ g === null ? this.rgb[1] : g,
+ b === null ? this.rgb[2] : b
+ );
+ if (hsv[0] !== null) {
+ this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
+ }
+ if (hsv[2] !== 0) {
+ this.hsv[1] = hsv[1] === null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
+ }
+ this.hsv[2] = hsv[2] === null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
+
+ var rgb = this.HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
+ this.rgb[0] = rgb[0];
+ this.rgb[1] = rgb[1];
+ this.rgb[2] = rgb[2];
+
+ this.exportColor(flags);
+ };
+
+ this.fromString = function (hex, flags) {
+ var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
+ if (!m) {
+ return false;
+ }
+ if (m[1].length === 6) {
+ this.fromRGB(
+ parseInt(m[1].substr(0, 2), 16) / 255,
+ parseInt(m[1].substr(2, 2), 16) / 255,
+ parseInt(m[1].substr(4, 2), 16) / 255,
+ flags
+ );
+ } else {
+ this.fromRGB(
+ parseInt(m[1].charAt(0) + m[1].charAt(0), 16) / 255,
+ parseInt(m[1].charAt(1) + m[1].charAt(1), 16) / 255,
+ parseInt(m[1].charAt(2) + m[1].charAt(2), 16) / 255,
+ flags
+ );
+ }
+ return true;
+ };
+
+ this.toString = function () {
+ return (
+ (0x100 | Math.round(255 * this.rgb[0])).toString(16).substr(1) +
+ (0x100 | Math.round(255 * this.rgb[1])).toString(16).substr(1) +
+ (0x100 | Math.round(255 * this.rgb[2])).toString(16).substr(1)
+ );
+ };
+
+ this.RGB_HSV = function (r, g, b) {
+ var n = Math.min(Math.min(r, g), b),
+ v = Math.max(Math.max(r, g), b),
+ m = v - n, h;
+
+ if (m === 0) {
+ return [null, 0, v];
+ }
+ h = r === n ? 3 + (b - g) / m : (g === n ? 5 + (r - b) / m : 1 + (g - r) / m);
+ return [h === 6 ? 0 : h, m / v, v];
+ };
+
+ this.HSV_RGB = function (h, s, v) {
+ if (h === null) {
+ return [v, v, v];
+ }
+ var i = Math.floor(h),
+ f = i % 2 ? h - i : 1 - (h - i),
+ m = v * (1 - s),
+ n = v * (1 - s * f);
+ switch (i) {
+ case 6:
+ case 0:
+ return [v, n, m];
+ case 1:
+ return [n, v, m];
+ case 2:
+ return [m, v, n];
+ case 3:
+ return [m, n, v];
+ case 4:
+ return [n, m, v];
+ case 5:
+ return [v, m, n];
+ }
+ };
+
+ function removePicker() {
+ delete colorDropper.picker.owner;
+ colorDropper.picker.boxB.parentNode.removeChild(colorDropper.picker.boxB);
+ }
+
+ function drawPicker() {
+ var touchMoveEventHandler = function (e) {
+ var event = {
+ 'offsetX': e.touches[0].pageX - touchOffset.X,
+ 'offsetY': e.touches[0].pageY - touchOffset.Y
+ };
+ if (holdPad || holdSld) {
+ holdPad && setPad(event);
+ holdSld && setSld(event);
+ dispatchImmediateChange();
+ }
+ e.stopPropagation();
+ e.preventDefault();
+ },
+ dims = getPickerDims(self),
+ padImg = modeID ? 'color_picker_hv.png' : 'color_picker_hs.png',
+ i, seg, segSize;
+
+ if (!colorDropper.picker) {
+ colorDropper.picker = {
+ box: document.createElement('div'),
+ boxB: document.createElement('div'),
+ pad: document.createElement('div'),
+ padB: document.createElement('div'),
+ padM: document.createElement('div'),
+ sld: document.createElement('div'),
+ sldB: document.createElement('div'),
+ sldM: document.createElement('div')
+ };
+ for (i = 0, segSize = 2; i < colorDropper.images.sld[1]; i += segSize) {
+ seg = document.createElement('div');
+ seg.style.height = segSize + 'px';
+ seg.style.fontSize = '1px';
+ seg.style.lineHeight = '0px';
+ colorDropper.picker.sld.appendChild(seg);
+ }
+ colorDropper.picker.sldB.appendChild(colorDropper.picker.sld);
+ colorDropper.picker.box.appendChild(colorDropper.picker.sldB);
+ colorDropper.picker.box.appendChild(colorDropper.picker.sldM);
+ colorDropper.picker.padB.appendChild(colorDropper.picker.pad);
+ colorDropper.picker.box.appendChild(colorDropper.picker.padB);
+ colorDropper.picker.box.appendChild(colorDropper.picker.padM);
+ colorDropper.picker.boxB.appendChild(colorDropper.picker.box);
+ }
+
+ p = colorDropper.picker;
+ p.box.onmouseup = p.box.onmouseout = function () {
+ target.focus();
+ };
+ p.box.onmousedown = function () {
+ abortBlur = true;
+ };
+ p.box.onmousemove = function (e) {
+ if (holdPad || holdSld) {
+ holdPad && setPad(e);
+ holdSld && setSld(e);
+ if (document.selection) {
+ document.selection.empty();
+ } else if (window.getSelection) {
+ window.getSelection().removeAllRanges();
+ }
+ dispatchImmediateChange();
+ }
+ };
+
+ if ('ontouchstart' in window) {
+ p.box.removeEventListener('touchmove', touchMoveEventHandler, false);
+ p.box.addEventListener('touchmove', touchMoveEventHandler, false);
+ }
+ p.padM.onmouseup = p.padM.onmouseout = function () {
+ if (holdPad) {
+ holdPad = false;
+ colorDropper.fireEvent(valueElement, 'change');
+ }
+ };
+ p.padM.onmousedown = function (e) {
+ switch (modeID) {
+ case 0:
+ if (self.hsv[2] === 0) {
+ self.fromHSV(null, null, 1.0);
+ }
+ break;
+ case 1:
+ if (self.hsv[1] === 0) {
+ self.fromHSV(null, 1.0, null);
+ }
+ break;
+ }
+ holdSld = false;
+ holdPad = true;
+ setPad(e);
+ dispatchImmediateChange();
+ };
+
+ if ('ontouchstart' in window) {
+ p.padM.addEventListener('touchstart', function (e) {
+ touchOffset = {'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top};
+ this.onmousedown({
+ 'offsetX': e.touches[0].pageX - touchOffset.X,
+ 'offsetY': e.touches[0].pageY - touchOffset.Y
+ });
+ });
+ }
+ p.sldM.onmouseup = p.sldM.onmouseout = function () {
+ if (holdSld) {
+ holdSld = false;
+ colorDropper.fireEvent(valueElement, 'change');
+ }
+ };
+ p.sldM.onmousedown = function (e) {
+ holdPad = false;
+ holdSld = true;
+ setSld(e);
+ dispatchImmediateChange();
+ };
+ if ('ontouchstart' in window) {
+ p.sldM.addEventListener('touchstart', function (e) {
+ touchOffset = {'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top};
+ this.onmousedown({
+ 'offsetX': e.touches[0].pageX - touchOffset.X,
+ 'offsetY': e.touches[0].pageY - touchOffset.Y
+ });
+ });
+ }
+
+ p.box.style.width = dims[0] + 'px';
+ p.box.style.height = dims[1] + 'px';
+
+ p.boxB.style.position = 'relative';
+ p.boxB.style.clear = 'both';
+ p.boxB.style.border = 'none';
+ p.boxB.style.background = self.pickerFaceColor;
+
+ p.pad.style.width = colorDropper.images.pad[0] + 'px';
+ p.pad.style.height = colorDropper.images.pad[1] + 'px';
+
+ p.padB.style.position = 'absolute';
+ p.padB.style.left = self.pickerFace + 'px';
+ p.padB.style.top = self.pickerFace + 'px';
+ p.padB.style.border = self.pickerInset + 'px solid';
+ p.padB.style.borderColor = self.pickerInsetColor;
+
+ p.padM.style.position = 'absolute';
+ p.padM.style.left = '0';
+ p.padM.style.top = '0';
+ p.padM.style.width = self.pickerFace + 2 * self.pickerInset + colorDropper.images.pad[0] + colorDropper.images.arrow[0] + 'px';
+ p.padM.style.height = p.box.style.height;
+ p.padM.style.cursor = 'crosshair';
+
+ p.sld.style.overflow = 'hidden';
+ p.sld.style.width = '13px';
+ p.sld.style.height = colorDropper.images.sld[1] + 'px';
+
+ p.sldB.style.position = 'absolute';
+ p.sldB.style.right = self.pickerFace + 'px';
+ p.sldB.style.top = self.pickerFace + 'px';
+ p.sldB.style.border = self.pickerInset + 'px solid';
+ p.sldB.style.borderColor = self.pickerInsetColor;
+
+ p.sldM.style.position = 'absolute';
+ p.sldM.style.right = '0';
+ p.sldM.style.top = '0';
+ p.sldM.style.width = 14 + colorDropper.images.arrow[0] + self.pickerFace + 2 * self.pickerInset + 'px';
+ p.sldM.style.height = p.box.style.height;
+
+ try {
+ p.sldM.style.cursor = 'pointer';
+ } catch (e) {
+ p.sldM.style.cursor = 'hand';
+ }
+
+ p.padM.style.backgroundImage = 'url("' + self.iconDir + '/color_picker_cross.gif")';
+ p.padM.style.backgroundRepeat = 'no-repeat';
+ p.sldM.style.backgroundImage = 'url("' + self.iconDir + '/color_picker_arrow.gif")';
+ p.sldM.style.backgroundRepeat = 'no-repeat';
+ p.pad.style.backgroundImage = 'url("' + self.iconDir + '/' + padImg + '")';
+ p.pad.style.backgroundRepeat = 'no-repeat';
+ p.pad.style.backgroundPosition = '0 0';
+ redrawPad();
+ redrawSld();
+ colorDropper.picker.owner = self;
+ target.parentNode.parentNode.appendChild(p.boxB);
+ }
+
+ function getPickerDims(o) {
+ return [2 * o.pickerInset + 2 * o.pickerFace + colorDropper.images.pad[0] +
+ 2 * o.pickerInset + 2 * colorDropper.images.arrow[0] + colorDropper.images.sld[0],
+ 2 * o.pickerInset + 2 * o.pickerFace + colorDropper.images.pad[1]];
+ }
+
+ function redrawPad() {
+ var yComponent, x, y, i = 0, rgb, s, c, f,
+ seg = colorDropper.picker.sld.childNodes;
+
+ switch (modeID) {
+ case 0:
+ yComponent = 1;
+ break;
+ case 1:
+ yComponent = 2;
+ break;
+ }
+ x = Math.round((self.hsv[0] / 6) * (colorDropper.images.pad[0] - 1));
+ y = Math.round((1 - self.hsv[yComponent]) * (colorDropper.images.pad[1] - 1));
+ colorDropper.picker.padM.style.backgroundPosition =
+ (self.pickerFace + self.pickerInset + x - Math.floor(colorDropper.images.cross[0] / 2)) + 'px ' +
+ (self.pickerFace + self.pickerInset + y - Math.floor(colorDropper.images.cross[1] / 2)) + 'px';
+
+ switch (modeID) {
+ case 0:
+ rgb = self.HSV_RGB(self.hsv[0], self.hsv[1], 1);
+ if (window.File && window.FileReader) {
+ colorDropper.picker.sld.style.background = 'linear-gradient(rgb(' +
+ (rgb[0] * (1 - i / seg.length) * 100) + '%,' +
+ (rgb[1] * (1 - i / seg.length) * 100) + '%,' +
+ (rgb[2] * (1 - i / seg.length) * 100) + '%), black)';
+ } else {
+ for (i = 0; i < seg.length; i += 1) {
+ seg[i].style.backgroundColor = 'rgb(' +
+ (rgb[0] * (1 - i / seg.length) * 100) + '%,' +
+ (rgb[1] * (1 - i / seg.length) * 100) + '%,' +
+ (rgb[2] * (1 - i / seg.length) * 100) + '%)';
+ }
+ }
+ break;
+ case 1:
+ c = [self.hsv[2], 0, 0];
+ i = Math.floor(self.hsv[0]);
+ f = i % 2 ? self.hsv[0] - i : 1 - (self.hsv[0] - i);
+ switch (i) {
+ case 6:
+ case 0:
+ rgb = [0, 1, 2];
+ break;
+ case 1:
+ rgb = [1, 0, 2];
+ break;
+ case 2:
+ rgb = [2, 0, 1];
+ break;
+ case 3:
+ rgb = [2, 1, 0];
+ break;
+ case 4:
+ rgb = [1, 2, 0];
+ break;
+ case 5:
+ rgb = [0, 2, 1];
+ break;
+ }
+
+ for (i = 0; i < seg.length; i += 1) {
+ s = 1 - 1 / (seg.length - 1) * i;
+ c[1] = c[0] * (1 - s * f);
+ c[2] = c[0] * (1 - s);
+ seg[i].style.backgroundColor = 'rgb(' +
+ (c[rgb[0]] * 100) + '%,' +
+ (c[rgb[1]] * 100) + '%,' +
+ (c[rgb[2]] * 100) + '%)';
+ }
+ break;
+ }
+ }
+
+ function getOffsetParent(el) {
+ var parent = el.offsetParent, top = 0, left = 0;
+ while (parent) {
+ top += parent.offsetTop;
+ left += parent.offsetLeft;
+ parent = parent.offsetParent;
+ }
+ return {Left: left, Top: top};
+ }
+
+ function redrawSld() {
+ var yComponent, y;
+ switch (modeID) {
+ case 0:
+ yComponent = 2;
+ break;
+ case 1:
+ yComponent = 1;
+ break;
+ }
+ y = Math.round((1 - self.hsv[yComponent]) * (colorDropper.images.sld[1] - 1));
+ colorDropper.picker.sldM.style.backgroundPosition =
+ '0 ' + (self.pickerFace + self.pickerInset + y - Math.floor(colorDropper.images.arrow[1] / 2)) + 'px';
+ }
+
+ function isPickerOwner() {
+ return colorDropper.picker && colorDropper.picker.owner === self;
+ }
+
+ function blurTarget() {
+ if (valueElement === target) {
+ self.importColor();
+ }
+ }
+
+ function blurValue() {
+ if (valueElement !== target) {
+ self.importColor();
+ }
+ }
+
+ function setPad(e) {
+ var mpos = colorDropper.getRelMousePos(e),
+ x = mpos.x - self.pickerFace - self.pickerInset,
+ y = mpos.y - self.pickerFace - self.pickerInset;
+ switch (modeID) {
+ case 0:
+ self.fromHSV(x * (6 / (colorDropper.images.pad[0] - 1)), 1 - y / (colorDropper.images.pad[1] - 1), null, leaveSld);
+ break;
+ case 1:
+ self.fromHSV(x * (6 / (colorDropper.images.pad[0] - 1)), null, 1 - y / (colorDropper.images.pad[1] - 1), leaveSld);
+ break;
+ }
+ }
+
+ function setSld(e) {
+ var mpos = colorDropper.getRelMousePos(e),
+ y = mpos.y - self.pickerFace - self.pickerInset;
+ switch (modeID) {
+ case 0:
+ self.fromHSV(null, null, 1 - y / (colorDropper.images.sld[1] - 1), leavePad);
+ break;
+ case 1:
+ self.fromHSV(null, 1 - y / (colorDropper.images.sld[1] - 1), null, leavePad);
+ break;
+ }
+ }
+
+ function dispatchImmediateChange() {
+ if (self.onImmediateChange) {
+ var callback;
+ if (typeof self.onImmediateChange === 'string') {
+ callback = new Function(self.onImmediateChange);
+ } else {
+ callback = self.onImmediateChange;
+ }
+ callback.call(self);
+ }
+ }
+
+ if (valueElement) {
+ colorDropper.addEvent(valueElement, 'keyup', updateFieldEventHandler);
+ colorDropper.addEvent(valueElement, 'input', updateFieldEventHandler);
+ colorDropper.addEvent(valueElement, 'blur', blurValue);
+ valueElement.setAttribute('autocomplete', 'off');
+ }
+
+ this.importColor();
+ }
+ };
+ GB.colorDropper = colorDropper.color;
+})();
diff --git a/plugin/editor/cheditor5/css/SourceCodePro.eot b/plugin/editor/cheditor5/css/SourceCodePro.eot
new file mode 100644
index 000000000..2388fa2d7
Binary files /dev/null and b/plugin/editor/cheditor5/css/SourceCodePro.eot differ
diff --git a/plugin/editor/cheditor5/css/SourceCodePro.woff b/plugin/editor/cheditor5/css/SourceCodePro.woff
new file mode 100644
index 000000000..395436eb8
Binary files /dev/null and b/plugin/editor/cheditor5/css/SourceCodePro.woff differ
diff --git a/plugin/editor/cheditor5/css/dialog.css b/plugin/editor/cheditor5/css/dialog.css
new file mode 100644
index 000000000..3c87b0e2c
--- /dev/null
+++ b/plugin/editor/cheditor5/css/dialog.css
@@ -0,0 +1,185 @@
+body {
+ background-color: #fff;
+ margin: 0;
+ border: 0;
+ padding: 0;
+ font-size: 9pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ line-height: 1em;
+ overflow: hidden;
+}
+td, input {
+ font-size: 9pt;
+ vertical-align: middle;
+ margin: 0;
+ line-height: 15px;
+ height: 15px;
+}
+select {
+ font-size: 9pt;
+ vertical-align: middle;
+ margin: 0;
+}
+.handCursor {
+ cursor: pointer;
+}
+td.hover
+{
+ background-color : Fuchsia;
+}
+table.dlg {
+ border: 0;
+}
+fieldset {
+ border: 1px solid #ccc;
+ padding: 2px;
+ margin: 0;
+}
+.content-outline {
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ padding: 5px;
+ margin: 0;
+}
+.dlg td {
+ text-align: left;
+ height: 20px;
+}
+form {
+ display: inline;
+}
+.dlg input {
+ border: 2px;
+}
+.img {
+ border: 0;
+ vertical-align: middle;
+}
+.font-normal {
+ font-size: 9pt;
+}
+legend {
+ font-size: 9pt;
+ font-weight: bold;
+}
+.bottom-status {
+ background-color: #fff;
+ margin-top: 10px;
+ padding: 0;
+ text-align: center;
+ height: 24px;
+ vertical-align: middle;
+}
+.button {
+ width: 64px;
+ height: 22px;
+ margin: 1px 2px;
+ cursor: pointer;
+ vertical-align: middle;
+}
+.button8em {
+ font-size: 9pt;
+ padding-top: 2px !important;
+ height: 21px;
+ width: 8em;
+}
+.button10em {
+ font-size: 9pt;
+ padding-top: 1px !important;
+ height: 21px;
+ width: 10em;
+}
+.emIcon {
+ width: 19px;
+ height: 19px;
+ cursor: pointer;
+}
+.schar {
+ border: 1px solid #ccc;
+ background-color: #fff;
+ width: 18px;
+ height: 17px;
+ text-align: center;
+ cursor: pointer;
+ font-size: 12px;
+ line-height: 1.2em;
+}
+.spacer {
+ margin: 10px 0 0 0;
+}
+.spacer5 {
+ margin: 5px 0 0 0;
+ clear: both;
+}
+.wrapper {
+ text-align: center;
+}
+.clear {
+ clear: both;
+}
+.flash-movie-source {
+ margin: 0 auto;
+}
+.flash-player-wrapper {
+ width: 560px;
+ height: 315px;
+ border: 1px #a0a0a0 solid;
+ text-align: center;
+ overflow: auto;
+ margin: 0 auto;
+ background-color: #fff;
+ display: block;
+}
+.media-player-wrapper {
+ height: 200px;
+ margin-top: 5px;
+ text-align: center;
+ overflow-x: auto;
+ overflow-y: hidden;
+}
+.hr {
+ border: 0;
+ background: #e0e0e0;
+ height: 1px;
+}
+.colorCellMouseOver {
+ line-height: 0;
+ font-size: 0;
+ height: 8px;
+ width: 8px;
+ border: 1px solid #fff;
+}
+.colorCellMouseOut {
+ line-height: 8px;
+ font-size: 0;
+ height: 8px;
+ width: 8px;
+ border: 1px solid #000;
+}
+.colorInputBox {
+ background-color: #000;
+ text-align: center;
+ border: 1px solid #000;
+ height: 16px;
+}
+.colorWrapper {
+ border: 1px solid #000;
+ background-color: #fff;
+ position: absolute;
+ padding: 2px;
+ display: none;
+}
+.colorPickerButton {
+ background: url("../icons/button/color_picker.png") no-repeat center center;
+ width: 24px;
+ height: 20px;
+ cursor: pointer;
+ float: left;
+}
+.colorPickerButtonGray {
+ background: url("../icons/button/color_picker_disable.png") no-repeat center center;
+ width: 24px;
+ height: 20px;
+ cursor: pointer;
+ float: left;
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/css/editarea.css b/plugin/editor/cheditor5/css/editarea.css
new file mode 100644
index 000000000..5350c82a6
--- /dev/null
+++ b/plugin/editor/cheditor5/css/editarea.css
@@ -0,0 +1,23 @@
+html, body {
+}
+
+p {
+ margin: 0;
+}
+table, td, th { border:1px dotted #ccc; }
+table { border-collapse: collapse }
+
+/*-------------------------------------------------------------------------------*/
+.ch_bogus_spacer {}
+.cheditor-zero-width { font-family: monospace; }
+.cheditor-insertpara-pointer {
+ height: 1px;
+ display: none;
+ overflow: hidden;
+ background-color: red;
+ position: absolute;
+}
+.cheditor-add-paragraph {
+ border: #999 dotted 1px;
+ margin: 1px 0px;
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/css/imageupload.css b/plugin/editor/cheditor5/css/imageupload.css
new file mode 100644
index 000000000..0589dd629
--- /dev/null
+++ b/plugin/editor/cheditor5/css/imageupload.css
@@ -0,0 +1,136 @@
+#uploadWindow {
+ display: none;
+}
+
+.clear { clear: both; }
+
+#container {
+ padding: 0;
+}
+
+.imageListWrapperHtml5, .imageListWrapper, .dragOver {
+ background-color: #fff;
+ position: absolute;
+ height: 295px;
+ width: 522px;
+ overflow-y: scroll;
+ border-radius: 4px;
+ border: 1px red solid;
+}
+.imageListWrapperHtml5 {
+ border: 2px #66b2ff dashed;
+}
+.imageListWrapper {
+ border: 1px #aaa solid;
+ box-shadow: 0 0 3px #aaa;
+}
+.dragOver {
+ border: 2px #ff3399 dashed;
+}
+#imageInfoBox {
+ position: absolute;
+ left: 548px;
+}
+.imageInfoTitle {
+ text-align: center;
+ background-color: #e0e0e0;
+ width: 130px;
+ font-family: "Malgun Gothic",gulim;
+ font-weight: bold;
+ font-size: 12px;
+}
+.imageInfoTitle span {
+ display: inline-block;
+ margin-top: -1px;
+ line-height: 22px;
+}
+.remove-button {
+ width: 93px;
+ height: 22px;
+ cursor: pointer;
+ vertical-align: middle;
+}
+.imageBox, .imageBoxHighlighted {
+ width: 120px;
+ height: 90px;
+ margin: 3px 3px;
+ float: left;
+}
+.imageBox_theImage,.imageBox_theImage_over {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ display: block;
+ background-color: #fff;
+}
+.imageBox .imageBox_theImage{
+ border: 1px solid #e0e0e0;
+ background-image: url('../icons/dot.gif');
+ background-position: center center;
+ background-repeat: no-repeat;
+}
+.imageBox .imageBox_theImage_over {
+ border: 1px solid #a0a0a0;
+ background-image: url('../icons/dot.gif');
+ background-position: center center;
+ background-repeat: no-repeat;
+ cursor: pointer;
+}
+.imageBoxHighlighted .imageBox_theImage {
+ border: 1px solid #ff6600;
+}
+.imageBoxHighlighted .imageBox_theImage_over {
+ border: 1px solid #ff6600;
+ background-image: url('../icons/dot.gif');
+ background-position: center center;
+ background-repeat: no-repeat;
+}
+
+.removeButton, .removeButton_over {
+ display: none;
+ position: absolute;
+ cursor: pointer;
+ background-image: url(../icons/imageUpload/cross-small.png);
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+.removeButton {
+ border: 1px solid #a0a0a0;
+}
+.removeButton_over {
+ border: 1px solid #808080;
+}
+#insertionMarker {
+ height: 102px;
+ width: 6px;
+ position: absolute;
+ display: none;
+}
+
+#insertionMarker img {
+ float: left;
+}
+
+#dragDropContent{
+ position: absolute;
+ z-index: 10;
+ display: none;
+}
+
+.button {
+ width: 64px;
+ height: 22px;
+ margin: 0 2px;
+ cursor: pointer;
+ vertical-align: middle;
+}
+
+body {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ background-color: #fff;
+ line-height: 1em;
+ font-family: 'Malgun Gothic', gulim, tahoma, helvetica;
+ font-size: 12px;
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/css/imageurl.css b/plugin/editor/cheditor5/css/imageurl.css
new file mode 100644
index 000000000..7332065a7
--- /dev/null
+++ b/plugin/editor/cheditor5/css/imageurl.css
@@ -0,0 +1,5 @@
+/* CSS file */
+
+Application
+{
+}
diff --git a/plugin/editor/cheditor5/css/lightbox.css b/plugin/editor/cheditor5/css/lightbox.css
new file mode 100644
index 000000000..a45cdfc60
--- /dev/null
+++ b/plugin/editor/cheditor5/css/lightbox.css
@@ -0,0 +1,95 @@
+/************************************************
+
+ CHEditor Image Caption Util
+
+************************************************/
+img.chimg_photo
+{
+ border: 1px darkgray solid;
+ padding:10px;
+}
+div.imgblock
+{
+}
+div.leftjust
+{
+}
+div.rightjust
+{
+}
+div.caption
+{
+ margin-top: 5px;
+ margin-left: 0.2em;
+ color: darkgray;
+ font-size: 9pt;
+}
+div.caption-marker
+{
+ float: left;
+ margin-right: 0.2em;
+}
+div.caption-text
+{
+ float: left;
+ clear: right;
+ text-align: left;
+}
+.imageUtil {
+ cursor: url(icons/imageutil/zoomin.cur), pointer;
+ outline: none;
+}
+.imageUtil img {
+ border: 2px solid gray;
+}
+.imageUtil:hover img {
+ border: 2px solid silver;
+}
+
+.imageUtil-image {
+ border-bottom: 1px solid white;
+}
+.imageUtil-image-blur {
+}
+.imageUtil-caption {
+ display: none;
+ border-bottom: 1px solid white;
+ font-family: gulim, Verdana, Helvetica;
+ font-size: 9pt;
+ padding: 5px;
+ background-color: #fff;
+}
+.imageUtil-loading {
+ display: block;
+ color: white;
+ font-size: 9px;
+ font-weight: normal;
+ text-decoration: none;
+ padding: 3px;
+ border-top: 1px solid white;
+ border-bottom: 1px solid white;
+ background-color: black;
+ padding-left: 22px;
+ background-image: url(icons/imageutil/loader.gif);
+ background-repeat: no-repeat;
+ background-position: 3px 1px;
+}
+
+a.imageUtil-credits,
+a.imageUtil-credits i {
+ padding: 2px;
+ color: silver;
+ text-decoration: none;
+ font-size: 10px;
+}
+a.imageUtil-credits:hover,
+a.imageUtil-credits:hover i {
+ color: white;
+ background-color: gray;
+}
+.imageUtil-display-block {
+ display: block;
+}
+.imageUtil-display-none {
+ display: none;
+}
diff --git a/plugin/editor/cheditor5/css/ui.css b/plugin/editor/cheditor5/css/ui.css
new file mode 100644
index 000000000..2273f4034
--- /dev/null
+++ b/plugin/editor/cheditor5/css/ui.css
@@ -0,0 +1,653 @@
+a.cheditor-tag-path-elem {
+ text-decoration: none;
+ color: #0033cc;
+ font-size: 8pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", dotum, monospace;
+ cursor: pointer;
+}
+a.cheditor-tag-path-elem:hover {
+ color: #0033cc;
+ text-decoration: underline;
+ cursor: pointer;
+}
+.cheditor-container {
+ border-top: 1px #ccc solid;
+ position: relative;
+ text-align: left;
+}
+.cheditor-tb-wrapper {
+ border-right: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ position: relative;
+ display: block;
+ background-color: #f0f0f0;
+ zoom:1;
+ height:auto ! important;
+}
+.cheditor-tb-wrapper:after{display:block;visibility:hidden;clear:both;content:""}
+.cheditor-tb-wrapper-readonly {
+ border-right: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ position: relative;
+ display: block;
+ background: #f0f0f0 url(../icons/readonlymode.png) no-repeat 10px center;
+}
+.cheditor-tb-wrapper-code {
+ border-right: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ position: relative;
+ display: block;
+ background: #f0f0f0 url(../icons/viewmode_code.png) no-repeat 10px center;
+}
+.cheditor-tb-wrapper-preview {
+ border-right: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ position: relative;
+ display: block;
+ background: #f0f0f0 url(../icons/viewmode_preview.png) no-repeat 10px center;
+}
+.cheditor-tb-wrapper-readonly div, .cheditor-tb-wrapper-code div, .cheditor-tb-wrapper-preview div {
+ display: none;
+}
+.cheditor-tb-fullscreen {
+ width: 16px;
+ height: 16px;
+ float: right;
+ margin-top: 3px;
+ cursor: pointer;
+ background: transparent url(../icons/fullscreen.png) no-repeat center center;
+}
+.cheditor-tb-fullscreen-disable {
+ display: none;
+}
+.cheditor-tb-fullscreen-actual {
+ width: 16px;
+ height: 16px;
+ float: right;
+ margin-top: 3px;
+ cursor: pointer;
+ background: transparent url(../icons/fullscreen_actual.png) no-repeat center center;
+}
+.cheditor-editarea-wrapper {
+ border-right: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ width: auto;
+ overflow: hidden;
+}
+.cheditor-editarea {
+ width: 100%;
+ overflow-x: hidden;
+ overflow-y: auto;
+ margin: 0;
+ padding: 0;
+ display: block;
+}
+@font-face {
+ font-family: 'SourceCodePro';
+ src: url('SourceCodePro.eot');
+ src: url('SourceCodePro.woff') format('woff');
+}
+.cheditor-editarea-text-content {
+ overflow-x: hidden;
+ overflow-y: scroll;
+ margin: 0;
+ border: 1px solid transparent;
+ padding: 7px 10px;
+ display: none;
+ resize: none;
+ outline: none;
+ font-family: SourceCodePro, monospace;
+ font-size: 12px;
+}
+.cheditor-modify-block .cheditor-ico {
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
+ margin-right: 5px;
+}
+.cheditor-modify-block select {
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ font-size: 9pt;
+ color: #000;
+}
+.cheditor-modify-block div {
+ padding: 5px 10px 5px 10px;
+ color: #000;
+ display: block;
+}
+.cheditor-modify-block div .wrap-text-desc {
+ line-height: 1em;
+ color: #000;
+}
+.cheditor-modify-block div .user-input-alt {
+ width: 120px;
+ margin: 3px 10px 0 5px;
+ height: 15px;
+ line-height: 15px;
+ padding-top: 1px;
+ font-size: 9pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ color: #000;
+}
+.cheditor-modify-block div .user-input-caption {
+ width: 350px;
+ margin: 7px 10px 0 5px;
+ height: 15px;
+ line-height: 15px;
+ padding-top: 1px;
+ font-size: 9pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ color: #000;
+}
+.cheditor-modify-block div .caption-align {
+ margin: 7px 0 0 4px;
+ font-size: 9pt;
+ vertical-align: top;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ color: #000;
+}
+.cheditor-modify-block div .wrap-checked {
+ vertical-align: middle;
+ padding: 0;
+ margin-right: 2px;
+}
+.cheditor-modify-block div .input-submit {
+ cursor: pointer;
+ vertical-align: middle;
+ margin-top: -2px;
+ margin-left: 10px;
+ height: 20px;
+ width: 64px;
+}
+.cheditor-modify-block div .color-picker {
+ cursor: pointer;
+ vertical-align: middle;
+ height: 20px;
+ width: 20px;
+}
+.cheditor-modify-block div .delete-submit {
+ cursor: pointer;
+ vertical-align: middle;
+ margin-top: -2px;
+ margin-left: 3px;
+ height: 20px;
+ width: 64px;
+}
+.cheditor-modify-block div .edit-table-ico {
+ cursor: pointer;
+ vertical-align: middle;
+ width: 16px;
+ height: 16px;
+ margin: 0 3px;
+}
+.cheditor-modify-block {
+ display: none;
+ border-right: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ padding: 2px;
+ background-color: #eee;
+ font-size: 9pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ text-align: center;
+}
+.cheditor-status-bar {
+ font-size: 8pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", dotum, monospace;
+ color: #333;
+}
+.cheditor-tag-path {
+ border-right: 1px #ccc solid;
+ border-bottom: 1px #ccc solid;
+ border-left: 1px #ccc solid;
+ padding: 0 2px 0 2px;
+ display: none;
+ height: 18px;
+ line-height: 18px;
+ overflow: hidden;
+}
+.cheditor-viewmode {
+ padding: 0 4px 0 4px;
+ height: 16px;
+ background: transparent url(../icons/statusbar_bgline.gif) repeat-x 0 0;
+}
+.cheditor-viewmode div {
+ width: 24px;
+ height: 16px;
+ cursor: pointer;
+}
+.cheditor-tab-rich {
+ background: transparent url(../icons/edit_mode_rich_a.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-tab-rich-off {
+ background: transparent url(../icons/edit_mode_rich_b.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-tab-code {
+ background: transparent url(../icons/edit_mode_code_a.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-tab-code-off {
+ background: transparent url(../icons/edit_mode_code_b.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-tab-preview {
+ background: transparent url(../icons/edit_mode_view_a.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-tab-preview-off {
+ background: transparent url(../icons/edit_mode_view_b.png) no-repeat 0 0;
+ float: left;
+}
+.cheditor-resizebar {
+ height: 11px;
+ overflow: hidden;
+ border-left: 1px #ccc solid;
+ border-right: 1px #ccc solid;
+ cursor: s-resize;
+ background: #eee url(../icons/splitter.gif) no-repeat center top;
+}
+.cheditor-resizebar-off {
+ height: 11px;
+ overflow: hidden;
+ border-left: 1px #ccc solid;
+ border-right: 1px #ccc solid;
+ cursor: default;
+ background-color: #eee;
+}
+.cheditor_mode_icon { width: 24px; height: 16px; cursor: pointer; vertical-align: top }
+.cheditor-pulldown-container {
+ border: #7d8db0 1px solid;
+ background-color: #fff;
+ padding: 1px;
+ position: relative;
+ -moz-box-shadow: 0 0 5px #aaa;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 1px 1px 10px #bbb;
+}
+.cheditor-pulldown-container div {
+ padding: 2px 2px 2px 15px;
+ font-size: 9pt;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ color: #222;
+ position: relative;
+ display: block;
+ line-height: 1.2;
+ margin: 2px 2px;
+}
+.cheditor-pulldown-color-container {
+ border: #7d8db0 1px solid;
+ -moz-box-shadow: 0 0 5px #aaa;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 1px 1px 10px #bbb;
+ background-color: #fff;
+ padding: 2px;
+}
+.cheditor-pulldown-container div label, .cheditor-pulldown-textblock-container div label {
+ display: block;
+}
+.cheditor-pulldown-textblock-container div div {
+ text-align: center;
+ padding: 2px;
+ font-size: 9pt;
+ color: #000;
+ line-height: 1.2;
+}
+.cheditor-pulldown-textblock-container div {
+ padding: 1px;
+}
+.cheditor-pulldown-textblock-out {
+ border: #fff 1px solid;
+}
+.cheditor-pulldown-textblock-over {
+ border: #ccc 1px solid;
+}
+.cheditor-pulldown-textblock-container {
+ border: #7d8db0 1px solid;
+ -moz-box-shadow: 0 0 5px #aaa;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 1px 1px 10px #bbb;
+ background-color: #fff;
+ padding: 2px;
+}
+.cheditor-pulldown-mouseout {
+ border: #fff 1px solid;
+}
+.cheditor-pulldown-mouseover {
+ background-color: #f0f0f0;
+ border: #e0e0e0 1px solid;
+}
+.cheditor-pulldown-frame {
+ position: absolute;
+ visibility: hidden;
+ z-index: -1;
+ width: 1px;
+ height: 1px;
+ line-height: 12px;
+}
+.cheditor-pulldown-color-cell-over, .cheditor-pulldown-color-cell {
+ float: left;
+ width: 14px;
+ height: 14px;
+ margin: 1px;
+ cursor: pointer;
+}
+.cheditor-pulldown-color-cell-over {
+ border: 1px #000 solid;
+}
+.cheditor-pulldown-color-cell-over span {
+ width: 12px;
+ height: 12px;
+ border: 1px #fff solid;
+ display: block;
+}
+.cheditor-pulldown-color-cell {
+ border: 1px #999 solid;
+}
+.cheditor-pulldown-color-cell span {
+ width: 14px;
+ height: 14px;
+ display: block;
+ border: none;
+}
+.cheditor-pulldown-color-selected {
+ border: 1px solid #999;
+ text-align: left;
+ margin: 4px 0 0 1px;
+ padding-left: 5px;
+ height: 15px;
+ line-height: 15px;
+ font-size: 11px;
+ font-family: verdana, monospace;
+ width: 55px;
+ vertical-align: -10%;
+}
+.cheditor-pulldown-color-reset, .cheditor-pulldown-color-show-picker {
+ height: 19px;
+ width: 16px;
+ cursor: pointer;
+ display: inline-block;
+ vertical-align: middle;
+ margin-left: 3px;
+}
+.cheditor-pulldown-color-reset {
+ background: #fff url(../icons/color_picker_reset.png) no-repeat center center;
+}
+.cheditor-pulldown-color-show-picker {
+ background: #fff url(../icons/color_picker.png) no-repeat center center;
+}
+.cheditor-pulldown-color-submit {
+ vertical-align: middle;
+ margin: 4px 1px 0 0;
+ height: 19px;
+ width: 40px;
+ cursor: pointer;
+ right: 0;
+ position: absolute;
+}
+.cheditor-container-fullscreen {
+ position: fixed;
+ left: 0;
+ top: 0;
+ _position: absolute;
+ z-index: 1000;
+ text-align: left;
+ background-color: #fff;
+}
+.cheditor-popupModalBackground {
+ background-color: #fff;
+ position: fixed;
+ _position: absolute;
+ display: none;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+.cheditor-popup-window {
+ border: 1px solid #0078D7;
+ border-radius: 5px;
+ background-color: #0078D7;
+ display: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ -moz-box-shadow: 0 0 5px #aaa;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 0 0 10px #bbb;
+ padding: 0;
+ overflow: hidden;
+}
+.cheditor-popup-cmd-button {
+ width: 64px;
+ height: 22px;
+ margin: 5px 2px;
+ cursor: pointer;
+ vertical-align: middle;
+}
+.cheditor-popup-cframe {
+ background-color: #fff;
+ margin: 0;
+ padding: 10px;
+ border: none;
+ text-align: center;
+}
+
+.cheditor-popup-cframe iframe {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+}
+.cheditor-popup-drag-handle {
+ height: 31px;
+}
+.cheditor-popup-titlebar {
+ padding-left: 10px;
+ line-height: 30px;
+}
+.cheditor-popup-title {
+ font-size: 12px;
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ font-weight: bold;
+ color: #fff;
+}
+.cheditor-dragWindowTransparent {
+ background-color: #fff;
+ position: absolute;
+ display: block;
+ left: 0px;
+ top: 27px;
+}
+.cheditor-pulldown-wrapper {
+ line-height: 1;
+}
+.cheditor-toolbar-icon-wrapper {
+ margin: 0 2px 0 0;
+ float: left;
+ height: 24px;
+ overflow: hidden;
+}
+.cheditor-tb-icon {
+ height: 22px;
+ width: 16px;
+ overflow: hidden;
+}
+.cheditor-tb-icon-disable {
+ height: 22px;
+ width: 16px;
+ overflow: hidden;
+ filter: alpha(opacity=40) gray;
+ opacity: 0.4;
+}
+.cheditor-tb-text {
+ padding: 0;
+ margin: 0;
+ color: #333;
+ height: 20px;
+ line-height: 20px;
+}
+.cheditor-tb-text-disable {
+ padding: 0;
+ margin: 0;
+ height: 20px;
+ line-height: 20px;
+ color: #333;
+ overflow: hidden;
+ filter: alpha(opacity=40) gray;
+ -webkit-filter: grayscale(100%);
+ opacity: 0.4;
+}
+.cheditor-tb-text span, .cheditor-tb-text-disable span {
+ font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, monospace;
+ margin: 0 0 0 1px;
+ padding: 0;
+ width: 41px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ display: block;
+ font-size: 12px;
+}
+.cheditor-tb-icon23 {
+ height: 22px;
+ width: 23px;
+ margin-left: 3px;
+ overflow: hidden;
+}
+.cheditor-tb-icon23-disable {
+ height: 22px;
+ width: 23px;
+ margin-left: 3px;
+ overflow: hidden;
+ filter: alpha(opacity=40) gray;
+ opacity: 0.4;
+}
+.cheditor-tb-icon36 {
+ height: 22px;
+ width: 36px;
+ overflow: hidden;
+}
+.cheditor-tb-icon36-disable {
+ height: 22px;
+ width: 36px;
+ overflow: hidden;
+ filter: alpha(opacity=40) gray;
+ opacity: 0.4;
+}
+.cheditor-tb-combo {
+ height: 22px;
+ width: 10px;
+ overflow: hidden;
+}
+.cheditor-tb-combo-disable {
+ height: 22px;
+ width: 10px;
+ overflow: hidden;
+ filter: alpha(opacity=40) gray;
+ opacity: 0.4;
+}
+.cheditor-tb-bg55 {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -483px;
+ position: relative;
+}
+.cheditor-tb-bg40 {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -552px;
+ position: relative;
+}
+.cheditor-tb-bg44 {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -621px;
+ position: relative;
+}
+.cheditor-tb-bg30-first {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -276px;
+ position: relative;
+}
+.cheditor-tb-bg30 {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -345px;
+ position: relative;
+}
+.cheditor-tb-bg30-last {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -414px;
+ position: relative;
+}
+.cheditor-tb-bgcombo {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -690px;
+ position: relative;
+}
+.cheditor-tb-bgcombo-first {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left top;
+ position: relative;
+}
+.cheditor-tb-bgcombo-last {
+ float: left;
+ overflow: hidden;
+ background: url(../icons/toolbar-background.png) no-repeat left -759px;
+ position: relative;
+}
+.cheditor-tb-bg {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -69px;
+ position: relative;
+}
+.cheditor-tb-bg-first {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left top;
+ position: relative;
+}
+.cheditor-tb-bg-last {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -138px;
+ position: relative;
+ background-clip: border-box;
+}
+.cheditor-tb-bg-single {
+ float: left;
+ overflow: hidden;
+ background: transparent url(../icons/toolbar-background.png) no-repeat left -207px;
+ position: relative;
+}
+.cheditor-tb-color-btn {
+ width: 16px;
+ height: 3px;
+ overflow: hidden;
+ position: absolute;
+ top: 16px;
+ left: 3px;
+}
+.cheditor-tb-button-spacer {
+ overflow: hidden;
+ width: 4px;
+ height: 4px;
+ float: left;
+}
+.cheditor-tb-split {
+ overflow: hidden;
+ height: 2px;
+ width: 3px;
+ clear: both;
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/editor.lib.php b/plugin/editor/cheditor5/editor.lib.php
new file mode 100644
index 000000000..6c0c578d2
--- /dev/null
+++ b/plugin/editor/cheditor5/editor.lib.php
@@ -0,0 +1,158 @@
+') ) { //textarea로 작성되고, html 내용이 없다면
+ $content = nl2br($content);
+ }
+ }
+
+ $width = isset($editor_width) ? $editor_width : "100%";
+ $height = isset($editor_height) ? $editor_height : "250px";
+ if (defined(G5_PUNYCODE))
+ $editor_url = G5_PUNYCODE.'/'.G5_EDITOR_DIR.'/'.$config['cf_editor'];
+ else
+ $editor_url = G5_EDITOR_URL.'/'.$config['cf_editor'];
+
+ $html = "";
+
+ if ($is_dhtml_editor) {
+ if ($js) {
+ $html .= "";
+ }
+ $html .= "\n";
+ $html .= "웹에디터 시작";
+ $html .= "\n";
+ $html .= "\n웹 에디터 끝";
+ $html .= "\n";
+ } else {
+ $html .= "\n";
+ }
+ return $html;
+}
+
+
+// textarea 로 값을 넘긴다. javascript 반드시 필요
+function get_editor_js($id, $is_dhtml_editor=true)
+{
+ if ($is_dhtml_editor) {
+ return "document.getElementById('tx_{$id}').value = ed_{$id}.outputBodyHTML();\n";
+ } else {
+ return "var {$id}_editor = document.getElementById('{$id}');\n";
+ }
+}
+
+
+// textarea 의 값이 비어 있는지 검사
+function chk_editor_js($id, $is_dhtml_editor=true)
+{
+ if ($is_dhtml_editor) {
+ return "if (document.getElementById('tx_{$id}') && jQuery.inArray(ed_{$id}.outputBodyHTML().toLowerCase().replace(/^\s*|\s*$/g, ''), [' ','
','
','
','','
','']) != -1) { alert(\"내용을 입력해 주십시오.\"); ed_{$id}.returnFalse(); return false; }\n";
+ } else {
+ return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
+ }
+}
+
+/*
+https://github.com/timostamm/NonceUtil-PHP
+*/
+
+if (!defined('FT_NONCE_UNIQUE_KEY'))
+ define( 'FT_NONCE_UNIQUE_KEY' , sha1($_SERVER['SERVER_SOFTWARE'].G5_MYSQL_USER.session_id().G5_TABLE_PREFIX) );
+
+if (!defined('FT_NONCE_SESSION_KEY'))
+ define( 'FT_NONCE_SESSION_KEY' , substr(md5(FT_NONCE_UNIQUE_KEY), 5) );
+
+if (!defined('FT_NONCE_DURATION'))
+ define( 'FT_NONCE_DURATION' , 60 * 30 ); // 300 makes link or form good for 5 minutes from time of generation, 300은 5분간 유효, 60 * 60 은 1시간
+
+if (!defined('FT_NONCE_KEY'))
+ define( 'FT_NONCE_KEY' , '_nonce' );
+
+// This method creates a key / value pair for a url string
+if(!function_exists('ft_nonce_create_query_string')){
+ function ft_nonce_create_query_string( $action = '' , $user = '' ){
+ return FT_NONCE_KEY."=".ft_nonce_create( $action , $user );
+ }
+}
+
+if(!function_exists('ft_get_secret_key')){
+ function ft_get_secret_key($secret){
+ return md5(FT_NONCE_UNIQUE_KEY.$secret);
+ }
+}
+
+// This method creates an nonce. It should be called by one of the previous two functions.
+if(!function_exists('ft_nonce_create')){
+ function ft_nonce_create( $action = '',$user='', $timeoutSeconds=FT_NONCE_DURATION ){
+
+ $secret = ft_get_secret_key($action.$user);
+
+ $salt = ft_nonce_generate_hash();
+ $time = time();
+ $maxTime = $time + $timeoutSeconds;
+ $nonce = $salt . "|" . $maxTime . "|" . sha1( $salt . $secret . $maxTime );
+
+ set_session('nonce_'.FT_NONCE_SESSION_KEY, $nonce);
+
+ return $nonce;
+
+ }
+}
+
+// This method validates an nonce
+if(!function_exists('ft_nonce_is_valid')){
+ function ft_nonce_is_valid( $nonce, $action = '', $user='' ){
+
+ $secret = ft_get_secret_key($action.$user);
+
+ if (is_string($nonce) == false) {
+ return false;
+ }
+ $a = explode('|', $nonce);
+ if (count($a) != 3) {
+ return false;
+ }
+ $salt = $a[0];
+ $maxTime = intval($a[1]);
+ $hash = $a[2];
+ $back = sha1( $salt . $secret . $maxTime );
+ if ($back != $hash) {
+ return false;
+ }
+ if (time() > $maxTime) {
+ return false;
+ }
+ return true;
+ }
+}
+
+// This method generates the nonce timestamp
+if(!function_exists('ft_nonce_generate_hash')){
+ function ft_nonce_generate_hash(){
+ $length = 10;
+ $chars='1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
+ $ll = strlen($chars)-1;
+ $o = '';
+ while (strlen($o) < $length) {
+ $o .= $chars[ rand(0, $ll) ];
+ }
+ return $o;
+ }
+}
+?>
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/icons/add_col_after.png b/plugin/editor/cheditor5/icons/add_col_after.png
new file mode 100644
index 000000000..8a3931455
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_col_after.png differ
diff --git a/plugin/editor/cheditor5/icons/add_col_before.png b/plugin/editor/cheditor5/icons/add_col_before.png
new file mode 100644
index 000000000..d8f3a56cc
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_col_before.png differ
diff --git a/plugin/editor/cheditor5/icons/add_cols_after.png b/plugin/editor/cheditor5/icons/add_cols_after.png
new file mode 100644
index 000000000..d177a0418
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_cols_after.png differ
diff --git a/plugin/editor/cheditor5/icons/add_cols_before.png b/plugin/editor/cheditor5/icons/add_cols_before.png
new file mode 100644
index 000000000..b03cbda4f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_cols_before.png differ
diff --git a/plugin/editor/cheditor5/icons/add_row_after.png b/plugin/editor/cheditor5/icons/add_row_after.png
new file mode 100644
index 000000000..80c449098
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_row_after.png differ
diff --git a/plugin/editor/cheditor5/icons/add_row_before.png b/plugin/editor/cheditor5/icons/add_row_before.png
new file mode 100644
index 000000000..9cff358ae
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_row_before.png differ
diff --git a/plugin/editor/cheditor5/icons/add_rows_after.png b/plugin/editor/cheditor5/icons/add_rows_after.png
new file mode 100644
index 000000000..579a2db0a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_rows_after.png differ
diff --git a/plugin/editor/cheditor5/icons/add_rows_before.png b/plugin/editor/cheditor5/icons/add_rows_before.png
new file mode 100644
index 000000000..45d46b4b0
Binary files /dev/null and b/plugin/editor/cheditor5/icons/add_rows_before.png differ
diff --git a/plugin/editor/cheditor5/icons/button/cancel.gif b/plugin/editor/cheditor5/icons/button/cancel.gif
new file mode 100644
index 000000000..434323b08
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/cancel.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/color_picker.gif b/plugin/editor/cheditor5/icons/button/color_picker.gif
new file mode 100644
index 000000000..16826bfb7
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/color_picker.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/color_picker.png b/plugin/editor/cheditor5/icons/button/color_picker.png
new file mode 100644
index 000000000..3b8cf1da0
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/color_picker.png differ
diff --git a/plugin/editor/cheditor5/icons/button/color_picker_disable.png b/plugin/editor/cheditor5/icons/button/color_picker_disable.png
new file mode 100644
index 000000000..34d8a2292
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/color_picker_disable.png differ
diff --git a/plugin/editor/cheditor5/icons/button/delete.gif b/plugin/editor/cheditor5/icons/button/delete.gif
new file mode 100644
index 000000000..5a03749f6
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/delete.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/delete_cross.gif b/plugin/editor/cheditor5/icons/button/delete_cross.gif
new file mode 100644
index 000000000..449d63a27
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/delete_cross.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/edit_cell.gif b/plugin/editor/cheditor5/icons/button/edit_cell.gif
new file mode 100644
index 000000000..6022fc400
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/edit_cell.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/edit_image.gif b/plugin/editor/cheditor5/icons/button/edit_image.gif
new file mode 100644
index 000000000..7bf05a0e8
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/edit_image.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/input.gif b/plugin/editor/cheditor5/icons/button/input.gif
new file mode 100644
index 000000000..ef9316e54
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/input.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/input_color.gif b/plugin/editor/cheditor5/icons/button/input_color.gif
new file mode 100644
index 000000000..3f7188068
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/input_color.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/map_address.gif b/plugin/editor/cheditor5/icons/button/map_address.gif
new file mode 100644
index 000000000..18feee9da
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/map_address.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/paste.gif b/plugin/editor/cheditor5/icons/button/paste.gif
new file mode 100644
index 000000000..debe8505e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/paste.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/play.gif b/plugin/editor/cheditor5/icons/button/play.gif
new file mode 100644
index 000000000..d7da13820
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/play.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/preview.gif b/plugin/editor/cheditor5/icons/button/preview.gif
new file mode 100644
index 000000000..9ec331fe8
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/preview.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/process.gif b/plugin/editor/cheditor5/icons/button/process.gif
new file mode 100644
index 000000000..8c33eb269
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/process.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/reset.gif b/plugin/editor/cheditor5/icons/button/reset.gif
new file mode 100644
index 000000000..9cce769de
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/reset.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/submit.gif b/plugin/editor/cheditor5/icons/button/submit.gif
new file mode 100644
index 000000000..3e5af8d64
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/submit.gif differ
diff --git a/plugin/editor/cheditor5/icons/button/upload.gif b/plugin/editor/cheditor5/icons/button/upload.gif
new file mode 100644
index 000000000..1accaba05
Binary files /dev/null and b/plugin/editor/cheditor5/icons/button/upload.gif differ
diff --git a/plugin/editor/cheditor5/icons/checked.png b/plugin/editor/cheditor5/icons/checked.png
new file mode 100644
index 000000000..029325ef6
Binary files /dev/null and b/plugin/editor/cheditor5/icons/checked.png differ
diff --git a/plugin/editor/cheditor5/icons/color_picker.png b/plugin/editor/cheditor5/icons/color_picker.png
new file mode 100644
index 000000000..3ed7f5589
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker.png differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_arrow.gif b/plugin/editor/cheditor5/icons/color_picker_arrow.gif
new file mode 100644
index 000000000..246478a86
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_arrow.gif differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_cross.gif b/plugin/editor/cheditor5/icons/color_picker_cross.gif
new file mode 100644
index 000000000..089b6d159
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_cross.gif differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_hs.png b/plugin/editor/cheditor5/icons/color_picker_hs.png
new file mode 100644
index 000000000..3d94486ce
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_hs.png differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_hv.png b/plugin/editor/cheditor5/icons/color_picker_hv.png
new file mode 100644
index 000000000..1c5e01f8b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_hv.png differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_reset.png b/plugin/editor/cheditor5/icons/color_picker_reset.png
new file mode 100644
index 000000000..ba719a746
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_reset.png differ
diff --git a/plugin/editor/cheditor5/icons/color_picker_tick.png b/plugin/editor/cheditor5/icons/color_picker_tick.png
new file mode 100644
index 000000000..a48d9da7d
Binary files /dev/null and b/plugin/editor/cheditor5/icons/color_picker_tick.png differ
diff --git a/plugin/editor/cheditor5/icons/delete_element.png b/plugin/editor/cheditor5/icons/delete_element.png
new file mode 100644
index 000000000..80e1db21f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/delete_element.png differ
diff --git a/plugin/editor/cheditor5/icons/delete_table.png b/plugin/editor/cheditor5/icons/delete_table.png
new file mode 100644
index 000000000..87805c966
Binary files /dev/null and b/plugin/editor/cheditor5/icons/delete_table.png differ
diff --git a/plugin/editor/cheditor5/icons/dot.gif b/plugin/editor/cheditor5/icons/dot.gif
new file mode 100644
index 000000000..1d11fa9ad
Binary files /dev/null and b/plugin/editor/cheditor5/icons/dot.gif differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_code_a.png b/plugin/editor/cheditor5/icons/edit_mode_code_a.png
new file mode 100644
index 000000000..31f00d9db
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_code_a.png differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_code_b.png b/plugin/editor/cheditor5/icons/edit_mode_code_b.png
new file mode 100644
index 000000000..2ced606d5
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_code_b.png differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_rich_a.png b/plugin/editor/cheditor5/icons/edit_mode_rich_a.png
new file mode 100644
index 000000000..497b4e859
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_rich_a.png differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_rich_b.png b/plugin/editor/cheditor5/icons/edit_mode_rich_b.png
new file mode 100644
index 000000000..732f8253d
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_rich_b.png differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_view_a.png b/plugin/editor/cheditor5/icons/edit_mode_view_a.png
new file mode 100644
index 000000000..e14add229
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_view_a.png differ
diff --git a/plugin/editor/cheditor5/icons/edit_mode_view_b.png b/plugin/editor/cheditor5/icons/edit_mode_view_b.png
new file mode 100644
index 000000000..29fe9077a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/edit_mode_view_b.png differ
diff --git a/plugin/editor/cheditor5/icons/em/1.gif b/plugin/editor/cheditor5/icons/em/1.gif
new file mode 100644
index 000000000..192f26f6a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/1.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/10.gif b/plugin/editor/cheditor5/icons/em/10.gif
new file mode 100644
index 000000000..67dabd59f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/10.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/11.gif b/plugin/editor/cheditor5/icons/em/11.gif
new file mode 100644
index 000000000..aab89b103
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/11.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/12.gif b/plugin/editor/cheditor5/icons/em/12.gif
new file mode 100644
index 000000000..dcc1c8f64
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/12.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/13.gif b/plugin/editor/cheditor5/icons/em/13.gif
new file mode 100644
index 000000000..221e0f2e2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/13.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/14.gif b/plugin/editor/cheditor5/icons/em/14.gif
new file mode 100644
index 000000000..c2184a3d7
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/14.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/15.gif b/plugin/editor/cheditor5/icons/em/15.gif
new file mode 100644
index 000000000..adb78d17a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/15.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/16.gif b/plugin/editor/cheditor5/icons/em/16.gif
new file mode 100644
index 000000000..164bcce0f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/16.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/17.gif b/plugin/editor/cheditor5/icons/em/17.gif
new file mode 100644
index 000000000..79382ce8a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/17.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/18.gif b/plugin/editor/cheditor5/icons/em/18.gif
new file mode 100644
index 000000000..ff0eb9652
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/18.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/19.gif b/plugin/editor/cheditor5/icons/em/19.gif
new file mode 100644
index 000000000..1097e0087
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/19.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/2.gif b/plugin/editor/cheditor5/icons/em/2.gif
new file mode 100644
index 000000000..9c83e50cc
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/2.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/20.gif b/plugin/editor/cheditor5/icons/em/20.gif
new file mode 100644
index 000000000..e55ec3081
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/20.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/21.gif b/plugin/editor/cheditor5/icons/em/21.gif
new file mode 100644
index 000000000..0186a11a7
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/21.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/22.gif b/plugin/editor/cheditor5/icons/em/22.gif
new file mode 100644
index 000000000..c46dec6cc
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/22.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/23.gif b/plugin/editor/cheditor5/icons/em/23.gif
new file mode 100644
index 000000000..aacda1a15
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/23.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/24.gif b/plugin/editor/cheditor5/icons/em/24.gif
new file mode 100644
index 000000000..3afc89869
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/24.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/25.gif b/plugin/editor/cheditor5/icons/em/25.gif
new file mode 100644
index 000000000..0e26fe05c
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/25.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/26.gif b/plugin/editor/cheditor5/icons/em/26.gif
new file mode 100644
index 000000000..4dfcdab22
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/26.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/27.gif b/plugin/editor/cheditor5/icons/em/27.gif
new file mode 100644
index 000000000..8aae5c516
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/27.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/28.gif b/plugin/editor/cheditor5/icons/em/28.gif
new file mode 100644
index 000000000..c3aee8660
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/28.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/29.gif b/plugin/editor/cheditor5/icons/em/29.gif
new file mode 100644
index 000000000..39cc0c286
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/29.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/3.gif b/plugin/editor/cheditor5/icons/em/3.gif
new file mode 100644
index 000000000..b68cfb128
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/3.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/30.gif b/plugin/editor/cheditor5/icons/em/30.gif
new file mode 100644
index 000000000..51054ede6
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/30.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/31.gif b/plugin/editor/cheditor5/icons/em/31.gif
new file mode 100644
index 000000000..51e9ab344
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/31.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/32.gif b/plugin/editor/cheditor5/icons/em/32.gif
new file mode 100644
index 000000000..3d084cc8b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/32.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/33.gif b/plugin/editor/cheditor5/icons/em/33.gif
new file mode 100644
index 000000000..465a86764
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/33.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/34.gif b/plugin/editor/cheditor5/icons/em/34.gif
new file mode 100644
index 000000000..b7c2bb619
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/34.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/35.gif b/plugin/editor/cheditor5/icons/em/35.gif
new file mode 100644
index 000000000..9e006337c
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/35.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/36.gif b/plugin/editor/cheditor5/icons/em/36.gif
new file mode 100644
index 000000000..779454291
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/36.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/37.gif b/plugin/editor/cheditor5/icons/em/37.gif
new file mode 100644
index 000000000..e21691762
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/37.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/38.gif b/plugin/editor/cheditor5/icons/em/38.gif
new file mode 100644
index 000000000..76a9e13b2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/38.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/39.gif b/plugin/editor/cheditor5/icons/em/39.gif
new file mode 100644
index 000000000..f3fd4e7b4
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/39.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/4.gif b/plugin/editor/cheditor5/icons/em/4.gif
new file mode 100644
index 000000000..99851b3f5
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/4.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/40.gif b/plugin/editor/cheditor5/icons/em/40.gif
new file mode 100644
index 000000000..40f2ac17b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/40.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/41.gif b/plugin/editor/cheditor5/icons/em/41.gif
new file mode 100644
index 000000000..5af0bb1f4
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/41.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/42.gif b/plugin/editor/cheditor5/icons/em/42.gif
new file mode 100644
index 000000000..e5dfb8dc7
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/42.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/43.gif b/plugin/editor/cheditor5/icons/em/43.gif
new file mode 100644
index 000000000..c54a84c50
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/43.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/44.gif b/plugin/editor/cheditor5/icons/em/44.gif
new file mode 100644
index 000000000..ca4abf9e2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/44.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/45.gif b/plugin/editor/cheditor5/icons/em/45.gif
new file mode 100644
index 000000000..9efbf4752
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/45.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/46.gif b/plugin/editor/cheditor5/icons/em/46.gif
new file mode 100644
index 000000000..687b4f41f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/46.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/47.gif b/plugin/editor/cheditor5/icons/em/47.gif
new file mode 100644
index 000000000..8fc0b3563
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/47.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/48.gif b/plugin/editor/cheditor5/icons/em/48.gif
new file mode 100644
index 000000000..7467a5a12
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/48.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/49.gif b/plugin/editor/cheditor5/icons/em/49.gif
new file mode 100644
index 000000000..3baf57d92
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/49.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/5.gif b/plugin/editor/cheditor5/icons/em/5.gif
new file mode 100644
index 000000000..50e09671f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/5.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/50.gif b/plugin/editor/cheditor5/icons/em/50.gif
new file mode 100644
index 000000000..f9e49d644
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/50.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/51.gif b/plugin/editor/cheditor5/icons/em/51.gif
new file mode 100644
index 000000000..2bcbccde9
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/51.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/52.gif b/plugin/editor/cheditor5/icons/em/52.gif
new file mode 100644
index 000000000..72e7ecdfc
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/52.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/53.gif b/plugin/editor/cheditor5/icons/em/53.gif
new file mode 100644
index 000000000..91f1e96bf
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/53.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/54.gif b/plugin/editor/cheditor5/icons/em/54.gif
new file mode 100644
index 000000000..3b0b8d3d2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/54.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/55.gif b/plugin/editor/cheditor5/icons/em/55.gif
new file mode 100644
index 000000000..28679aae5
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/55.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/56.gif b/plugin/editor/cheditor5/icons/em/56.gif
new file mode 100644
index 000000000..9d46e2964
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/56.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/57.gif b/plugin/editor/cheditor5/icons/em/57.gif
new file mode 100644
index 000000000..94540e86b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/57.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/58.gif b/plugin/editor/cheditor5/icons/em/58.gif
new file mode 100644
index 000000000..4f7cefdad
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/58.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/59.gif b/plugin/editor/cheditor5/icons/em/59.gif
new file mode 100644
index 000000000..6324cf14d
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/59.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/6.gif b/plugin/editor/cheditor5/icons/em/6.gif
new file mode 100644
index 000000000..e39f4cf22
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/6.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/60.gif b/plugin/editor/cheditor5/icons/em/60.gif
new file mode 100644
index 000000000..83f401007
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/60.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/61.gif b/plugin/editor/cheditor5/icons/em/61.gif
new file mode 100644
index 000000000..5c297e388
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/61.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/62.gif b/plugin/editor/cheditor5/icons/em/62.gif
new file mode 100644
index 000000000..71c0c8979
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/62.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/63.gif b/plugin/editor/cheditor5/icons/em/63.gif
new file mode 100644
index 000000000..a66a51b03
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/63.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/64.gif b/plugin/editor/cheditor5/icons/em/64.gif
new file mode 100644
index 000000000..e5cb6ca06
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/64.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/65.gif b/plugin/editor/cheditor5/icons/em/65.gif
new file mode 100644
index 000000000..027f28edf
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/65.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/66.gif b/plugin/editor/cheditor5/icons/em/66.gif
new file mode 100644
index 000000000..faca98013
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/66.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/67.gif b/plugin/editor/cheditor5/icons/em/67.gif
new file mode 100644
index 000000000..42bd45300
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/67.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/68.gif b/plugin/editor/cheditor5/icons/em/68.gif
new file mode 100644
index 000000000..214345180
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/68.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/69.gif b/plugin/editor/cheditor5/icons/em/69.gif
new file mode 100644
index 000000000..0f9a4de5c
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/69.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/7.gif b/plugin/editor/cheditor5/icons/em/7.gif
new file mode 100644
index 000000000..330fc953c
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/7.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/70.gif b/plugin/editor/cheditor5/icons/em/70.gif
new file mode 100644
index 000000000..c107a14af
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/70.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/71.gif b/plugin/editor/cheditor5/icons/em/71.gif
new file mode 100644
index 000000000..62618d659
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/71.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/72.gif b/plugin/editor/cheditor5/icons/em/72.gif
new file mode 100644
index 000000000..6764e3228
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/72.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/73.gif b/plugin/editor/cheditor5/icons/em/73.gif
new file mode 100644
index 000000000..29ecc580e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/73.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/74.gif b/plugin/editor/cheditor5/icons/em/74.gif
new file mode 100644
index 000000000..18d684e76
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/74.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/75.gif b/plugin/editor/cheditor5/icons/em/75.gif
new file mode 100644
index 000000000..18a7b9220
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/75.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/76.gif b/plugin/editor/cheditor5/icons/em/76.gif
new file mode 100644
index 000000000..ebdb2c942
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/76.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/77.gif b/plugin/editor/cheditor5/icons/em/77.gif
new file mode 100644
index 000000000..0a996d59e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/77.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/78.gif b/plugin/editor/cheditor5/icons/em/78.gif
new file mode 100644
index 000000000..972a21d83
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/78.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/79.gif b/plugin/editor/cheditor5/icons/em/79.gif
new file mode 100644
index 000000000..3fa89d82e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/79.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/8.gif b/plugin/editor/cheditor5/icons/em/8.gif
new file mode 100644
index 000000000..b573e9b3e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/8.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/80.gif b/plugin/editor/cheditor5/icons/em/80.gif
new file mode 100644
index 000000000..84e3ca417
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/80.gif differ
diff --git a/plugin/editor/cheditor5/icons/em/9.gif b/plugin/editor/cheditor5/icons/em/9.gif
new file mode 100644
index 000000000..1521dd484
Binary files /dev/null and b/plugin/editor/cheditor5/icons/em/9.gif differ
diff --git a/plugin/editor/cheditor5/icons/fullscreen.png b/plugin/editor/cheditor5/icons/fullscreen.png
new file mode 100644
index 000000000..4111243ac
Binary files /dev/null and b/plugin/editor/cheditor5/icons/fullscreen.png differ
diff --git a/plugin/editor/cheditor5/icons/fullscreen_actual.png b/plugin/editor/cheditor5/icons/fullscreen_actual.png
new file mode 100644
index 000000000..60de27e99
Binary files /dev/null and b/plugin/editor/cheditor5/icons/fullscreen_actual.png differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/add.gif b/plugin/editor/cheditor5/icons/imageUpload/add.gif
new file mode 100644
index 000000000..5db2a6688
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/add.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/cross-small.png b/plugin/editor/cheditor5/icons/imageUpload/cross-small.png
new file mode 100644
index 000000000..2de4c1203
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/cross-small.png differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/delete.png b/plugin/editor/cheditor5/icons/imageUpload/delete.png
new file mode 100644
index 000000000..8f11cfc75
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/delete.png differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/dot.gif b/plugin/editor/cheditor5/icons/imageUpload/dot.gif
new file mode 100644
index 000000000..1d11fa9ad
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/dot.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/loader.gif b/plugin/editor/cheditor5/icons/imageUpload/loader.gif
new file mode 100644
index 000000000..d42f72c72
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/loader.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/marker_bottom.gif b/plugin/editor/cheditor5/icons/imageUpload/marker_bottom.gif
new file mode 100644
index 000000000..daa101c00
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/marker_bottom.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/marker_middle.gif b/plugin/editor/cheditor5/icons/imageUpload/marker_middle.gif
new file mode 100644
index 000000000..a854393c4
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/marker_middle.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/marker_top.gif b/plugin/editor/cheditor5/icons/imageUpload/marker_top.gif
new file mode 100644
index 000000000..daa101c00
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/marker_top.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/mouse_drag_img.gif b/plugin/editor/cheditor5/icons/imageUpload/mouse_drag_img.gif
new file mode 100644
index 000000000..4cd7fe127
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/mouse_drag_img.gif differ
diff --git a/plugin/editor/cheditor5/icons/imageUpload/remove_all.gif b/plugin/editor/cheditor5/icons/imageUpload/remove_all.gif
new file mode 100644
index 000000000..fcda632fd
Binary files /dev/null and b/plugin/editor/cheditor5/icons/imageUpload/remove_all.gif differ
diff --git a/plugin/editor/cheditor5/icons/image_align_center.png b/plugin/editor/cheditor5/icons/image_align_center.png
new file mode 100644
index 000000000..d2ee3baad
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_align_center.png differ
diff --git a/plugin/editor/cheditor5/icons/image_align_left.png b/plugin/editor/cheditor5/icons/image_align_left.png
new file mode 100644
index 000000000..7195ef77b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_align_left.png differ
diff --git a/plugin/editor/cheditor5/icons/image_align_left_wt.png b/plugin/editor/cheditor5/icons/image_align_left_wt.png
new file mode 100644
index 000000000..7cc2f5a4b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_align_left_wt.png differ
diff --git a/plugin/editor/cheditor5/icons/image_align_right.png b/plugin/editor/cheditor5/icons/image_align_right.png
new file mode 100644
index 000000000..2705dcb82
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_align_right.png differ
diff --git a/plugin/editor/cheditor5/icons/image_align_right_wt.png b/plugin/editor/cheditor5/icons/image_align_right_wt.png
new file mode 100644
index 000000000..16b0cf6d2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_align_right_wt.png differ
diff --git a/plugin/editor/cheditor5/icons/image_resize.png b/plugin/editor/cheditor5/icons/image_resize.png
new file mode 100644
index 000000000..a1eb71979
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_resize.png differ
diff --git a/plugin/editor/cheditor5/icons/image_wrap_text.png b/plugin/editor/cheditor5/icons/image_wrap_text.png
new file mode 100644
index 000000000..7cc2f5a4b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/image_wrap_text.png differ
diff --git a/plugin/editor/cheditor5/icons/magnifier-zoom.png b/plugin/editor/cheditor5/icons/magnifier-zoom.png
new file mode 100644
index 000000000..77e03059a
Binary files /dev/null and b/plugin/editor/cheditor5/icons/magnifier-zoom.png differ
diff --git a/plugin/editor/cheditor5/icons/readonlymode.png b/plugin/editor/cheditor5/icons/readonlymode.png
new file mode 100644
index 000000000..f1c5c2420
Binary files /dev/null and b/plugin/editor/cheditor5/icons/readonlymode.png differ
diff --git a/plugin/editor/cheditor5/icons/remove_col.png b/plugin/editor/cheditor5/icons/remove_col.png
new file mode 100644
index 000000000..2193adef8
Binary files /dev/null and b/plugin/editor/cheditor5/icons/remove_col.png differ
diff --git a/plugin/editor/cheditor5/icons/remove_cols.png b/plugin/editor/cheditor5/icons/remove_cols.png
new file mode 100644
index 000000000..fdbfcd914
Binary files /dev/null and b/plugin/editor/cheditor5/icons/remove_cols.png differ
diff --git a/plugin/editor/cheditor5/icons/remove_row.png b/plugin/editor/cheditor5/icons/remove_row.png
new file mode 100644
index 000000000..8a82c6b33
Binary files /dev/null and b/plugin/editor/cheditor5/icons/remove_row.png differ
diff --git a/plugin/editor/cheditor5/icons/remove_rows.png b/plugin/editor/cheditor5/icons/remove_rows.png
new file mode 100644
index 000000000..e2d9588f2
Binary files /dev/null and b/plugin/editor/cheditor5/icons/remove_rows.png differ
diff --git a/plugin/editor/cheditor5/icons/splitter.gif b/plugin/editor/cheditor5/icons/splitter.gif
new file mode 100644
index 000000000..660bb40df
Binary files /dev/null and b/plugin/editor/cheditor5/icons/splitter.gif differ
diff --git a/plugin/editor/cheditor5/icons/statusbar_bgline.gif b/plugin/editor/cheditor5/icons/statusbar_bgline.gif
new file mode 100644
index 000000000..850fdecf5
Binary files /dev/null and b/plugin/editor/cheditor5/icons/statusbar_bgline.gif differ
diff --git a/plugin/editor/cheditor5/icons/table_delete_cell.png b/plugin/editor/cheditor5/icons/table_delete_cell.png
new file mode 100644
index 000000000..38dfcec15
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_delete_cell.png differ
diff --git a/plugin/editor/cheditor5/icons/table_delete_column.png b/plugin/editor/cheditor5/icons/table_delete_column.png
new file mode 100644
index 000000000..ea515ca89
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_delete_column.png differ
diff --git a/plugin/editor/cheditor5/icons/table_delete_row.png b/plugin/editor/cheditor5/icons/table_delete_row.png
new file mode 100644
index 000000000..cb4083c66
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_delete_row.png differ
diff --git a/plugin/editor/cheditor5/icons/table_insert_cell.png b/plugin/editor/cheditor5/icons/table_insert_cell.png
new file mode 100644
index 000000000..bc70ca07d
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_insert_cell.png differ
diff --git a/plugin/editor/cheditor5/icons/table_insert_column.png b/plugin/editor/cheditor5/icons/table_insert_column.png
new file mode 100644
index 000000000..a2f7f5a85
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_insert_column.png differ
diff --git a/plugin/editor/cheditor5/icons/table_insert_row.png b/plugin/editor/cheditor5/icons/table_insert_row.png
new file mode 100644
index 000000000..dda90a344
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_insert_row.png differ
diff --git a/plugin/editor/cheditor5/icons/table_join.png b/plugin/editor/cheditor5/icons/table_join.png
new file mode 100644
index 000000000..a5c0f9db9
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_join.png differ
diff --git a/plugin/editor/cheditor5/icons/table_join_column.png b/plugin/editor/cheditor5/icons/table_join_column.png
new file mode 100644
index 000000000..830afd95e
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_join_column.png differ
diff --git a/plugin/editor/cheditor5/icons/table_join_row.png b/plugin/editor/cheditor5/icons/table_join_row.png
new file mode 100644
index 000000000..c77e75c10
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_join_row.png differ
diff --git a/plugin/editor/cheditor5/icons/table_split_column.png b/plugin/editor/cheditor5/icons/table_split_column.png
new file mode 100644
index 000000000..f7dc6c154
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_split_column.png differ
diff --git a/plugin/editor/cheditor5/icons/table_split_row.png b/plugin/editor/cheditor5/icons/table_split_row.png
new file mode 100644
index 000000000..55b822e2f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/table_split_row.png differ
diff --git a/plugin/editor/cheditor5/icons/title_bar_bg.gif b/plugin/editor/cheditor5/icons/title_bar_bg.gif
new file mode 100644
index 000000000..13e78660f
Binary files /dev/null and b/plugin/editor/cheditor5/icons/title_bar_bg.gif differ
diff --git a/plugin/editor/cheditor5/icons/title_bar_bg2.gif b/plugin/editor/cheditor5/icons/title_bar_bg2.gif
new file mode 100644
index 000000000..86617c6c5
Binary files /dev/null and b/plugin/editor/cheditor5/icons/title_bar_bg2.gif differ
diff --git a/plugin/editor/cheditor5/icons/toolbar-background.png b/plugin/editor/cheditor5/icons/toolbar-background.png
new file mode 100644
index 000000000..22de6225b
Binary files /dev/null and b/plugin/editor/cheditor5/icons/toolbar-background.png differ
diff --git a/plugin/editor/cheditor5/icons/toolbar-wrapper-bg.png b/plugin/editor/cheditor5/icons/toolbar-wrapper-bg.png
new file mode 100644
index 000000000..f3c1f7530
Binary files /dev/null and b/plugin/editor/cheditor5/icons/toolbar-wrapper-bg.png differ
diff --git a/plugin/editor/cheditor5/icons/toolbar.png b/plugin/editor/cheditor5/icons/toolbar.png
new file mode 100644
index 000000000..6c81e8825
Binary files /dev/null and b/plugin/editor/cheditor5/icons/toolbar.png differ
diff --git a/plugin/editor/cheditor5/icons/viewmode_code.png b/plugin/editor/cheditor5/icons/viewmode_code.png
new file mode 100644
index 000000000..b046f1689
Binary files /dev/null and b/plugin/editor/cheditor5/icons/viewmode_code.png differ
diff --git a/plugin/editor/cheditor5/icons/viewmode_preview.png b/plugin/editor/cheditor5/icons/viewmode_preview.png
new file mode 100644
index 000000000..bd6df170c
Binary files /dev/null and b/plugin/editor/cheditor5/icons/viewmode_preview.png differ
diff --git a/plugin/editor/cheditor5/icons/watermark.png b/plugin/editor/cheditor5/icons/watermark.png
new file mode 100644
index 000000000..071fb3fcc
Binary files /dev/null and b/plugin/editor/cheditor5/icons/watermark.png differ
diff --git a/plugin/editor/cheditor5/imageUpload/_common.php b/plugin/editor/cheditor5/imageUpload/_common.php
new file mode 100644
index 000000000..6d489dacb
--- /dev/null
+++ b/plugin/editor/cheditor5/imageUpload/_common.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/imageUpload/config.php b/plugin/editor/cheditor5/imageUpload/config.php
new file mode 100644
index 000000000..ac4e4956c
--- /dev/null
+++ b/plugin/editor/cheditor5/imageUpload/config.php
@@ -0,0 +1,71 @@
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/imageUpload/delete.php b/plugin/editor/cheditor5/imageUpload/delete.php
new file mode 100644
index 000000000..0da4fc8f3
--- /dev/null
+++ b/plugin/editor/cheditor5/imageUpload/delete.php
@@ -0,0 +1,49 @@
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/imageUpload/upload.php b/plugin/editor/cheditor5/imageUpload/upload.php
new file mode 100644
index 000000000..73e3700a2
--- /dev/null
+++ b/plugin/editor/cheditor5/imageUpload/upload.php
@@ -0,0 +1,128 @@
+ array("imagecreatefromgif", "imagegif"),
+ "image/jpg" => array("imagecreatefromjpeg", "imagejpeg"),
+ "image/jpeg" => array("imagecreatefromjpeg", "imagejpeg"),
+ "image/png" => array("imagecreatefrompng", "imagepng"),
+ "image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
+ );
+
+ // Extracting mime type using getimagesize
+ try {
+ $image_info = getimagesize($file_path);
+ if ($image_info === null) {
+ //throw new Exception("Invalid image type");
+ return false;
+ }
+
+ $mime_type = $image_info["mime"];
+
+ if (!array_key_exists($mime_type, $MIME_TYPES_PROCESSORS)) {
+ //throw new Exception("Invalid image MIME type");
+ return false;
+ }
+
+ $image_from_file = $MIME_TYPES_PROCESSORS[$mime_type][0];
+ $image_to_file = $MIME_TYPES_PROCESSORS[$mime_type][1];
+
+ $reprocessed_image = @$image_from_file($file_path);
+
+ if (!$reprocessed_image) {
+ //throw new Exception("Unable to create reprocessed image from file");
+ return false;
+ }
+
+ // Calling callback(if set) with path of image as a parameter
+ if ($callback !== null) {
+ $callback($reprocessed_image);
+ }
+
+ // Freeing up memory
+ imagedestroy($reprocessed_image);
+ } catch (Exception $e) {
+ unlink($file_path);
+ return false;
+ }
+
+ return true;
+ }
+}
+
+$is_editor_upload = false;
+
+$get_nonce = get_session('nonce_'.FT_NONCE_SESSION_KEY);
+
+if( $get_nonce && ft_nonce_is_valid( $get_nonce, 'cheditor' ) ){
+ $is_editor_upload = true;
+}
+
+if( !$is_editor_upload ){
+ exit;
+}
+
+//----------------------------------------------------------------------------
+//
+//
+$tempfile = $_FILES['file']['tmp_name'];
+$filename = $_FILES['file']['name'];
+
+$type = substr($filename, strrpos($filename, ".")+1);
+$found = false;
+switch ($type) {
+ case "jpg":
+ case "jpeg":
+ case "gif":
+ case "png":
+ $found = true;
+}
+
+if ($found != true) {
+ exit;
+}
+
+// ̸: Ͻú_8
+// 20140327125959_abcdefghi.jpg
+// ̸: $_POST["origname"]
+
+$filename = che_replace_filename($filename);
+$savefile = SAVE_DIR . '/' . $filename;
+
+move_uploaded_file($tempfile, $savefile);
+$imgsize = getimagesize($savefile);
+$filesize = filesize($savefile);
+
+if (!$imgsize) {
+ $filesize = 0;
+ $random_name = '-ERR';
+ unlink($savefile);
+};
+
+if ( CHE_UPLOAD_IMG_CHECK && ! che_reprocessImage($savefile, null) ){
+ $filesize = 0;
+ $random_name = '-ERR';
+ unlink($savefile);
+}
+
+try {
+ if(defined('G5_FILE_PERMISSION')) chmod($savefile, G5_FILE_PERMISSION);
+} catch (Exception $e) {
+}
+
+$rdata = sprintf('{"fileUrl": "%s/%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }',
+ SAVE_URL,
+ $filename,
+ $savefile,
+ $filename,
+ $filesize );
+
+echo $rdata;
+?>
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/color_picker.html b/plugin/editor/cheditor5/popup/color_picker.html
new file mode 100644
index 000000000..dc972df57
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/color_picker.html
@@ -0,0 +1,19 @@
+
+
+
+CHEditor
+
+
+
+
+
+
+
+
+현재 셀 색상:
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/flash.html b/plugin/editor/cheditor5/popup/flash.html
new file mode 100644
index 000000000..f0e82b894
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/flash.html
@@ -0,0 +1,22 @@
+
+
+
+CHEditor
+
+
+
+
+
+
+
+
+
+ <동영상 소스 코드> iframe 또는 object 태그를 입력하세요.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/flash/ImagePreview.swf b/plugin/editor/cheditor5/popup/flash/ImagePreview.swf
new file mode 100644
index 000000000..87e4f7558
Binary files /dev/null and b/plugin/editor/cheditor5/popup/flash/ImagePreview.swf differ
diff --git a/plugin/editor/cheditor5/popup/flash/chximage.swf b/plugin/editor/cheditor5/popup/flash/chximage.swf
new file mode 100644
index 000000000..f4e11c21c
Binary files /dev/null and b/plugin/editor/cheditor5/popup/flash/chximage.swf differ
diff --git a/plugin/editor/cheditor5/popup/google_map.html b/plugin/editor/cheditor5/popup/google_map.html
new file mode 100644
index 000000000..5f7ed0955
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/google_map.html
@@ -0,0 +1,23 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
찾을 주소:
+
+
+
찾으실 도로명 주소, 지번 또는 건물명을 입력하세요.
+
+
+
+
+
+
diff --git a/plugin/editor/cheditor5/popup/icon.html b/plugin/editor/cheditor5/popup/icon.html
new file mode 100644
index 000000000..5f54f1f8f
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/icon.html
@@ -0,0 +1,15 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/image.html b/plugin/editor/cheditor5/popup/image.html
new file mode 100644
index 000000000..a09bbf75f
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/image.html
@@ -0,0 +1,76 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ (사진을 드래그하여 순서를 바꿀 수 있습니다.)
+ 0장 / 최대 장 사진
+ |
+
+
+
+
+
+
사진 정보
+
+
가로: 0
+
세로: 0
+
이름: 없음
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/image.html5.html b/plugin/editor/cheditor5/popup/image.html5.html
new file mode 100644
index 000000000..c5f0f9b85
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/image.html5.html
@@ -0,0 +1,82 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+

+
+

+
(사진을 점선 안으로 끌어 놓을 수 있습니다.)
+
0장 / 최대 장 사진
+
+
+
+
+
크기 줄이기
+
+
+
가로:
+
+
픽셀
+
+ 입력:
+
+ 픽셀
+
+
+
사진 높이는 자동으로 설정됩니다.
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/image_url.html b/plugin/editor/cheditor5/popup/image_url.html
new file mode 100644
index 000000000..18b76d3db
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/image_url.html
@@ -0,0 +1,34 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+ 0 X 0
+
+
+
+
+
+
diff --git a/plugin/editor/cheditor5/popup/js/AC_OETags.js b/plugin/editor/cheditor5/popup/js/AC_OETags.js
new file mode 100644
index 000000000..00d0e4405
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/AC_OETags.js
@@ -0,0 +1,247 @@
+// Flash Player Version Detection - Rev 1.5
+// Detect Client Browser type
+// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
+// Modified: chna@chcode.com
+
+var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function errMaxFileSize (MaxFileSize) {
+ alert("선택하신 파일 크기가 너무 큽니다. 최대 전송 크기는 "+MaxFileSize+" MB 입니다.");
+}
+
+function ControlVersion()
+{
+ var version = 0;
+ var axo;
+// var e;
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ version = axo.GetVariable("$version");
+ } catch (e) {}
+
+ if (!version)
+ {
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+ version = "WIN 6,0,21,0";
+ axo.AllowScriptAccess = "always";
+ version = axo.GetVariable("$version");
+
+ } catch (e) {}
+ }
+
+ if (!version)
+ {
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = axo.GetVariable("$version");
+ } catch (e) {}
+ }
+
+ if (!version)
+ {
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = "WIN 3,0,18,0";
+ } catch (e) {}
+ }
+
+ if (!version)
+ {
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ version = "WIN 2,0,0,11";
+ } catch (e) {
+ version = -1;
+ }
+ }
+
+ return version;
+}
+
+function GetSwfVer(){
+ var flashVer = -1;
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+ var descArray = flashDescription.split(" ");
+ var tempArrayMajor = descArray[2].split(".");
+ var versionMajor = tempArrayMajor[0];
+ var versionMinor = tempArrayMajor[1];
+ if ( descArray[3] != "" ) {
+ tempArrayMinor = descArray[3].split("r");
+ } else {
+ tempArrayMinor = descArray[4].split("r");
+ }
+ var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
+ flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+ }
+ }
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
+ else if ( isIE && isWin && !isOpera ) {
+ flashVer = ControlVersion();
+ }
+ return flashVer;
+}
+
+function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
+{
+ versionStr = GetSwfVer();
+ if (versionStr == -1 ) {
+ return false;
+ } else if (versionStr != 0) {
+ if(isIE && isWin && !isOpera) {
+ tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
+ tempString = tempArray[1]; // "2,0,0,11"
+ versionArray = tempString.split(","); // ['2', '0', '0', '11']
+ } else {
+ versionArray = versionStr.split(".");
+ }
+ var versionMajor = versionArray[0];
+ var versionMinor = versionArray[1];
+ var versionRevision = versionArray[2];
+
+ if (versionMajor > parseFloat(reqMajorVer)) {
+ return true;
+ }
+ else if (versionMajor == parseFloat(reqMajorVer)) {
+ if (versionMinor > parseFloat(reqMinorVer))
+ return true;
+ else if (versionMinor == parseFloat(reqMinorVer)) {
+ if (versionRevision >= parseFloat(reqRevision))
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+function AC_AddExtension(src, ext)
+{
+ if (src.indexOf('?') != -1)
+ return src.replace(/\?/, ext+'?');
+ else
+ return src + ext;
+}
+
+function AC_Generateobj(objAttrs, params, embedAttrs)
+{
+ var str = '';
+ if (isIE && isWin && !isOpera)
+ {
+ str += '';
+ } else {
+ str += '';
+ }
+
+ document.getElementById('oFlash').innerHTML = str;
+}
+
+function chxupload_RUN() {
+ var ret =
+ AC_GetArgs
+ ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ , "application/x-shockwave-flash"
+ );
+ AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+}
+
+function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
+ var ret = new Object();
+ ret.embedAttrs = new Object();
+ ret.params = new Object();
+ ret.objAttrs = new Object();
+ for (var i=0; i < args.length; i=i+2){
+ var currArg = args[i].toLowerCase();
+
+ switch (currArg){
+ case "classid":
+ break;
+ case "pluginspage":
+ ret.embedAttrs[args[i]] = args[i+1];
+ break;
+ case "src":
+ case "movie":
+ args[i+1] = AC_AddExtension(args[i+1], ext);
+ ret.embedAttrs["src"] = args[i+1];
+ ret.params[srcParamName] = args[i+1];
+ break;
+ case "onafterupdate":
+ case "onbeforeupdate":
+ case "onblur":
+ case "oncellchange":
+ case "onclick":
+ case "ondblClick":
+ case "ondrag":
+ case "ondragend":
+ case "ondragenter":
+ case "ondragleave":
+ case "ondragover":
+ case "ondrop":
+ case "onfinish":
+ case "onfocus":
+ case "onhelp":
+ case "onmousedown":
+ case "onmouseup":
+ case "onmouseover":
+ case "onmousemove":
+ case "onmouseout":
+ case "onkeypress":
+ case "onkeydown":
+ case "onkeyup":
+ case "onload":
+ case "onlosecapture":
+ case "onpropertychange":
+ case "onreadystatechange":
+ case "onrowsdelete":
+ case "onrowenter":
+ case "onrowexit":
+ case "onrowsinserted":
+ case "onstart":
+ case "onscroll":
+ case "onbeforeeditfocus":
+ case "onactivate":
+ case "onbeforedeactivate":
+ case "ondeactivate":
+ case "type":
+ case "codebase":
+ case "id":
+ ret.objAttrs[args[i]] = args[i+1];
+ break;
+ case "width":
+ case "height":
+ case "align":
+ case "vspace":
+ case "hspace":
+ case "class":
+ case "title":
+ case "accesskey":
+ case "name":
+ case "tabindex":
+ ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+ break;
+ default:
+ ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+ }
+ }
+ ret.objAttrs["classid"] = classid;
+ if (mimeType) ret.embedAttrs["type"] = mimeType;
+ return ret;
+}
diff --git a/plugin/editor/cheditor5/popup/js/color_picker.js b/plugin/editor/cheditor5/popup/js/color_picker.js
new file mode 100644
index 000000000..6f1de5189
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/color_picker.js
@@ -0,0 +1,92 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+var colour = ["ffffcc","ffcc66","ff9900","ffcc99","ff6633","ffcccc","cc9999","ff6699","ff99cc","ff66cc","ffccff","cc99cc","cc66ff","cc99ff","9966cc","ccccff","9999cc","3333ff","6699ff","0066ff","99ccff","66ccff","99cccc","ccffff","99ffcc","66cc99","66ff99","99ff99","ccffcc","33ff33","66ff00","ccff99","99ff00","ccff66","cccc66","ffffff",
+ "ffff99","ffcc00","ff9933","ff9966","cc3300","ff9999","cc6666","ff3366","ff3399","ff00cc","ff99ff","cc66cc","cc33ff","9933cc","9966ff","9999ff","6666ff","3300ff","3366ff","0066cc","3399ff","33ccff","66cccc","99ffff","66ffcc","33cc99","33ff99","66ff66","99cc99","00ff33","66ff33","99ff66","99ff33","ccff00","cccc33","cccccc",
+ "ffff66","ffcc33","cc9966","ff6600","ff3300","ff6666","cc3333","ff0066","ff0099","ff33cc","ff66ff","cc00cc","cc00ff","9933ff","6600cc","6633ff","6666cc","3300cc","0000ff","3366cc","0099ff","00ccff","339999","66ffff","33ffcc","00cc99","00ff99","33ff66","66cc66","00ff00","33ff00","66cc00","99cc66","ccff33","999966","999999",
+ "ffff33","cc9900","cc6600","cc6633","ff0000","ff3333","993333","cc3366","cc0066","cc6699","ff33ff","cc33cc","9900cc","9900ff","6633cc","6600ff","666699","3333cc","0000cc","0033ff","6699cc","3399cc","669999","33ffff","00ffcc","339966","33cc66","00ff66","669966","00cc00","33cc00","66cc33","99cc00","cccc99","999933","666666",
+ "ffff00","cc9933","996633","993300","cc0000","ff0033","990033","996666","993366","cc0099","ff00ff","990099","996699","660099","663399","330099","333399","000099","0033cc","003399","336699","0099cc","006666","00ffff","33cccc","009966","00cc66","339933","336633","33cc33","339900","669933","99cc33","666633","999900","333333",
+ "cccc00","996600","663300","660000","990000","cc0033","330000","663333","660033","990066","cc3399","993399","660066","663366","330033","330066","333366","000066","000033","003366","006699","003333","336666","00cccc","009999","006633","009933","006600","003300","00cc33","009900","336600","669900","333300","666600","000000"],
+ oEditor = null,
+ setColor = null,
+ button = [
+ { alt: '', img: 'cancel.gif', cmd: popupClose }
+ ];
+
+function setShowColor() {
+ var showColor = document.getElementById('show_color'),
+ color = setColor.selectedCell.getAttribute('bgcolor');
+
+ if (color) {
+ showColor.style.backgroundColor = color;
+ }
+}
+
+function popupClose() {
+ oEditor.editArea.focus();
+ oEditor.backupRange(oEditor.restoreRange());
+ oEditor.clearStoredSelections();
+ oEditor.popupWinClose();
+}
+
+function getColor()
+{
+ var color = this.getAttribute('bgColor');
+ setColor.func(color);
+ popupClose();
+}
+
+function drawColor(el) {
+ var table, tr, td, insideTable, k = 0, i, j, tr2, td2,
+ onMouseOver = function () {
+ this.className = 'colorCellMouseOver';
+ },
+ onMouseOut = function () {
+ this.className = 'colorCellMouseOut';
+ };
+
+ table = document.createElement('table');
+ table.cellPadding = 0;
+ table.cellSpacing = 0;
+ table.border = 0;
+ table.align = 'center';
+ tr = table.insertRow(0);
+ td = tr.insertCell(0);
+ td.style.backgroundColor = '#fff';
+
+ insideTable = document.createElement('table');
+ insideTable.border = 0;
+ insideTable.cellSpacing = 1;
+ insideTable.cellPadding = 0;
+ insideTable.align = 'center';
+
+
+
+ for (i = 0; i < 6; i++) {
+ tr2 = insideTable.insertRow(i);
+ for (j = 0; j < 36; j++) {
+ td2 = tr2.insertCell(j);
+ td2.setAttribute('bgColor', '#' + colour[k]);
+ td2.className = 'colorCellMouseOut';
+ td2.onclick = getColor;
+ td2.appendChild(document.createTextNode('\u00a0'));
+ td2.onmouseover = onMouseOver;
+ td2.onmouseout = onMouseOut;
+ k++;
+ }
+ }
+
+ td.appendChild(insideTable);
+ document.getElementById(el).appendChild(table);
+}
+
+function init(dialog, argv) {
+ var dlg = new Dialog(this);
+ oEditor = this;
+ oEditor.dialog = dialog;
+ setColor = argv;
+
+ dlg.showButton(button);
+ dlg.setDialogHeight();
+ setShowColor();
+}
diff --git a/plugin/editor/cheditor5/popup/js/dialog.js b/plugin/editor/cheditor5/popup/js/dialog.js
new file mode 100644
index 000000000..dbc78eecd
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/dialog.js
@@ -0,0 +1,41 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+function Dialog(oEditor) {
+ this.oEditor = oEditor;
+}
+
+Dialog.prototype.setDialogCss = function () {
+ var head = document.getElementsByTagName('head')[0],
+ css = head.appendChild(document.createElement('link'));
+
+ css.setAttribute('type', 'text/css');
+ css.setAttribute('rel', 'stylesheet');
+ css.setAttribute('media', 'all');
+ css.setAttribute('href', this.oEditor.config.cssPath + 'dialog.css');
+};
+
+Dialog.prototype.setDialogHeight = function (height) {
+ this.oEditor.dialog.style.height = (height || document.body.scrollHeight) + 'px';
+ this.oEditor.cheditor.popupFrameWrapper.style.height = this.oEditor.dialog.style.height;
+};
+
+Dialog.prototype.showButton = function (button) {
+ var buttonUrl = this.oEditor.config.iconPath + 'button/',
+ wrapper = document.getElementById('buttonWrapper'),
+ i, img;
+
+ for (i = 0; i < button.length; i++) {
+ img = new Image();
+ img.alt = button[i].alt;
+
+ if (!this.oEditor.undefined(button[i].hspace)) {
+ img.hspace = button[i].hspace;
+ }
+
+ img.className = 'button';
+ img.src = buttonUrl + button[i].img;
+ img.onclick = button[i].cmd;
+ wrapper.appendChild(img);
+ }
+};
diff --git a/plugin/editor/cheditor5/popup/js/flash.js b/plugin/editor/cheditor5/popup/js/flash.js
new file mode 100644
index 000000000..e18df665b
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/flash.js
@@ -0,0 +1,95 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+var button = [
+ { alt : '', img : 'play.gif', cmd : doPlay },
+ { alt : '', img : 'submit.gif', cmd : doSubmit },
+ { alt : '', img : 'cancel.gif', cmd : popupClose }
+],
+ oEditor = null,
+ iframeSource = false;
+
+function init(dialog) {
+ var dlg = new Dialog(this);
+ oEditor = this;
+ oEditor.dialog = dialog;
+ dlg.showButton(button);
+ 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 = [];
+
+ elem = oEditor.trimSpace(elem);
+ if (elem == '') {
+ return;
+ }
+
+ if (elem.toLowerCase().indexOf("iframe") !== -1) {
+ document.getElementById('fm_player').innerHTML = elem;
+ iframeSource = true;
+ return;
+ }
+
+ pos = elem.toLowerCase().indexOf("embed");
+ if (pos !== -1) {
+ str = elem.substr(pos);
+ pos = str.indexOf(">");
+ div.innerHTML = "<" + str.substr(0, pos) + ">";
+ embed = div.firstChild;
+ } else {
+ div.innerHTML = elem;
+ 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;
+
+ 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});
+ }
+ 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");
+ }
+ }
+ }
+
+ if (embed !== null) {
+ document.getElementById('fm_player').appendChild(embed);
+ }
+}
+
+function popupClose() {
+ document.getElementById('fm_player').innerHTML = '';
+ oEditor.popupWinCancel();
+}
+
+function doSubmit()
+{
+ var source = String(oEditor.trimSpace(document.getElementById("fm_embed").value));
+ if (source === '') {
+ popupClose();
+ }
+
+ if (iframeSource || source.indexOf("iframe") !== -1) {
+ oEditor.insertHtmlPopup(source);
+ } else {
+ oEditor.insertFlash(source);
+ }
+
+ 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
new file mode 100644
index 000000000..cf6109076
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/google_map.js
@@ -0,0 +1,143 @@
+// ================================================================
+// CHEditor 5
+// ----------------------------------------------------------------
+var oEditor = null,
+ centerLat = 0,
+ centerLng = 0,
+ latlng = 0,
+ setZoom = 14,
+ marker_lat = 0,
+ marker_lng = 0,
+ mapType = "roadmap",
+ map,
+ mapWidth = 512,
+ mapHeight = 320,
+ panorama,
+ panoramaVisible = false;
+
+function doSubmit() {
+ var mapImg = document.createElement("img"),
+ panoramaPitch, panoramaHeading, panoramaZoom, panoramaPosition;
+
+ if (marker_lat === 0) {
+ marker_lat = centerLat;
+ }
+ if (marker_lng === 0) {
+ marker_lng = centerLng;
+ }
+
+ mapImg.style.width = mapWidth + 'px';
+ mapImg.style.height = mapHeight + 'px';
+ mapImg.style.border = '1px #000 solid';
+ mapImg.setAttribute("alt", "Google Map");
+ mapImg.onload = function () {
+ oEditor.insertHtmlPopup(mapImg);
+ oEditor.setImageEvent(true);
+ oEditor.popupWinClose();
+ };
+
+ if (panoramaVisible) {
+ panoramaPitch = panorama.getPov().pitch;
+ panoramaHeading = panorama.getPov().heading;
+ panoramaZoom = panorama.getPov().zoom;
+ panoramaPosition = panorama.getPosition();
+
+ mapImg.src = "http://maps.googleapis.com/maps/api/streetview?location=" + panoramaPosition +
+ "&pitch=" + panoramaPitch +
+ "&heading=" + panoramaHeading +
+ "&size=" + mapWidth + 'x' + mapHeight +
+ "&zoom=" + panoramaZoom +
+ "&sensor=false" +
+ "®ion=KR";
+ } else {
+ 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 +
+ "&sensor=false" +
+ "&language=ko" +
+ "®ion=KR";
+ }
+}
+
+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 initMap(zoom) {
+ var mapOptions = {
+ zoom: zoom || setZoom,
+ panControl: true,
+ zoomControl: true,
+ scaleControl: true,
+ center: new google.maps.LatLng(37.566, 126.977),
+ disableDefaultUI: false,
+ streetViewControl: true,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+
+ map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
+ centerLat = map.getCenter().lat();
+ centerLng = map.getCenter().lng();
+
+ google.maps.event.addListener(map, 'dragend', function () {
+ centerLat = map.getCenter().lat();
+ centerLng = map.getCenter().lng();
+ });
+
+ google.maps.event.addListener(map, 'maptypeid_changed', function () {
+ mapType = map.getMapTypeId();
+ });
+
+ google.maps.event.addListener(map, 'zoom_changed', function () {
+ centerLat = map.getCenter().lat();
+ centerLng = map.getCenter().lng();
+ });
+
+ panorama = map.getStreetView();
+ google.maps.event.addListener(panorama, 'visible_changed', function () {
+ panoramaVisible = panorama.getVisible();
+ });
+}
+
+function popupClose() {
+ oEditor.popupWinCancel();
+}
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ var dlg = new Dialog(oEditor),
+ button = [
+ { alt : "", img : 'submit.gif', cmd : doSubmit },
+ { alt : "", img : 'cancel.gif', cmd : popupClose }
+ ],
+ buttonUrl = oEditor.config.iconPath + 'button/map_address.gif',
+ search = new Image();
+
+ dlg.showButton(button);
+
+ search.src = buttonUrl;
+ search.onclick = function () {
+ searchAddress();
+ };
+ search.className = 'button';
+ document.getElementById('map_search').appendChild(search);
+ dlg.setDialogHeight();
+}
diff --git a/plugin/editor/cheditor5/popup/js/icon.js b/plugin/editor/cheditor5/popup/js/icon.js
new file mode 100644
index 000000000..2ce50fae8
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/icon.js
@@ -0,0 +1,54 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+var oEditor = null;
+
+function popupClose() {
+ oEditor.popupWinCancel();
+}
+
+function insertIcon() {
+ this.removeAttribute("className");
+ this.removeAttribute("class");
+ this.style.margin = '1px 4px';
+ oEditor.insertHtmlPopup(this.cloneNode(false));
+ oEditor.popupWinClose();
+}
+
+function showContents() {
+ var block = document.getElementById('iconBlock'),
+ path = oEditor.config.iconPath + 'em/',
+ num = 80, i, br, img;
+
+ for (i = 40; i < num; i++) {
+ if (i > 40 && (i % 10) === 0) {
+ br = document.createElement('br');
+ block.appendChild(br);
+ }
+
+ img = new Image();
+ img.src = path + (i + 1) + ".gif";
+ img.style.width = '16px';
+ img.style.height = '16px';
+ img.style.margin = '5px 4px';
+ img.style.verticalAlign = 'middle';
+ img.setAttribute('alt', 'Emotion Icon');
+ img.setAttribute('border', "0");
+ img.className = 'handCursor';
+ img.onclick = insertIcon;
+ block.appendChild(img);
+ }
+}
+
+function init(dialog) {
+ var button, dlg;
+
+ oEditor = this;
+ oEditor.dialog = dialog;
+ button = [{ alt : "", img : 'cancel.gif', cmd : popupClose }];
+
+ dlg = new Dialog(oEditor);
+ showContents();
+ dlg.showButton(button);
+ dlg.setDialogHeight();
+}
diff --git a/plugin/editor/cheditor5/popup/js/image.html5.js b/plugin/editor/cheditor5/popup/js/image.html5.js
new file mode 100644
index 000000000..b4ed00b0e
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/image.html5.js
@@ -0,0 +1,1344 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+var activeImage = null,
+ browser = null,
+ button,
+ debug = false,
+ destinationObject = null,
+ divHeight = [],
+ divWidth = [],
+ divXPositions = [],
+ divYPositions = [],
+ dragDropDiv,
+ eventDiff_x = 0,
+ eventDiff_y = 0,
+ fileTypeRe = /^image\/(png|jpeg|gif)$/i,
+ geckoOffsetX_marker = -3,
+ geckoOffsetY_marker = -1,
+ imageCompleted = 0,
+ imageCompletedList = [],
+ imageListWrapper,
+ imageResizeInput,
+ imageResizeWidth = 0,
+ insertionMarker,
+ inputFileName = 'file',
+ modifyImages = [],
+ moveTimer = -1,
+ oEditor = null,
+ offsetX_marker = -3,
+ offsetY_marker = -3,
+ readyToMove = false,
+ selectedFilesNum = 0,
+ showThumbnailSize = { width: 120, height: 90 },
+ tmpLeft = 0,
+ tmpTop = 0,
+ uploadImagePath = '',
+ uploadMaxNumber = 12,
+ uploadScript;
+// deleteScript;
+
+function createInsertionMaker() {
+ var wrapper = document.getElementById('insertionMarker'),
+ topIco = new Image(),
+ middleIco = new Image(),
+ bottomIco = new Image();
+
+ topIco.src = uploadImagePath + '/marker_top.gif';
+ topIco.style.width = '6px';
+ topIco.style.height = '1px';
+ wrapper.appendChild(topIco);
+
+ middleIco.src = uploadImagePath + '/marker_middle.gif';
+ middleIco.style.height = '96px';
+ middleIco.style.width = '6px';
+ wrapper.appendChild(middleIco);
+
+ bottomIco.src = uploadImagePath + '/marker_bottom.gif';
+ bottomIco.style.width = '6px';
+ bottomIco.style.height = '1px';
+ wrapper.appendChild(bottomIco);
+}
+
+function popupClose() {
+ oEditor.popupWinCancel();
+}
+
+function showContents() {
+ var spacer = function (id) {
+ var clear = document.createElement('div');
+ clear.style.height = '0px';
+ clear.style.width = '0px';
+ clear.className = 'clear';
+ clear.id = 'spacer' + id;
+ return clear;
+ },
+ spacerNo = 1, i, imgBox, theImg, lastSpacer;
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ if (i > 0 && ((i % 4) === 0)) {
+ imageListWrapper.appendChild(spacer(spacerNo++));
+ }
+
+ imgBox = document.createElement('div');
+ imgBox.id = 'imgBox' + i;
+ imgBox.className = 'imageBox';
+ theImg = document.createElement('div');
+ theImg.id = 'img_' + i;
+ theImg.className = 'imageBox_theImage';
+ imgBox.appendChild(theImg);
+
+ imageListWrapper.appendChild(imgBox);
+ if (i === (uploadMaxNumber - 1)) {
+ lastSpacer = spacer(spacerNo);
+ lastSpacer.style.height = "7px";
+ imageListWrapper.appendChild(lastSpacer);
+ }
+ }
+
+ imageListWrapper.style.padding = '5px 7px 0px 5px';
+ document.getElementById('imageInfoBox').style.height = '298px';
+ document.getElementById('imageInfoBox').style.width = '130px';
+}
+
+function setImageCount() {
+ imageCompleted++;
+ document.getElementById('imageCount').innerHTML = imageCompleted.toString();
+}
+
+function getImageCount() {
+ return imageCompleted;
+}
+
+function allowedMaxImage() {
+ return uploadMaxNumber - getImageCount();
+}
+
+function getUploadedCount() {
+ return imageListWrapper.getElementsByTagName('img').length;
+}
+
+function uploadedImageCount() {
+ imageCompleted = getUploadedCount();
+ document.getElementById('imageCount').innerHTML = imageCompleted.toString();
+}
+
+function getTopPos(inputObj) {
+ // ----------------------------------------------------------------------------------
+ var returnValue = inputObj.offsetTop;
+
+ inputObj = inputObj.offsetParent;
+ while (inputObj) {
+ if (inputObj.tagName.toLowerCase() !== 'html') {
+ returnValue += (inputObj.offsetTop - inputObj.scrollTop);
+ if (browser.msie) {
+ returnValue += inputObj.clientTop;
+ }
+ }
+ inputObj = inputObj.offsetParent;
+ }
+ return returnValue;
+}
+
+function getLeftPos(inputObj) {
+ // ----------------------------------------------------------------------------------
+ var returnValue = inputObj.offsetLeft;
+
+ inputObj = inputObj.offsetParent;
+ while (inputObj) {
+ if (inputObj.id !== 'imageListWrapper') {
+ returnValue += inputObj.offsetLeft;
+ }
+ inputObj = inputObj.offsetParent;
+ }
+ return returnValue;
+}
+
+function getDivCoordinates() {
+ // ----------------------------------------------------------------------------------
+ var imgBox = imageListWrapper.getElementsByTagName('DIV'),
+ i = 0;
+
+ for (; i < imgBox.length; i++) {
+ if ((imgBox[i].className === 'imageBox' || imgBox[i].className === 'imageBoxHighlighted') && imgBox[i].id) {
+ divXPositions[imgBox[i].id] = getLeftPos(imgBox[i]);
+ divYPositions[imgBox[i].id] = getTopPos(imgBox[i]);
+ divWidth[imgBox[i].id] = imgBox[i].offsetWidth;
+ divHeight[imgBox[i].id] = imgBox[i].offsetHeight;
+ }
+ }
+}
+
+function reOrder() {
+ // ----------------------------------------------------------------------------------
+ var imgBox = imageListWrapper.getElementsByTagName('div'),
+ imgNum = 0, i, spacer, breakline = [];
+
+ for (i = 0; i < imgBox.length; i++) {
+ if (imgBox[i].id.indexOf('imgBox') === -1) {
+ continue;
+ }
+
+ imgBox[i].className = 'imageBox';
+ imgBox[i].firstChild.className = 'imageBox_theImage';
+
+ if (imgNum > 0 && (imgNum % 4) === 0) {
+ breakline.push(imgBox[i].id);
+ }
+
+ imgNum++;
+ }
+
+ for (i = 0; i < breakline.length; i++) {
+ spacer = document.getElementById('spacer' + (i + 1));
+ if (i + 1 === breakline.length) {
+ imageListWrapper.appendChild(spacer);
+ } else {
+ imageListWrapper.insertBefore(spacer, document.getElementById(breakline[i]));
+ }
+ }
+}
+
+function img_delete_post(el){
+ if( el.firstChild.tagName.toLowerCase() === 'img' ){
+ var src = el.firstChild.getAttribute('src'),
+ filesrc = src.replace(/^.*[\\\/]/, ''),
+ data = "filesrc="+filesrc;
+
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', deleteScript, true);
+ //Send the proper header information along with the request
+ xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+
+ xhr.addEventListener("error", function (evt) {
+ try {
+ console.log("파일 전송 중 오류: " + evt.target.error.code);
+ } catch(ex) {
+ }
+ }, false);
+
+ xhr.send(data);
+ }
+}
+
+function showDelete() {
+ var self = this, btn;
+
+ if (readyToMove) {
+ return;
+ }
+
+ getDivCoordinates();
+ self.className = 'imageBox_theImage_over';
+ btn = document.getElementById('removeImageButton');
+ btn.style.left = (showThumbnailSize.width - parseInt(btn.style.width, 10) - 1) + 'px';
+ btn.style.top = '-1px';
+
+ self.appendChild(btn);
+ btn.style.display = 'block';
+
+ btn.onmouseover = function (ev) {
+ oEditor.stopEvent(ev);
+ this.style.display = 'block';
+ this.className = 'removeButton_over';
+ self.className = 'imageBox_theImage_over';
+ };
+ btn.onmouseout = function () {
+ this.className = 'removeButton';
+ };
+ btn.onmousedown = function (ev) {
+ var images = self.getElementsByTagName('img'), i, moveobj, target;
+
+ for (i = 0; i < images.length; i++) {
+ img_delete_post(self);
+ self.removeChild(images[i]);
+ }
+
+ self.removeChild(self.firstChild);
+ self.className = 'imageBox_theImage';
+
+ if (self.parentNode.nextSibling && self.parentNode.nextSibling.id) {
+ moveobj = self.parentNode.nextSibling;
+ target = self.parentNode;
+
+ while (moveobj !== null) {
+ if (moveobj.firstChild && !moveobj.firstChild.firstChild) {
+ break;
+ }
+ if (/^spacer/.test(moveobj.id)) {
+ moveobj = moveobj.nextSibling;
+ continue;
+ }
+ imageListWrapper.insertBefore(moveobj, target);
+ moveobj = target.nextSibling;
+ }
+ }
+
+ reOrder();
+ uploadedImageCount();
+ this.style.display = 'none';
+ document.body.appendChild(ev.target);
+ oEditor.removeEvent(self, 'mouseover', showDelete);
+ };
+}
+
+function hideDelete() {
+ // ----------------------------------------------------------------------------------
+ document.getElementById('removeImageButton').style.display = 'none';
+}
+
+function startUpload(list) {
+ // ----------------------------------------------------------------------------------
+ var el = imageListWrapper.getElementsByTagName('div'), i, imgBox,
+ count = 0, len = list.length;
+
+ for (i = 0; i < el.length; i++) {
+ imgBox = el[i];
+ if (imgBox.className !== 'imageBox_theImage') {
+ continue;
+ }
+ if (count === len) {
+ break;
+ }
+ if (!imgBox.firstChild || imgBox.firstChild.tagName.toLowerCase() !== 'img') {
+ imgBox.style.backgroundImage = "url('" + uploadImagePath + "/loader.gif')";
+ list[count++].boxElem = imgBox;
+ }
+ }
+}
+
+function fileFilterError(file) {
+ alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
+ "gif, png, jpg 사진 파일만 전송할 수 있습니다.");
+}
+
+function imgComplete(img, imgSize, boxId) {
+ var resizeW, resizeH, M, elem;
+ img.setAttribute("border", '0');
+
+ if (imgSize.width > showThumbnailSize.width || imgSize.height > showThumbnailSize.height) {
+ if (imgSize.width > imgSize.height) {
+ resizeW = (imgSize.width > showThumbnailSize.width) ? showThumbnailSize.width : imgSize.width;
+ resizeH = Math.round((imgSize.height * resizeW) / imgSize.width);
+ } else {
+ resizeH = (imgSize.height > showThumbnailSize.height) ? showThumbnailSize.height : imgSize.height;
+ resizeW = Math.round((imgSize.width * resizeH) / imgSize.height);
+ }
+
+ if (resizeH > showThumbnailSize.height) {
+ resizeH = (imgSize.height > showThumbnailSize.height) ? showThumbnailSize.height : imgSize.height;
+ resizeW = Math.round((imgSize.width * resizeH) / imgSize.height);
+ }
+
+ } else {
+ resizeW = imgSize.width;
+ resizeH = imgSize.height;
+ }
+
+ img.style.width = resizeW - 2 + 'px';
+ img.style.height = resizeH - 2 + 'px';
+ img.style.margin = "1px";
+
+ if (resizeW < showThumbnailSize.width) {
+ M = showThumbnailSize.width - resizeW;
+ img.style.marginLeft = Math.round(M / 2) + 'px';
+ }
+
+ if (resizeH < showThumbnailSize.height) {
+ M = showThumbnailSize.height - resizeH;
+ img.style.marginTop = Math.round(M / 2) + 'px';
+ }
+
+ elem = document.getElementById(boxId);
+ boxId = boxId.replace(/img_/, '');
+
+ if (boxId % 12 === 0) {
+ imageListWrapper.scrollTop = elem.offsetTop - 6;
+ }
+
+ elem.style.backgroundImage = "url('" + uploadImagePath + "/dot.gif')";
+ oEditor.addEvent(elem, 'mouseover', showDelete);
+ elem.onmouseout = function () {
+ this.className = 'imageBox_theImage';
+ hideDelete();
+ };
+
+ setImageCount();
+}
+
+function showUploadWindow() {
+ // ----------------------------------------------------------------------------------
+ var uploadWindow = document.getElementById("uploadWindow"),
+ uploadWindowWidth = 700,
+ winWidth, el, i, j, imgBox, img;
+
+ if (!(oEditor.undefined(window.innerWidth))) {
+ winWidth = window.innerWidth;
+ } else if (document.documentElement &&
+ (!(oEditor.undefined(document.documentElement.clientWidth))) &&
+ document.documentElement.clientWidth !== 0) {
+ winWidth = document.documentElement.clientWidth;
+ } else if (document.body && (!(oEditor.undefined(document.body.clientWidth)))) {
+ winWidth = document.body.clientWidth;
+ } else {
+ alert('현재 브라우저를 지원하지 않습니다.');
+ return;
+ }
+
+ uploadWindow.style.left = winWidth / 2 - (uploadWindowWidth / 2) + 'px';
+ uploadWindow.style.display = "block";
+ uploadWindow.style.width = uploadWindowWidth + 'px';
+
+ if (modifyImages.length > 0) {
+ el = imageListWrapper.getElementsByTagName('div');
+ for (i = 0; i < modifyImages.length; i++) {
+ if (i > 7) {
+ break;
+ }
+
+ for (j = 0; j < el.length; j++) {
+ imgBox = el[j];
+ if (imgBox.className !== 'imageBox_theImage') {
+ continue;
+ }
+
+ if (imgBox.firstChild && (imgBox.firstChild.src === modifyImages[i])) {
+ break;
+ }
+
+ if (imgBox.firstChild === null) {
+ img = new Image();
+ img.src = modifyImages[i];
+ img.border = 0;
+ img.alt = '';
+ img.style.width = '120px';
+ img.style.height = '90px';
+ imgBox.appendChild(img);
+ break;
+ }
+ }
+ }
+ }
+}
+
+function removeImages() {
+ var images = [], i, j, theImage, img, remove;
+ document.body.appendChild(document.getElementById('removeImageButton'));
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ theImage = document.getElementById('img_' + i);
+ if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') {
+ images.push(theImage);
+ }
+ }
+
+ for (i = 0; i < images.length; i++) {
+ img = images[i];
+ if (img.firstChild !== null) {
+ oEditor.removeEvent(img, 'mouseover', showDelete);
+ remove = img.getElementsByTagName('img');
+
+ for (j = 0; j < remove.length; j++) {
+ img_delete_post(img);
+ img.removeChild(remove[j]);
+ }
+
+ img.parentNode.className = 'imageBox';
+ oEditor.removeEvent(img, 'mouseover', showDelete);
+ }
+ }
+ uploadedImageCount();
+ imageCompletedList = [];
+}
+
+function removeImage() {
+ // ----------------------------------------------------------------------------------
+ var i, theImage, found = false;
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ theImage = document.getElementById('img_' + i);
+ if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ if (!confirm('추가하신 사진이 있습니다. 사진 넣기를 취소하시겠습니까?')) {
+ return false;
+ }
+ removeImages();
+ }
+
+ return true;
+}
+
+function closeWindow() {
+ // ----------------------------------------------------------------------------------
+ if (removeImage()) {
+ popupClose();
+ }
+}
+
+function cancelEvent() {
+ // ----------------------------------------------------------------------------------
+ return false;
+}
+
+function startMoveTimer() {
+ // ----------------------------------------------------------------------------------
+ var subElements, newDiv;
+
+ if (moveTimer >= 0 && moveTimer < 10) {
+ moveTimer++;
+ setTimeout('startMoveTimer()', 8);
+ }
+
+ if (moveTimer === 5) {
+ getDivCoordinates();
+ subElements = dragDropDiv.getElementsByTagName('div');
+ if (subElements.length > 0) {
+ dragDropDiv.removeChild(subElements[0]);
+ }
+
+ dragDropDiv.style.display = 'block';
+ newDiv = activeImage.cloneNode(true);
+ newDiv.className = 'imageBox';
+ newDiv.style.opacity = 0.5;
+
+ newDiv.id = '';
+ newDiv.style.padding = '2px';
+ dragDropDiv.appendChild(newDiv);
+
+ dragDropDiv.style.top = tmpTop + 'px';
+ dragDropDiv.style.left = tmpLeft + 'px';
+ }
+
+ return false;
+}
+
+function getMouseButtn(e) {
+ var code;
+ e = e || window.event;
+ code = e.button;
+
+ if (code) {
+ if (browser.msie && browser.version < 9) {
+ code = code === 1 ? 0 : (code === 4 ? 1 : code);
+ }
+ }
+
+ return code;
+}
+
+function selectImage(e) {
+ // ----------------------------------------------------------------------------------
+ var el = this.parentNode.firstChild.firstChild, obj;
+
+ if (!el) {
+ return;
+ }
+
+ e = e || window.event;
+ if (getMouseButtn(e) === 2) {
+ return;
+ }
+
+ obj = this.parentNode;
+ hideDelete();
+
+ obj.className = 'imageBoxHighlighted';
+ activeImage = obj;
+ readyToMove = true;
+ moveTimer = 0;
+
+ tmpLeft = e.clientX + Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
+ tmpTop = e.clientY + Math.max(document.body.scrollTop, document.documentElement.scrollTop);
+
+ startMoveTimer();
+ return false;
+}
+
+function dragDropEnd() {
+ // ----------------------------------------------------------------------------------
+ var parentObj, chkObj, turn = false;
+
+ readyToMove = false;
+ moveTimer = -1;
+ dragDropDiv.style.display = 'none';
+ insertionMarker.style.display = 'none';
+
+ if (!activeImage) {
+ return;
+ }
+
+ if (destinationObject && destinationObject !== activeImage) {
+ parentObj = destinationObject.parentNode;
+ chkObj = destinationObject.previousSibling;
+ turn = false;
+
+ if (chkObj === null) {
+ chkObj = imageListWrapper.firstChild;
+ turn = true;
+ }
+
+ if (chkObj.id.indexOf('spacer') !== -1) {
+ chkObj = chkObj.previousSibling;
+ }
+
+ if (chkObj.firstChild.firstChild === null) {
+ reOrder();
+ return;
+ }
+
+ if (chkObj && chkObj.id !== null) {
+ while (chkObj) {
+ if (chkObj.firstChild.firstChild !== null) {
+ break;
+ }
+ chkObj = chkObj.previousSibling;
+ }
+ destinationObject = turn ? chkObj : chkObj.nextSibling;
+ }
+
+ parentObj.insertBefore(activeImage, destinationObject);
+ reOrder();
+
+ activeImage = null;
+ destinationObject = null;
+ getDivCoordinates();
+
+ return false;
+ }
+
+ activeImage.className = "imageBox";
+ return true;
+}
+
+function dragDropMove(e) {
+ // ----------------------------------------------------------------------------------
+ var elementFound = false, prop, offsetX, offsetY, leftPos, topPos;
+
+ if (moveTimer === -1 || !readyToMove) {
+ return;
+ }
+
+ e = e || window.event;
+
+ leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x;
+ topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y;
+
+ dragDropDiv.style.top = topPos + 'px';
+ dragDropDiv.style.left = leftPos + 'px';
+
+ leftPos = leftPos + eventDiff_x;
+ topPos = topPos + eventDiff_y;
+
+ if (getMouseButtn(e) !== 0) {
+ dragDropEnd();
+ }
+
+ for (prop in divXPositions) {
+ if (!divXPositions.hasOwnProperty(prop) || divXPositions[prop].className === 'clear') {
+ continue;
+ }
+
+ if (divXPositions[prop] < leftPos &&
+ (divXPositions[prop] + divWidth[prop] * 0.7) > leftPos &&
+ divYPositions[prop] < topPos &&
+ (divYPositions[prop] + divWidth[prop]) > topPos) {
+ if (browser.msie) {
+ offsetX = offsetX_marker;
+ offsetY = offsetY_marker;
+ } else {
+ offsetX = geckoOffsetX_marker;
+ offsetY = geckoOffsetY_marker;
+ }
+
+ insertionMarker.style.top = divYPositions[prop] + offsetY + 'px';
+ insertionMarker.style.left = divXPositions[prop] + offsetX + 'px';
+ insertionMarker.style.display = 'block';
+ destinationObject = document.getElementById(prop);
+ elementFound = true;
+ break;
+ }
+ }
+
+ if (!elementFound) {
+ insertionMarker.style.display = 'none';
+ destinationObject = false;
+ }
+
+ return false;
+}
+
+function initGallery() {
+ // ----------------------------------------------------------------------------------
+ var imgBox = imageListWrapper.getElementsByTagName('div'),
+ i;
+
+ for (i = 0; i < imgBox.length; i++) {
+ if (imgBox[i].className === 'imageBox_theImage') {
+ imgBox[i].onmousedown = selectImage;
+ }
+ }
+
+ document.body.onselectstart = cancelEvent;
+ document.body.ondragstart = cancelEvent;
+ document.body.onmouseup = dragDropEnd;
+ document.body.onmousemove = dragDropMove;
+
+ dragDropDiv = document.getElementById('dragDropContent');
+ insertionMarker = document.getElementById('insertionMarker');
+ getDivCoordinates();
+}
+
+function doSubmit() {
+ // ----------------------------------------------------------------------------------
+ var el = imageListWrapper.getElementsByTagName('div'),
+ imageArray = [],
+ num = 0,
+ elem = document.getElementById('id_alignment').elements,
+ imgParagraph = false,
+ useSpacer = false,
+ imgAlign = 'top', i, imgBox, input;
+
+ for (i = 0; i < elem.length; i++) {
+ input = elem[i];
+ switch (input.name) {
+ case "alignment" :
+ if (input.checked) {
+ imgAlign = input.value;
+ }
+ break;
+ case "para" :
+ imgParagraph = input.checked;
+ break;
+ case "use_spacer" :
+ useSpacer = input.checked;
+ break;
+ }
+ }
+
+ for (i = 0; i < el.length; i++) {
+ imgBox = el[i];
+ if (imgBox.className !== "imageBox_theImage") {
+ continue;
+ }
+
+ if (imgBox.firstChild !== null) {
+ imageArray[num] = imageCompletedList[imgBox.id];
+
+ if (imgAlign === "break") {
+ imageArray[num].alt = "break";
+ } else {
+ imageArray[num].alt = '';
+ imageArray[num].align = imgAlign;
+ }
+
+ num++;
+ }
+ }
+
+ if (imageArray.length > 0) {
+ oEditor.doInsertImage(imageArray, imgParagraph, useSpacer);
+ }
+ oEditor.popupWinClose();
+}
+
+function selectedFiles(evt) {
+ var upload = new DoUpload(),
+ files = evt.target.files || [];
+
+ oEditor.stopEvent(evt);
+ if (files) {
+ upload.select(files);
+ }
+}
+
+function DoUpload() {
+ this.list = [];
+ this.reader = new FileReader();
+ this.URL = window.URL || window.webkitURL;
+
+ this.reader.onprogress = null;
+ this.reader.onloadstart = null;
+ this.reader.onabort = null;
+ this.reader.onerror = null;
+
+ this.MyBlob = (function () {
+ var key, blob, self = this;
+ function MYBLOB(blob) {
+ var url = null;
+ this.blob = blob;
+ blob = null;
+
+ this.getURL = function () {
+ if (url) {
+ return url;
+ }
+ url = self.URL.createObjectURL(this.blob);
+ return url;
+ };
+ this.dispose = function () {
+ if (url) {
+ url = self.URL.revokeObjectURL(url);
+ }
+ if (typeof this.blob.msClose !== 'undefined') {
+ this.blob.msClose();
+ }
+ this.blob = null;
+ if (debug) {
+ console.log("Blob Data Clear");
+ }
+ };
+ }
+
+ blob = new Blob();
+ for (key in blob) {
+ if (blob.hasOwnProperty(key)) {
+ (function (key) {
+ Object.defineProperty(MYBLOB.prototype,
+ key,
+ {
+ enumerable: true,
+ configurable: true,
+ get: function () {
+ return this.blob[key];
+ }
+ }
+ );
+ }(key));
+ }
+ }
+
+ key = undefined;
+ return MYBLOB;
+ }());
+
+ return this;
+}
+
+DoUpload.prototype = {
+ select: function (files) {
+ var self = this,
+ num = files.length,
+ i = 0,
+ file = null;
+
+ if (num > allowedMaxImage()) {
+ num = allowedMaxImage();
+ }
+
+ for (; i < num; i++) {
+ file = files[i];
+
+ if (!file.type.match(fileTypeRe)) {
+ fileFilterError(file.name);
+ continue;
+ }
+ this.list.push(file);
+ }
+
+ if (this.list.length < 1) {
+ return;
+ }
+
+ this.reader.addEventListener("error", function (evt) {
+ self.onReadDataErrorHandler(evt);
+ }, false);
+
+ this.reader.onloadend = function (evt) {
+ self.dataLoadHandler(evt);
+ };
+
+ setResizeWidth();
+ startUpload(this.list);
+
+ this.load();
+ },
+
+ getDateTime : function () {
+ var date = new Date(),
+ year = date.getFullYear(),
+ month = date.getMonth() + 1,
+ day = date.getDate(),
+ hours = date.getHours(),
+ minutes = date.getMinutes(),
+ seconds = date.getSeconds();
+
+ return String(10000 * year + 100 * month + day +
+ ('0' + hours).slice(-2) + ('0' + minutes).slice(-2) + ('0' + seconds).slice(-2));
+ },
+
+ makeFilename : function (type) {
+ var chars = "abcdefghiklmnopqrstuvwxyz",
+ len = 8, clen = chars.length, rData = '', i, rnum;
+
+ for (i = 0; i < len; i++) {
+ rnum = Math.floor(Math.random() * clen);
+ rData += chars.substring(rnum, rnum + 1);
+ }
+
+ if (type !== '') {
+ rData += type.toLowerCase();
+ }
+
+ return this.getDateTime() + '_' + rData;
+ },
+
+ getOrientation : function (data) {
+ var view = new DataView(data),
+ length = view.byteLength,
+ offset = 2,
+ marker, little, tags, i;
+
+ if (view.getUint16(0, false) !== 0xffd8) {
+ return -2;
+ }
+
+ while (offset < length) {
+ marker = view.getUint16(offset, false);
+ offset += 2;
+
+ if (marker === 0xffe1) {
+ if (view.getUint32(offset += 2, false) !== 0x45786966) {
+ return -1;
+ }
+
+ little = view.getUint16(offset += 6, false) === 0x4949;
+ offset += view.getUint32(offset + 4, little);
+ tags = view.getUint16(offset, little);
+ offset += 2;
+
+ for (i = 0; i < tags; i++) {
+ if (view.getUint16(offset + (i * 12), little) === 0x0112) {
+ return view.getUint16(offset + (i * 12) + 8, little);
+ }
+ }
+ } else if ((marker & 0xff00) !== 0xff00) {
+ break;
+ } else {
+ offset += view.getUint16(offset, false);
+ }
+ }
+
+ return -1;
+ },
+
+ NewBlob : function (data, datatype) {
+ var blob = null, blobb;
+ try {
+ blob = new Blob([data], {type: datatype});
+ } catch (e) {
+ window.BlobBuilder = window.BlobBuilder
+ || window.WebKitBlobBuilder
+ || window.MozBlobBuilder
+ || window.MSBlobBuilder;
+
+ if (e.name === 'TypeError' && window.BlobBuilder) {
+ blobb = new BlobBuilder();
+ blobb.append(data);
+ blob = blobb.getBlob(datatype);
+ console.log("TypeError");
+ } else if (e.name === "InvalidStateError") {
+ console.log("InvalidStateError");
+ } else {
+ console.log("Error");
+ }
+ }
+ return blob;
+ },
+
+ imageResize : function (image, filetype, resizeWidth, orientation, addWaterMark) {
+ var canvas = document.createElement("canvas"),
+ width = image.width,
+ height = image.height,
+ bitmapData, ctx, rotateImg, rotateW, rotateH, angle, step, offcanvas, offctx, dHeight, dWidth;
+
+
+
+ // 카메라를 돌려서 찍은 경우, 높이를 가로 사이즈로 정한 다음 리사이징 처리. 이 경우, 파일 크기와 처리 속도가
+ // 증가한다.
+
+ // if (orientation === 6 || orientation === 8) {
+ // var ratio = resizeWidth / height;
+ // dHeight = height * ratio;
+ // dWidth = width * ratio;
+ // } else {
+ dHeight = Math.ceil(resizeWidth / width * height);
+ dWidth = resizeWidth;
+ // }
+
+ canvas.width = dWidth;
+ canvas.height = dHeight;
+ ctx = canvas.getContext("2d");
+
+ step = Math.ceil(Math.log(image.width / resizeWidth) / Math.log(2));
+
+ if (step > 1) {
+ offcanvas = document.createElement('canvas');
+ offctx = offcanvas.getContext('2d');
+ offcanvas.width = width / 2;
+ offcanvas.height = height / 2;
+
+ offctx.drawImage(image, 0, 0, offcanvas.width, offcanvas.height);
+ offctx.drawImage(offcanvas, 0, 0, offcanvas.width / 2, offcanvas.height / 2);
+ ctx.drawImage(offcanvas, 0, 0, offcanvas.width / 2, offcanvas.height / 2, 0, 0, dWidth, dHeight);
+ } else {
+ ctx.drawImage(image, 0, 0, dWidth, dHeight);
+ }
+
+ if (orientation === 6 || orientation === 8 || orientation === 3) {
+ angle = orientation === 6 ? Math.PI / 2 : (orientation === 8 ? -Math.PI / 2 : 180 * Math.PI / 2);
+ bitmapData = canvas.toDataURL(filetype, oEditor.config.imgJpegQuality);
+
+ rotateImg = new Image();
+ rotateImg.src = bitmapData;
+ rotateW = orientation !== 3 ? dHeight : dWidth;
+ rotateH = orientation !== 3 ? dWidth : dHeight;
+
+ canvas.width = rotateW;
+ canvas.height = rotateH;
+
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.save();
+ ctx.translate(canvas.width / 2, canvas.height / 2);
+ ctx.rotate(angle);
+ ctx.drawImage(rotateImg, -dWidth / 2, -dHeight / 2);
+ ctx.restore();
+ }
+
+ if (this.reader.watermark && addWaterMark) {
+ ctx.globalAlpha = oEditor.config.imgWaterMarkAlpha;
+ ctx.drawImage(this.reader.watermark,
+ canvas.width - this.reader.watermark.width, canvas.height - this.reader.watermark.height);
+ }
+ return canvas.toDataURL(filetype, oEditor.config.imgJpegQuality);
+ },
+
+ canvasToBlob : function (bitmapData, mimetype) {
+ var raw = atob(bitmapData.split(',')[1]),
+ intArray = [],
+ len = bitmapData.length,
+ i = 0;
+
+ for (; i < len; i++) {
+ intArray.push(raw.charCodeAt(i));
+ }
+ return new Blob([new Uint8Array(intArray)], {type: mimetype});
+ },
+
+ makeThumbnail : function (image, type, name, orientation) {
+ var canvas = document.createElement("canvas"),
+ width,
+ xhr = new XMLHttpRequest(),
+ data = new FormData(),
+ bitmapData, file;
+
+ xhr.open('POST', uploadScript, true);
+ width = oEditor.config.thumbnailWidth;
+
+ bitmapData = this.imageResize(image, type, width, orientation);
+ file = this.canvasToBlob(bitmapData, type);
+
+ data.append(inputFileName, file, 'thumb_' + name); // RFC Level 2
+
+ xhr.addEventListener("loadend", function () {
+
+ }, false);
+
+ xhr.addEventListener("error", function () {
+ alert("Thumbnail 파일 전송 중 오류:");
+ }, false);
+
+ xhr.send(data);
+ },
+
+ dataLoadHandler: function (evt) {
+ var self = this,
+ filename = evt.target.file.name,
+ filetype = evt.target.file.type,
+ file = evt.target.file,
+ blob, image, orientation = 1;
+
+ if (evt.target.readyState === FileReader.DONE) {
+ blob = new self.MyBlob(self.NewBlob(evt.target.result, filetype));
+ orientation = self.getOrientation(evt.target.result.slice(0, 64 * 1024));
+ image = new Image();
+
+ image.onload = function () {
+ var bitmapData = null,
+ canvas = document.createElement("canvas"),
+ data = new FormData(),
+ fileFormat,
+ imgBox = file.boxElem,
+ imgInfo = {},
+ randomName,
+ xhr = new XMLHttpRequest();
+
+ xhr.open('POST', uploadScript, true);
+
+ if (imageResizeWidth > 0 && this.width > imageResizeWidth) {
+ 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);
+ data.append(inputFileName, file, randomName); // RFC Level 2
+
+ if (debug) {
+ console.log('Successed: ' + filename);
+ }
+
+ xhr.addEventListener("error", function (evt) {
+ alert("파일 전송 중 오류: " + evt.target.error.code);
+ }, false);
+
+ xhr.addEventListener("loadend", function onLoadendImageHandler(xhrevt) {
+ if (xhrevt.target.readyState === xhrevt.target.DONE) {
+ if (oEditor.config.makeThumbnail) {
+ self.makeThumbnail(image, filetype, randomName, orientation, false);
+ }
+ }
+ image.src = '';
+ image = null;
+ }, false);
+
+ xhr.addEventListener("load", function (xhrevt) {
+ var jsonText, jsonData, img, onLoadHandler;
+ data = null;
+
+ if (xhrevt.target.status === 200) {
+ jsonText = decodeURI(oEditor.trimSpace(this.responseText));
+ jsonText = jsonText.replace(/\+/g, ' ').replace(/\\/g, '\\\\');
+ jsonData = JSON.parse(jsonText);
+
+ onLoadHandler = function () {
+ imgInfo = {
+ fileName: jsonData.fileName,
+ filePath: jsonData.filePath,
+ fileSize: jsonData.fileSize,
+ fileUrl: jsonData.fileUrl,
+ origName: filename,
+ origSize: file.size,
+ height: img.height,
+ width: img.width
+ };
+
+ imageCompletedList[imgBox.id] = imgInfo;
+ imgComplete(this, imgInfo, imgBox.id);
+ imgBox.appendChild(img);
+
+ if (debug) {
+ console.log('Image URL: ' + img.src + ', size:' + file.size);
+ }
+
+ setTimeout(function () {
+ self.load();
+ }, 100);
+
+ if (debug) {
+ console.log('Uploaded');
+ }
+ };
+ img = new Image();
+ img.onload = onLoadHandler;
+ img.src = decodeURIComponent(jsonData.fileUrl);
+ } else {
+ alert("HTTP 오류: " + xhr.status);
+ }
+ }, false);
+
+ blob.dispose();
+ blob = null;
+ xhr.send(data);
+ };
+
+ image.src = blob.getURL();
+ }
+ },
+
+ onReadDataErrorHandler: function (evt) {
+ var status = '';
+ switch (evt.target.error.code) {
+ case evt.target.error.NOT_FOUND_ERR:
+ status = "파일을 찾을 수 없습니다.";
+ break;
+ case evt.target.error.NOT_READABLE_ERR:
+ status = "파일을 읽을 수 없습니다.";
+ break;
+ case evt.target.error.ABORT_ERR:
+ status = "파일 읽기가 중지되었습니다.";
+ break;
+ case evt.target.error.SECURITY_ERR:
+ status = "파일이 잠겨 있습니다.";
+ break;
+ case evt.target.error.ENCODING_ERR:
+ status = "data:// URL의 파일 인코딩 길이가 너무 깁니다.";
+ break;
+ default:
+ status = "파일 읽기 오류: " + evt.target.error.code;
+ }
+ this.removeEventListener('error', this.onReadDataErrorHandler);
+ alert("'" + evt.target.filename + "' " + status);
+ },
+
+ load: function () {
+ var file = this.list.shift(), self = this, watermark = null;
+
+ if (file) {
+ if (debug) {
+ console.log('File ' + this.index + ', Name: ' + file.name + ', Size: ' + file.size);
+ }
+ this.reader.file = file;
+ this.reader.watermark = null;
+
+ if (oEditor.config.imgWaterMarkUrl !== '' && oEditor.config.imgWaterMarkUrl !== null) {
+ watermark = new Image();
+ watermark.onerror = function () {
+ alert('워터마크 이미지를 읽을 수 없습니다. (' + oEditor.config.imgWaterMarkUrl + ')');
+ self.reader.readAsArrayBuffer(file);
+ };
+ watermark.onload = function () {
+ self.reader.watermark = this;
+ self.reader.readAsArrayBuffer(file);
+ };
+ watermark.src = oEditor.config.imgWaterMarkUrl;
+ } else {
+ this.reader.readAsArrayBuffer(file);
+ }
+ } else {
+ this.clear();
+ }
+ },
+
+ clear: function () {
+ var inputFile = document.getElementById('inputImageUpload'),
+ theForm = document.createElement('form'),
+ fileSelectButton = document.getElementById('fileSelectButton');
+
+ this.list = [];
+
+ theForm.appendChild(inputFile);
+ theForm.reset();
+ fileSelectButton.parentNode.insertBefore(inputFile, fileSelectButton);
+ fileSelectButton.style.marginLeft = '-1px';
+ }
+};
+
+function fileSelectDrop(evt) {
+ var files,
+ upload = new DoUpload();
+
+ oEditor.stopEvent(evt);
+ this.className = "imageListWrapperHtml5";
+
+ files = evt.dataTransfer.files;
+ upload.select(files);
+}
+
+function dragOver(ev) {
+ oEditor.stopEvent(ev);
+ this.className = "dragOver";
+}
+
+function dragOut(ev) {
+ oEditor.stopEvent(ev);
+ this.className = "imageListWrapperHtml5";
+}
+
+function setResizeWidth() {
+ var value = oEditor.trimSpace(imageResizeInput.value);
+ if (value) {
+ value = Math.ceil(parseInt(value, 10));
+ if (!isNaN(value) && value < oEditor.config.imgMaxWidth) {
+ imageResizeWidth = value;
+ } else {
+ imageResizeInput.value = '';
+ imageResizeInput.setAttribute('placeholder', oEditor.config.imgMaxWidth.toString());
+ }
+ }
+}
+
+function init(dialog) {
+ var dlg, i, elem, input, select, value, name;
+
+ oEditor = this;
+ oEditor.dialog = dialog;
+ dlg = new Dialog(oEditor);
+ browser = oEditor.getBrowser();
+
+ uploadImagePath = oEditor.config.iconPath + 'imageUpload';
+ uploadMaxNumber = oEditor.config.imgUploadNumber;
+ uploadScript = oEditor.config.editorPath + 'imageUpload/upload.php';
+ deleteScript = oEditor.config.editorPath + 'imageUpload/delete.php';
+ imageListWrapper = document.getElementById("imageListWrapper");
+
+ imageResizeWidth = oEditor.config.imgMaxWidth;
+ imageResizeInput = document.getElementById('idResizeWidth');
+ select = document.getElementById('idResizeSelectBox');
+
+ if (imageResizeWidth > 0) {
+ for (i = 0; i < oEditor.config.imgResizeValue.length; i++) {
+ name = value = oEditor.config.imgResizeValue[i];
+ if (value > oEditor.config.imgMaxWidth) {
+ continue;
+ }
+ if (value === -1) {
+ name = '<입력>';
+ }
+ select.options[select.options.length] = new Option(name, value, false, value === oEditor.config.imgResizeSelected);
+ }
+ select.onchange = function () {
+ if (this.value < 0) {
+ document.getElementById('idUserInputWrapper').style.display = '';
+ } else {
+ document.getElementById('idUserInputWrapper').style.display = 'none';
+ imageResizeWidth = this.value;
+ }
+ };
+ imageResizeInput.setAttribute('placeholder', imageResizeWidth.toString());
+ imageResizeWidth = select.value;
+ } else {
+ select.options[0] = new Option('원본', 0);
+ select.setAttribute('disabled', 'disabled');
+ imageResizeWidth = 0;
+ }
+
+ document.getElementById("maxImageNum").appendChild(document.createTextNode(uploadMaxNumber.toString()));
+
+ button = [
+ { alt: "", img: 'submit.gif', cmd: doSubmit, hspace: 2 },
+ { alt: "", img: 'cancel.gif', cmd: closeWindow, hspace: 2 }
+ ];
+
+ dlg.setDialogHeight(370);
+ dlg.showButton(button);
+ showContents();
+ initGallery();
+ showUploadWindow();
+ createInsertionMaker();
+ selectedFilesNum = 0;
+
+ oEditor.addEvent(imageListWrapper, 'dragover', dragOver);
+ oEditor.addEvent(imageListWrapper, 'dragleave', dragOut);
+ oEditor.addEvent(imageListWrapper, 'drop', fileSelectDrop);
+
+ elem = document.getElementById('id_alignment').elements;
+
+ for (i = 0; i < elem.length; i++) {
+ if (elem[i].name === "alignment" && elem[i].value === oEditor.config.imgDefaultAlign) {
+ elem[i].checked = "checked";
+ break;
+ }
+ }
+
+ if (browser.mobile) {
+ input = document.getElementById('inputImageUpload');
+ input.setAttribute('capture', 'gallery');
+ }
+}
diff --git a/plugin/editor/cheditor5/popup/js/image.js b/plugin/editor/cheditor5/popup/js/image.js
new file mode 100644
index 000000000..7fc7c642f
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/image.js
@@ -0,0 +1,890 @@
+// ================================================================
+// CHEditor 5
+// ================================================================
+var uploadScript = '',
+ deleteScript = '',
+ AppID = 'chximage',
+ AppSRC = '',
+ activeImage = null,
+ destinationObject = null,
+ readyToMove = false,
+ moveTimer = -1,
+ dragDropDiv,
+ insertionMarker,
+ offsetX_marker = -4,
+ offsetY_marker = -3,
+ geckoOffsetX_marker = 4,
+ geckoOffsetY_marker = -2,
+ divXPositions = [],
+ divYPositions = [],
+ divWidth = [],
+ divHeight = [],
+ tmpLeft = 0,
+ tmpTop = 0,
+ eventDiff_x = 0,
+ eventDiff_y = 0,
+ modifyImages = [],
+ uploadMaxNumber = 12,
+ imageCompleted = 0,
+ imageCompletedList = [],
+ uploadButton = '',
+ uploadImagePath = '',
+ showThumbnailSize = { width: 120, height: 90 },
+ oEditor = null,
+ button,
+ imageResizeWidth = 0,
+ makeThumbnail = true,
+ makeThumbnailWidth = 120,
+ makeThumbnailHeight = 90,
+ sortOnName = false,
+ browser = null;
+
+function createInsertionMaker() {
+ var wrapper = document.getElementById('insertionMarker'),
+ topIco = new Image(),
+ middleIco = new Image(),
+ bottomIco = new Image();
+
+ topIco.src = uploadImagePath + '/marker_top.gif';
+ topIco.style.width = '6px';
+ topIco.style.height = '1px';
+ wrapper.appendChild(topIco);
+
+ middleIco.src = uploadImagePath + '/marker_middle.gif';
+ middleIco.style.height = '96px';
+ middleIco.style.width = '6px';
+ wrapper.appendChild(middleIco);
+
+ bottomIco.src = uploadImagePath + '/marker_bottom.gif';
+ bottomIco.style.width = '6px';
+ bottomIco.style.height = '1px';
+ wrapper.appendChild(bottomIco);
+}
+
+function popupClose() {
+ // ----------------------------------------------------------------------------------
+ swfobject.removeSWF(AppID);
+ oEditor.popupWinCancel();
+}
+
+function showContents() {
+ var spacer = function (id) {
+ var clear = document.createElement('span');
+ clear.style.height = '0';
+ clear.style.width = '0';
+ clear.className = 'clear';
+ clear.id = 'spacer' + id;
+ return clear;
+ }, spacerNo = 1, i, imgBox, theImg, lastSpacer;
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ if (i > 0 && ((i % 4) === 0)) {
+ document.getElementById('imageListWrapper').appendChild(spacer(spacerNo++));
+ }
+
+ imgBox = document.createElement('div');
+ imgBox.id = 'imgBox' + i;
+ imgBox.className = 'imageBox';
+ theImg = document.createElement('div');
+ theImg.id = 'img_' + i;
+ theImg.className = 'imageBox_theImage';
+ imgBox.appendChild(theImg);
+
+ document.getElementById('imageListWrapper').appendChild(imgBox);
+ if (i === (uploadMaxNumber - 1)) {
+ lastSpacer = spacer(spacerNo);
+ lastSpacer.style.height = "7px";
+ document.getElementById('imageListWrapper').appendChild(lastSpacer);
+ }
+ }
+
+ if (browser.msie && browser.ver < 7) {
+ document.getElementById('imageListWrapper').style.padding = '5px 2px 5px 2px';
+ document.getElementById('imageInfoBox').style.height = '302px';
+ document.getElementById('imageInfoBox').style.width = '124px';
+ } else {
+ document.getElementById('imageListWrapper').style.padding = '5px 7px 0 5px';
+ document.getElementById('imageInfoBox').style.height = '298px';
+ document.getElementById('imageInfoBox').style.width = '130px';
+ }
+}
+
+function openFiles() {
+ // ----------------------------------------------------------------------------------
+ var elem = browser.msie ? document.getElementById(AppID) : document[AppID];
+ elem.AddFiles();
+}
+
+function setImageCount() {
+ imageCompleted++;
+ document.getElementById('imageCount').innerHTML = imageCompleted;
+}
+
+function getImageCount() {
+ return imageCompleted;
+}
+
+function allowedMaxImage() {
+ return uploadMaxNumber - getImageCount();
+}
+
+function getUploadedCount() {
+ return document.getElementById('imageListWrapper').getElementsByTagName('img').length;
+}
+
+function uploadedImageCount() {
+ imageCompleted = getUploadedCount();
+ document.getElementById('imageCount').innerHTML = imageCompleted;
+}
+
+function uploadError(msg) {
+ alert(msg);
+}
+
+function imageDelete(filePath) {
+ var chximage = document.getElementById(AppID);
+ chximage.ImageDelete(encodeURI(filePath));
+}
+
+function getTopPos(inputObj) {
+ // ----------------------------------------------------------------------------------
+ var returnValue = inputObj.offsetTop;
+
+ inputObj = inputObj.offsetParent;
+ while (inputObj) {
+ if (inputObj.tagName.toLowerCase() !== 'html') {
+ returnValue += (inputObj.offsetTop - inputObj.scrollTop);
+ if (browser.msie) {
+ returnValue += inputObj.clientTop;
+ }
+ }
+ inputObj = inputObj.offsetParent;
+ }
+ return returnValue;
+}
+
+function getLeftPos(inputObj) {
+ // ----------------------------------------------------------------------------------
+ var returnValue = inputObj.offsetLeft;
+
+ inputObj = inputObj.offsetParent;
+ while (inputObj) {
+ if (inputObj.id !== 'imageListWrapper') {
+ returnValue += inputObj.offsetLeft;
+ if (browser.msie) {
+ returnValue += inputObj.clientLeft;
+ }
+ }
+ inputObj = inputObj.offsetParent;
+ }
+ return returnValue;
+}
+
+function getDivCoordinates() {
+ // ----------------------------------------------------------------------------------
+ var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('DIV'),
+ i = 0;
+
+ for (; i < imgBox.length; i++) {
+ if ((imgBox[i].className === 'imageBox' || imgBox[i].className === 'imageBoxHighlighted') && imgBox[i].id) {
+ divXPositions[imgBox[i].id] = getLeftPos(imgBox[i]);
+ divYPositions[imgBox[i].id] = getTopPos(imgBox[i]);
+ divWidth[imgBox[i].id] = imgBox[i].offsetWidth;
+ divHeight[imgBox[i].id] = imgBox[i].offsetHeight;
+ }
+ }
+}
+
+function reOrder() {
+ // ----------------------------------------------------------------------------------
+ var wrapper = document.getElementById('imageListWrapper'),
+ imgBox = wrapper.getElementsByTagName('div'),
+ imgNum = 0, i, spacer, breakline = [];
+
+ for (i = 0; i < imgBox.length; i++) {
+ if (imgBox[i].id.indexOf('imgBox') === -1) {
+ continue;
+ }
+
+ imgBox[i].className = 'imageBox';
+ imgBox[i].firstChild.className = 'imageBox_theImage';
+
+ if (imgNum > 0 && (imgNum % 4) === 0) {
+ breakline.push(imgBox[i].id);
+ }
+
+ imgNum++;
+ }
+
+ for (i = 0; i < breakline.length; i++) {
+ spacer = document.getElementById('spacer' + (i + 1));
+ if (i + 1 === breakline.length) {
+ wrapper.appendChild(spacer);
+ } else {
+ wrapper.insertBefore(spacer, document.getElementById(breakline[i]));
+ }
+ }
+}
+
+function setImageInfo(id) {
+ var elem;
+ if (!id) {
+ document.getElementById('selectedImageWidth').innerHTML = '0';
+ document.getElementById('selectedImageHeight').innerHTML = '0';
+ document.getElementById('selectedImageName').innerHTML = "없음";
+ } else {
+ elem = imageCompletedList[id];
+ document.getElementById('selectedImageWidth').innerHTML = elem.width;
+ document.getElementById('selectedImageHeight').innerHTML = elem.height;
+ document.getElementById('selectedImageName').innerHTML = elem.origName;
+ }
+}
+
+function showDelete() {
+ // ----------------------------------------------------------------------------------
+ var self = this, btn;
+
+ if (readyToMove) {
+ return;
+ }
+
+ getDivCoordinates();
+ self.className = 'imageBox_theImage_over';
+ btn = document.getElementById('removeImageButton');
+ btn.style.left = (showThumbnailSize.width - parseInt(btn.style.width, 10) - 1) + 'px';
+ btn.style.top = '-1px';
+
+ self.appendChild(btn);
+ btn.style.display = 'block';
+
+ btn.onmouseover = function (ev) {
+ ev = ev || window.event;
+ ev.cancelBubble = true;
+ this.style.display = 'block';
+ setImageInfo(self.id);
+ this.className = 'removeButton_over';
+ self.className = 'imageBox_theImage_over';
+ };
+ btn.onmouseout = function () {
+ this.className = 'removeButton';
+ };
+ btn.onmousedown = function () {
+ var images = self.getElementsByTagName('img'), i, wrapper, moveobj, target;
+
+ for (i = 0; i < images.length; i++) {
+ self.removeChild(images[i]);
+ }
+
+ self.removeChild(self.firstChild);
+ self.className = 'imageBox_theImage';
+
+ if (self.parentNode.nextSibling && self.parentNode.nextSibling.id) {
+ wrapper = document.getElementById('imageListWrapper');
+ moveobj = self.parentNode.nextSibling;
+ target = self.parentNode;
+
+ while (moveobj !== null) {
+ if (moveobj.firstChild && !moveobj.firstChild.firstChild) {
+ break;
+ }
+ if (/^spacer/.test(moveobj.id)) {
+ moveobj = moveobj.nextSibling;
+ continue;
+ }
+ wrapper.insertBefore(moveobj, target);
+ moveobj = target.nextSibling;
+ }
+ }
+
+ reOrder();
+ uploadedImageCount();
+ setImageInfo(0);
+ this.style.display = 'none';
+ document.body.appendChild(this);
+ self.onmouseout = self.onmouseover = null;
+ };
+
+ setImageInfo(self.id);
+}
+
+function hideDelete() {
+ // ----------------------------------------------------------------------------------
+ document.getElementById('removeImageButton').style.display = 'none';
+}
+
+function startUpload(count) {
+ // ----------------------------------------------------------------------------------
+ var el = document.getElementById('imageListWrapper').getElementsByTagName('div'), i, imgBox;
+
+ for (i = 0; i < el.length; i++) {
+ imgBox = el[i];
+ if (imgBox.className !== 'imageBox_theImage') {
+ continue;
+ }
+
+ if (count === 0) {
+ break;
+ }
+
+ if (!imgBox.firstChild || imgBox.firstChild.tagName.toLowerCase() !== 'img') {
+ imgBox.style.backgroundImage = "url('" + uploadImagePath + "/loader.gif')";
+ count--;
+ }
+ }
+}
+
+function fileFilterError(file) {
+ alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
+ "gif, png, jpg, 그림 파일만 전송할 수 있습니다.");
+}
+
+function imgComplete(img, imgSize, boxId) {
+ var resizeW, resizeH, M, elem;
+ img.setAttribute("border", '0');
+
+ if (imgSize.width > showThumbnailSize.width || imgSize.height > showThumbnailSize.height) {
+ if (imgSize.width > imgSize.height) {
+ resizeW = (imgSize.width > showThumbnailSize.width) ? showThumbnailSize.width : imgSize.width;
+ resizeH = Math.round((imgSize.height * resizeW) / imgSize.width);
+ } else {
+ resizeH = (imgSize.height > showThumbnailSize.height) ? showThumbnailSize.height : imgSize.height;
+ resizeW = Math.round((imgSize.width * resizeH) / imgSize.height);
+ }
+
+ if (resizeH > showThumbnailSize.height) {
+ resizeH = (imgSize.height > showThumbnailSize.height) ? showThumbnailSize.height : imgSize.height;
+ resizeW = Math.round((imgSize.width * resizeH) / imgSize.height);
+ }
+
+ } else {
+ resizeW = imgSize.width;
+ resizeH = imgSize.height;
+ }
+
+ img.style.width = resizeW - 2 + 'px';
+ img.style.height = resizeH - 2 + 'px';
+ img.style.margin = "1px";
+
+ if (resizeW < showThumbnailSize.width) {
+ M = showThumbnailSize.width - resizeW;
+ img.style.marginLeft = Math.round(M / 2) + 'px';
+ }
+
+ if (resizeH < showThumbnailSize.height) {
+ M = showThumbnailSize.height - resizeH;
+ img.style.marginTop = Math.round(M / 2) + 'px';
+ }
+
+ elem = document.getElementById(boxId);
+ elem.style.backgroundImage = "url('" + uploadImagePath + "/dot.gif')";
+ elem.onmouseover = showDelete;
+ elem.onmouseout = function() {
+ this.className = 'imageBox_theImage';
+ setImageInfo(0);
+ hideDelete();
+ };
+
+ setImageCount();
+}
+
+function uploadComplete(image) {
+ // ----------------------------------------------------------------------------------
+ var el = document.getElementById('imageListWrapper').getElementsByTagName('div'),
+ imgBox = null, tmpImg, i, imgInfo,
+ imgOnLoad = function () {
+ imgInfo = { "width": image.width, "height": image.height, "fileSize": image.fileSize,
+ "fileUrl": image.fileUrl, "fileName": image.fileName, "filePath": image.filePath, "origName": image.origName };
+
+ imageCompletedList[imgBox.id] = imgInfo;
+ imgComplete(this, imgInfo, imgBox.id);
+ };
+
+ image.filePath = decodeURI(image.filePath);
+ image.origName = decodeURI(image.origName);
+
+ for (i = 0; i < el.length; i++) {
+ imgBox = el[i];
+ if (imgBox.className !== 'imageBox_theImage') {
+ continue;
+ }
+
+ if (!imgBox.firstChild || imgBox.firstChild.tagName.toLowerCase() !== 'img') {
+ tmpImg = new Image();
+ tmpImg.style.width = "0px";
+ tmpImg.style.height = "0px";
+ tmpImg.setAttribute("alt", image.origName);
+ tmpImg.onload = imgOnLoad;
+ tmpImg.src = image.fileUrl;
+ imgBox.appendChild(tmpImg);
+ break;
+ }
+ }
+}
+
+function showUploadWindow() {
+ // ----------------------------------------------------------------------------------
+ var uploadWindow = document.getElementById("uploadWindow"),
+ uploadWindowWidth = 700,
+ winWidth, el, i, j, imgBox, img;
+
+ if (!(oEditor.undefined(window.innerWidth))) {
+ winWidth = window.innerWidth;
+ } else if (document.documentElement &&
+ (!(oEditor.undefined(document.documentElement.clientWidth))) &&
+ document.documentElement.clientWidth !== 0) {
+ winWidth = document.documentElement.clientWidth;
+ } else if (document.body && (!(oEditor.undefined(document.body.clientWidth)))) {
+ winWidth = document.body.clientWidth;
+ } else {
+ alert('현재 브라우저를 지원하지 않습니다.');
+ return;
+ }
+
+ uploadWindow.style.left = winWidth / 2 - (uploadWindowWidth / 2) + 'px';
+ uploadWindow.style.display = "block";
+ uploadWindow.style.width = uploadWindowWidth + 'px';
+
+ if (modifyImages.length > 0) {
+ el = document.getElementById('imageListWrapper').getElementsByTagName('div');
+ for (i = 0; i < modifyImages.length; i++) {
+ if (i > 7) {
+ break;
+ }
+
+ for (j = 0; j < el.length; j++) {
+ imgBox = el[j];
+ if (imgBox.className !== 'imageBox_theImage') {
+ continue;
+ }
+
+ if (imgBox.firstChild && (imgBox.firstChild.src === modifyImages[i])) {
+ break;
+ }
+
+ if (imgBox.firstChild === null) {
+ img = new Image();
+ img.src = modifyImages[i];
+ img.border = 0;
+ img.alt = '';
+ img.style.width = '120px';
+ img.style.height = '90px';
+ imgBox.appendChild(img);
+ break;
+ }
+ }
+ }
+ }
+}
+
+function removeImages() {
+ var images = [], i, j, theImage, img, remove;
+ document.body.appendChild(document.getElementById('removeImageButton'));
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ theImage = document.getElementById('img_' + i);
+ if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') {
+ images.push(theImage);
+ }
+ }
+
+ for (i = 0; i < images.length; i++) {
+ img = images[i];
+ if (img.firstChild !== null) {
+ oEditor.removeEvent(img, 'mouseover', showDelete);
+ remove = img.getElementsByTagName('img');
+
+ for (j = 0; j < remove.length; j++) {
+ img.removeChild(remove[j]);
+ }
+
+ img.parentNode.className = 'imageBox';
+ oEditor.removeEvent(img, 'mouseover', showDelete);
+ }
+ }
+ uploadedImageCount();
+ imageCompletedList = [];
+}
+
+function removeImage() {
+ // ----------------------------------------------------------------------------------
+ var i, theImage, found = false;
+
+ for (i = 0; i < uploadMaxNumber; i++) {
+ theImage = document.getElementById('img_' + i);
+ if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ if (!confirm('추가하신 사진이 있습니다. 사진 넣기를 취소하시겠습니까?')) {
+ return false;
+ }
+ removeImages();
+ }
+
+ return true;
+}
+
+function closeWindow() {
+ // ----------------------------------------------------------------------------------
+ if (removeImage()) {
+ popupClose();
+ }
+}
+
+function cancelEvent() {
+ // ----------------------------------------------------------------------------------
+ return false;
+}
+
+function startMoveTimer() {
+ // ----------------------------------------------------------------------------------
+ var subElements, newDiv;
+
+ if (moveTimer >= 0 && moveTimer < 10) {
+ moveTimer++;
+ setTimeout('startMoveTimer()', 8);
+ }
+
+ if (moveTimer === 5) {
+ getDivCoordinates();
+ subElements = dragDropDiv.getElementsByTagName('div');
+ if (subElements.length > 0) {
+ dragDropDiv.removeChild(subElements[0]);
+ }
+
+ dragDropDiv.style.display = 'block';
+ newDiv = activeImage.cloneNode(true);
+ newDiv.className = 'imageBox';
+ newDiv.style.opacity = 0.5;
+
+ newDiv.id = '';
+ newDiv.style.padding = '2px';
+ dragDropDiv.appendChild(newDiv);
+
+ dragDropDiv.style.top = tmpTop + 'px';
+ dragDropDiv.style.left = tmpLeft + 'px';
+ }
+
+ return false;
+}
+
+function getMouseButtn(e) {
+ var code;
+ e = e || window.event;
+ code = e.button;
+
+ if (code) {
+ if (browser.msie && browser.version < 9) {
+ code = code === 1 ? 0 : (code === 4 ? 1 : code);
+ }
+ }
+
+ return code;
+}
+
+function selectImage(e) {
+ // ----------------------------------------------------------------------------------
+ var el = this.parentNode.firstChild.firstChild, obj;
+
+ if (!el) {
+ return;
+ }
+
+ e = e || window.event;
+ if (getMouseButtn(e) === 2) {
+ return;
+ }
+
+ obj = this.parentNode;
+ hideDelete();
+
+ obj.className = 'imageBoxHighlighted';
+ activeImage = obj;
+ readyToMove = true;
+ moveTimer = 0;
+
+ tmpLeft = e.clientX + Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
+ tmpTop = e.clientY + Math.max(document.body.scrollTop, document.documentElement.scrollTop);
+
+ startMoveTimer();
+ return false;
+}
+
+function dragDropEnd() {
+ // ----------------------------------------------------------------------------------
+ var parentObj, chkObj, turn = false;
+
+ readyToMove = false;
+ moveTimer = -1;
+ dragDropDiv.style.display = 'none';
+ insertionMarker.style.display = 'none';
+
+ if (!activeImage) {
+ return;
+ }
+
+ if (destinationObject && destinationObject !== activeImage) {
+ parentObj = destinationObject.parentNode;
+ chkObj = destinationObject.previousSibling;
+ turn = false;
+
+ if (chkObj === null) {
+ chkObj = document.getElementById('imageListWrapper').firstChild;
+ turn = true;
+ }
+
+ if (chkObj.id.indexOf('spacer') !== -1) {
+ chkObj = chkObj.previousSibling;
+ }
+
+ if (chkObj.firstChild.firstChild === null) {
+ reOrder();
+ return;
+ }
+
+ if (chkObj && chkObj.id !== null) {
+ while (chkObj) {
+ if (chkObj.firstChild.firstChild !== null) {
+ break;
+ }
+ chkObj = chkObj.previousSibling;
+ }
+ destinationObject = turn ? chkObj : chkObj.nextSibling;
+ }
+
+ parentObj.insertBefore(activeImage, destinationObject);
+ reOrder();
+
+ activeImage = null;
+ destinationObject = null;
+ getDivCoordinates();
+
+ return false;
+ }
+
+ activeImage.className = 'imageBox';
+ return true;
+}
+
+function dragDropMove(e) {
+ // ----------------------------------------------------------------------------------
+ var elementFound = false, prop, offsetX, offsetY, leftPos, topPos, btnCode;
+
+ if (moveTimer === -1 || !readyToMove) {
+ return;
+ }
+
+ e = e || window.event;
+
+ leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x;
+ topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y;
+
+ dragDropDiv.style.top = topPos + 'px';
+ dragDropDiv.style.left = leftPos + 'px';
+
+ leftPos = leftPos + eventDiff_x;
+ topPos = topPos + eventDiff_y;
+
+ if (getMouseButtn(e) !== 0) {
+ dragDropEnd();
+ }
+
+ for (prop in divXPositions) {
+ if (!divXPositions.hasOwnProperty(prop) || divXPositions[prop].className === 'clear') {
+ continue;
+ }
+
+ if (divXPositions[prop] < leftPos &&
+ (divXPositions[prop] + divWidth[prop] * 0.7) > leftPos &&
+ divYPositions[prop] < topPos &&
+ (divYPositions[prop] + divWidth[prop]) > topPos) {
+ if (browser.msie) {
+ offsetX = offsetX_marker;
+ offsetY = offsetY_marker;
+ } else {
+ offsetX = geckoOffsetX_marker;
+ offsetY = geckoOffsetY_marker;
+ }
+
+ insertionMarker.style.top = divYPositions[prop] + offsetY + 'px';
+ insertionMarker.style.left = divXPositions[prop] + offsetX + 'px';
+ insertionMarker.style.display = 'block';
+ destinationObject = document.getElementById(prop);
+ elementFound = true;
+ break;
+ }
+ }
+
+ if (!elementFound) {
+ insertionMarker.style.display = 'none';
+ destinationObject = null;
+ }
+
+ return false;
+}
+
+function saveImageOrder() {
+ // ----------------------------------------------------------------------------------
+ var rData = [],
+ objects = document.getElementById('imageListWrapper').getElementsByTagName('div'),
+ i;
+
+ for (i = 0; i < objects.length; i++) {
+ if (objects[i].className === 'imageBox' ||
+ objects[i].className === 'imageBoxHighlighted') {
+ rData.push(objects[i].id);
+ }
+ }
+
+ return rData;
+}
+
+function initGallery() {
+ // ----------------------------------------------------------------------------------
+ var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('div'),
+ i;
+
+ for (i = 0; i < imgBox.length; i++) {
+ if (imgBox[i].className === 'imageBox_theImage') {
+ imgBox[i].onmousedown = selectImage;
+ }
+ }
+
+ document.body.onselectstart = cancelEvent;
+ document.body.ondragstart = cancelEvent;
+ document.body.onmouseup = dragDropEnd;
+ document.body.onmousemove = dragDropMove;
+
+ dragDropDiv = document.getElementById('dragDropContent');
+ insertionMarker = document.getElementById('insertionMarker');
+ getDivCoordinates();
+}
+
+function doSubmit() {
+ // ----------------------------------------------------------------------------------
+ var el = document.getElementById('imageListWrapper').getElementsByTagName('div'),
+ imageArray = [],
+ num = 0,
+ elem = document.getElementById('id_alignment').elements,
+ imgParagraph = false,
+ useSpacer = false,
+ imgAlign = 'top', i, imgBox, input;
+
+ for (i = 0; i < elem.length; i++) {
+ input = elem[i];
+ switch (input.name) {
+ case "alignment" :
+ if (input.checked) {
+ imgAlign = input.value;
+ }
+ break;
+ case "para" :
+ imgParagraph = input.checked;
+ break;
+ case "use_spacer" :
+ useSpacer = input.checked;
+ break;
+ }
+ }
+
+ for (i = 0; i < el.length; i++) {
+ imgBox = el[i];
+ if (imgBox.className !== "imageBox_theImage") {
+ continue;
+ }
+
+ if (imgBox.firstChild !== null) {
+ imageArray[num] = imageCompletedList[imgBox.id];
+
+ if (imgAlign === "break") {
+ imageArray[num].alt = "break";
+ } else {
+ imageArray[num].alt = '';
+ imageArray[num].align = imgAlign;
+ }
+
+ num++;
+ }
+ }
+
+ if (imageArray.length > 0) {
+ oEditor.doInsertImage(imageArray, imgParagraph, useSpacer);
+ }
+ oEditor.popupWinClose();
+}
+
+function initEvent() {
+ var swfVersionStr = "11.1.0",
+ xiSwfUrlStr = "http://get.adobe.com/kr/flashplayer/",
+ flashvars = {
+ UploadScript: uploadScript,
+ DeleteScript: deleteScript,
+ UploadButton: uploadButton,
+ MakeThumbnail: makeThumbnail,
+ ThumbnailWidth: makeThumbnailWidth,
+ ThumbnailHeight: makeThumbnailHeight,
+ ImageResizeWidth: imageResizeWidth,
+ loadPolicyFile: true,
+ SortOnName: sortOnName
+ },
+ params = {
+ quality: "high",
+ bgcolor: "#ffffff",
+ allowscriptaccess: "Always",
+ allowfullscreen: "false",
+ //allowNetworking: "all",
+ wmode: "transparent"
+ },
+ attributes = { id: AppID, name: AppID, align: "middle" };
+
+ swfobject.embedSWF(AppSRC, "oFlashButton", "93", "22", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
+}
+
+function init(dialog) {
+ var dlg = new Dialog(this),
+ elem = document.getElementById('id_alignment').elements,
+ i;
+
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ browser = oEditor.getBrowser();
+
+ uploadImagePath = oEditor.config.iconPath + 'imageUpload';
+ uploadButton = '../icons/imageUpload/add.gif';
+ AppSRC = oEditor.config.popupPath + 'flash/chximage.swf';
+ uploadMaxNumber = oEditor.config.imgUploadNumber;
+ uploadScript = oEditor.config.editorPath + 'imageUpload/upload.php';
+ deleteScript = oEditor.config.editorPath + 'imageUpload/delete.php';
+
+ imageResizeWidth = oEditor.config.imgMaxWidth;
+ makeThumbnail = oEditor.config.makeThumbnail;
+ sortOnName = oEditor.config.imgUploadSortName;
+ makeThumbnailWidth = oEditor.config.thumbnailWidth;
+ makeThumbnailHeight = oEditor.config.thumbnailHeight;
+
+ document.getElementById("maxImageNum").appendChild(document.createTextNode(uploadMaxNumber));
+
+ button = [
+ { alt: "", img: 'submit.gif', cmd: doSubmit, hspace: 2 },
+ { alt: "", img: 'cancel.gif', cmd: closeWindow, hspace: 2 }
+ ];
+
+ dlg.setDialogHeight(370);
+ dlg.showButton(button);
+ showContents();
+ initGallery();
+ showUploadWindow();
+ initEvent();
+ createInsertionMaker();
+
+ for (i = 0; i < elem.length; i++) {
+ if (elem[i].name === "alignment" && elem[i].value === oEditor.config.imgDefaultAlign) {
+ elem[i].checked = "checked";
+ break;
+ }
+ }
+}
diff --git a/plugin/editor/cheditor5/popup/js/image_upload_flash.js b/plugin/editor/cheditor5/popup/js/image_upload_flash.js
new file mode 100644
index 000000000..fb70ba021
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/image_upload_flash.js
@@ -0,0 +1,279 @@
+// Flash Player Version Detection - Rev 1.6
+// Detect Client Browser type
+// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
+var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function ControlVersion()
+{
+ var version = 0;
+ var axo;
+// var e;
+
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
+
+ try {
+ // version will be set for 7.X or greater players
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ version = axo.GetVariable("$version");
+ } catch (e) {
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 6.X players only
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+
+ // installed player is some revision of 6.0
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
+ // so we have to be careful.
+
+ // default to the first public version
+ version = "WIN 6,0,21,0";
+
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
+ axo.AllowScriptAccess = "always";
+
+ // safe to call for 6.0r47 or greater
+ version = axo.GetVariable("$version");
+
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 4.X or 5.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = axo.GetVariable("$version");
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 3.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = "WIN 3,0,18,0";
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 2.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ version = "WIN 2,0,0,11";
+ } catch (e) {
+ version = -1;
+ }
+ }
+
+ return version;
+}
+
+// JavaScript helper required to detect Flash Player PlugIn version information
+function GetSwfVer(){
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
+ var flashVer = -1;
+
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+ var descArray = flashDescription.split(" ");
+ var tempArrayMajor = descArray[2].split(".");
+ var versionMajor = tempArrayMajor[0];
+ var versionMinor = tempArrayMajor[1];
+ var versionRevision = descArray[3];
+ if (versionRevision == "") {
+ versionRevision = descArray[4];
+ }
+ if (versionRevision[0] == "d") {
+ versionRevision = versionRevision.substring(1);
+ } else if (versionRevision[0] == "r") {
+ versionRevision = versionRevision.substring(1);
+ if (versionRevision.indexOf("d") > 0) {
+ versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
+ }
+ } else if (versionRevision[0] == "b") {
+ versionRevision = versionRevision.substring(1);
+ }
+ flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+ }
+ }
+ // MSN/WebTV 2.6 supports Flash 4
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
+ // WebTV 2.5 supports Flash 3
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
+ // older WebTV supports Flash 2
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
+ else if ( isIE && isWin && !isOpera ) {
+ flashVer = ControlVersion();
+ }
+ return flashVer;
+}
+
+// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
+function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
+{
+ versionStr = GetSwfVer();
+ if (versionStr == -1 ) {
+ return false;
+ } else if (versionStr != 0) {
+ if(isIE && isWin && !isOpera) {
+ // Given "WIN 2,0,0,11"
+ tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
+ tempString = tempArray[1]; // "2,0,0,11"
+ versionArray = tempString.split(","); // ['2', '0', '0', '11']
+ } else {
+ versionArray = versionStr.split(".");
+ }
+ var versionMajor = versionArray[0];
+ var versionMinor = versionArray[1];
+ var versionRevision = versionArray[2];
+
+ // is the major.revision >= requested major.revision AND the minor version >= requested minor
+ if (versionMajor > parseFloat(reqMajorVer)) {
+ return true;
+ } else if (versionMajor == parseFloat(reqMajorVer)) {
+ if (versionMinor > parseFloat(reqMinorVer))
+ return true;
+ else if (versionMinor == parseFloat(reqMinorVer)) {
+ if (versionRevision >= parseFloat(reqRevision))
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+function AC_AddExtension(src, ext)
+{
+ if (src.indexOf('?') != -1)
+ return src.replace(/\?/, ext+'?');
+ else
+ return src + ext;
+}
+
+function AC_Generateobj(objAttrs, params, embedAttrs)
+{
+ if (isIE && isWin && !isOpera)
+ {
+ var str = '';
+ document.getElementById("oFlash").innerHTML = str;
+ }
+ else {
+ var oFlash = document.getElementById("oFlash");
+ var embed = document.createElement('embed');
+ for (var i in embedAttrs) {
+ embed.setAttribute(i, embedAttrs[i]);
+ }
+ oFlash.appendChild(embed);
+ }
+}
+
+function CHXImageRUN(){
+ var ret =
+ AC_GetArgs
+ ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ , "application/x-shockwave-flash"
+ );
+ AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+}
+
+function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
+ var ret = new Object();
+ ret.embedAttrs = new Object();
+ ret.params = new Object();
+ ret.objAttrs = new Object();
+ for (var i=0; i < args.length; i=i+2){
+ var currArg = args[i].toLowerCase();
+
+ switch (currArg){
+ case "classid":
+ break;
+ case "pluginspage":
+ ret.embedAttrs[args[i]] = args[i+1];
+ break;
+ case "src":
+ case "movie":
+ args[i+1] = AC_AddExtension(args[i+1], ext);
+ ret.embedAttrs["src"] = args[i+1];
+ ret.params[srcParamName] = args[i+1];
+ break;
+ case "onafterupdate":
+ case "onbeforeupdate":
+ case "onblur":
+ case "oncellchange":
+ case "onclick":
+ case "ondblClick":
+ case "ondrag":
+ case "ondragend":
+ case "ondragenter":
+ case "ondragleave":
+ case "ondragover":
+ case "ondrop":
+ case "onfinish":
+ case "onfocus":
+ case "onhelp":
+ case "onmousedown":
+ case "onmouseup":
+ case "onmouseover":
+ case "onmousemove":
+ case "onmouseout":
+ case "onkeypress":
+ case "onkeydown":
+ case "onkeyup":
+ case "onload":
+ case "onlosecapture":
+ case "onpropertychange":
+ case "onreadystatechange":
+ case "onrowsdelete":
+ case "onrowenter":
+ case "onrowexit":
+ case "onrowsinserted":
+ case "onstart":
+ case "onscroll":
+ case "onbeforeeditfocus":
+ case "onactivate":
+ case "onbeforedeactivate":
+ case "ondeactivate":
+ case "type":
+ case "codebase":
+ ret.objAttrs[args[i]] = args[i+1];
+ break;
+ case "id":
+ case "width":
+ case "height":
+ case "align":
+ case "vspace":
+ case "hspace":
+ case "class":
+ case "title":
+ case "accesskey":
+ case "name":
+ case "tabindex":
+ ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+ break;
+ default:
+ ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+ }
+ }
+ ret.objAttrs["classid"] = classid;
+ if (mimeType) ret.embedAttrs["type"] = mimeType;
+ return ret;
+}
+
+
diff --git a/plugin/editor/cheditor5/popup/js/image_url.js b/plugin/editor/cheditor5/popup/js/image_url.js
new file mode 100644
index 000000000..fa5b85d7d
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/image_url.js
@@ -0,0 +1,244 @@
+// ================================================================
+// CHEditor 5
+// ----------------------------------------------------------------
+// Homepage: http://www.chcode.com
+// Copyright (c) 1997-2014 CHSOFT
+// ================================================================
+var AppWidth = "250";
+var AppHeight = "175";
+var AppID = "cheditorPreview";
+var oEditor = null;
+var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit },
+ { alt : "", img : 'cancel.gif', cmd : popupClose } ];
+var newImage = null;
+
+function CHEditorImagePreview () {
+// ----------------------------------------------------------------------------------
+// callBack function
+
+ document.getElementById(AppID).CHEditorImagePreview("1", "1");
+}
+
+function CHXUploadRUN(src) {
+// ----------------------------------------------------------------------------------
+// Preview
+//
+ chxupload_RUN("src", src,
+ "width", AppWidth,
+ "height", AppHeight,
+ "align", "middle",
+ "id", AppID,
+ "classid", AppID,
+ "quality", "high",
+ "bgcolor", "#ebe9ed",
+ "name", AppID,
+ "wmode", "transparent",
+ "allowScriptAccess","Always",
+ "type", "application/x-shockwave-flash",
+ "pluginspage", "http://www.adobe.com/go/getflashplayer");
+}
+
+function getFilename (file) {
+ while (file.indexOf("/") != -1) {
+ file = file.slice(file.indexOf("/") + 1);
+ }
+ return file;
+}
+
+function popupClose()
+{
+ oEditor.popupWinCancel();
+}
+
+function chkImgFormat (url)
+{
+ var imageName = getFilename(url);
+ var allowSubmit = false;
+ var extArray = [".gif", ".jpg", ".jpeg", ".png"];
+
+ extArray.join(" ");
+ if (imageName === "") {
+ return false;
+ }
+
+ var ext = imageName.slice(imageName.lastIndexOf(".")).toLowerCase();
+ var i;
+
+ for (i = 0; i < extArray.length; i++) {
+ if (extArray[i] == ext) {
+ allowSubmit = true;
+ break;
+ }
+ }
+
+ if (!allowSubmit) {
+ alert("사진은 GIF, JPG, PNG 형식만 넣을 수 있습니다.");
+ return false;
+ }
+
+ return imageName;
+}
+
+function previewImage (source) {
+ if (navigator.appName.indexOf("microsoft") != -1) {
+ window[AppID].CHEditorImagePreview(source, 0, 0);
+ }
+ else {
+ document[AppID].CHEditorImagePreview(source, 0, 0);
+ }
+}
+
+function checkImageComplete (img) {
+ if (img.complete != true) {
+ setTimeout("checkImageComplete(document.getElementById('"+img.id+"'))", 250);
+ }
+ else {
+ document.getElementById('imageSize').innerHTML = '';
+
+ newImage = new Image();
+ newImage.style.width = img.width + 'px';
+ newImage.style.height = img.height + 'px';
+ newImage.setAttribute("src", img.src);
+ newImage.setAttribute("alt", getFilename(img.src));
+ }
+}
+
+function doPreview () {
+ var imgurl = document.getElementById('fm_imageUrl').value;
+ var fileName = chkImgFormat(imgurl);
+ if (!fileName) {
+ return;
+ }
+
+ var img = new Image();
+ img.src = imgurl;
+ img.id = fileName;
+
+ document.getElementById('tmpImage').appendChild(img);
+ checkImageComplete(img);
+ previewImage(img.src);
+}
+
+function getElementById(id) {
+ var el = null;
+ try {
+ el = document.getElementById(id);
+ }
+ catch (ignore) {}
+ return el;
+}
+
+function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ var i;
+ for (i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+}
+
+function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (oEditor.getBrowser().msie) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+}
+
+function doSubmit ()
+{
+ if (newImage == null) {
+ alert("미리 보기 버튼을 클릭하여 이미지를 확인해 주십시오.");
+ return;
+ }
+
+ if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
+ document.getElementById(AppID).style.display = 'none';
+ }
+
+ var fm_align = document.getElementById('fm_align').alignment;
+ var align = 'center';
+ var i;
+
+ for (i=0; i 0) {
+ datum = "";
+ } else {
+ datum = protocol[0].replace(/^\/\/\//, "//");
+ }
+ }
+
+ document.getElementById("fm_link_value").value = selectedItemValue + datum;
+ document.getElementById("fm_link_value").focus();
+}
+
+function returnSelected() {
+ var text, target = '', title = '';
+
+ if (document.getElementById("fm_link_value").value !== "") {
+ text = document.getElementById("fm_link_value").value;
+ } else {
+ alert("링크 URL을 입력하여 주십시오.");
+ return false;
+ }
+
+ if (document.getElementById("fm_target").value !== "") {
+ target = document.getElementById("fm_target").value;
+ }
+
+ if (document.getElementById("fm_title").value !== "") {
+ title = document.getElementById("fm_title").value;
+ }
+
+ if ((/^(http|https|file|ftp|mailto|gopher|news|telnet|):\/\//i.test(text)) === false &&
+ (/^(wias|javascript):/i.test(text) === false))
+ {
+ text = "http://" + text;
+ }
+
+ oEditor.hyperLink(text, target, title);
+ oEditor.popupWinClose();
+}
+
+function getSelected() {
+ var rng = oEditor.range, link = null, protocol, protocolSel, i, oldTarget, targetSel, j;
+
+ if (window.getSelection) {
+ link = oEditor.getElement(rng.startContainer, "A");
+ } else {
+ link = rng.parentElement ? oEditor.getElement(rng.parentElement(), "A") : oEditor.getElement(rng.item(0), "A");
+ }
+
+ if (link === null || link.nodeName.toLowerCase() !== 'a') {
+ return;
+ }
+
+ protocol = link.href.split(":");
+
+ if (protocol[0]) {
+ protocolSel = document.getElementById("fm_protocol");
+ for (i = 0; i < protocolSel.length; i++) {
+ if (protocolSel[i].value.indexOf(protocol[0].toLowerCase()) !== -1) {
+ oldTarget = link.target;
+ targetSel = document.getElementById("fm_target");
+
+ if (oldTarget) {
+ for (j = 0; j < targetSel.length; j++) {
+ if (targetSel[j].value === oldTarget.toLowerCase()) {
+ targetSel[j].selected = true;
+ break;
+ }
+ }
+ } else {
+ targetSel[0].selected = true;
+ }
+
+ protocolSel[i].selected = true;
+
+ if (link.title) {
+ document.getElementById("fm_title").value = link.title;
+ }
+ break;
+ }
+ }
+ }
+ document.getElementById("fm_link_value").value = link.href;
+}
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ resetValues();
+ getSelected();
+
+ var dlg = new Dialog(oEditor);
+ dlg.showButton(button);
+ dlg.setDialogHeight();
+}
diff --git a/plugin/editor/cheditor5/popup/js/media.js b/plugin/editor/cheditor5/popup/js/media.js
new file mode 100644
index 000000000..e808ee320
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/media.js
@@ -0,0 +1,46 @@
+// ================================================================
+// CHEditor 5
+// ----------------------------------------------------------------
+// Homepage: http://www.chcode.com
+// Copyright (c) 1997-2014 CHSOFT
+// ================================================================
+var button = [
+ { alt : "", img : 'play.gif', cmd : play },
+ { alt : "", img : 'submit.gif', cmd : doSubmit },
+ { alt : "", img : 'cancel.gif', cmd : popupClose }
+];
+
+var oEditor = null;
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ var dlg = new Dialog(oEditor);
+ dlg.showButton(button);
+
+ dlg.setDialogHeight();
+}
+
+function play()
+{
+ var file = document.getElementById("fm_linkurl");
+ if (!file.value)
+ return;
+
+ var mediaobj = "";
+ var obj = document.getElementById("play");
+ obj.innerHTML = mediaobj;
+}
+
+function doSubmit()
+{
+ var file = document.getElementById("fm_linkurl");
+ var media = "";
+ oEditor.insertHtmlPopup(media);
+ oEditor.popupWinClose();
+}
+
+function popupClose() {
+ oEditor.popupWinCancel();
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/js/swfobject.js b/plugin/editor/cheditor5/popup/js/swfobject.js
new file mode 100644
index 000000000..c8aa31ce3
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/swfobject.js
@@ -0,0 +1,779 @@
+/*! SWFObject v2.2
+ is released under the MIT License
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!/loaded|complete/.test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
+ if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '';
+ }
+ }
+ el.outerHTML = '';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr) { // show Adobe Express Install
+ if (confirm("Adobe Flash Player "+swfVersionStr+" 이상 버전이 필요합니다.\nCHEditor는 자동으로 Flash Player를 설치하지 않습니다.\n" +
+ "Adobe Flash Player 다운로드 웹사이트를 방문하시겠습니까?")) {
+ window.open(xiSwfUrlStr);
+ }
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
diff --git a/plugin/editor/cheditor5/popup/js/symbol.js b/plugin/editor/cheditor5/popup/js/symbol.js
new file mode 100644
index 000000000..e5e510819
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/symbol.js
@@ -0,0 +1,167 @@
+// ================================================================
+// CHEditor 5
+// ----------------------------------------------------------------
+// Homepage: http://www.chcode.com
+// Copyright (c) 1997-2014 CHSOFT
+// ================================================================
+var c = null;
+var curView = null;
+var S1 = '" ( ) [ ] { } ‘ ’ “ ” 〔 〕 〈 〉 《 》 「 」 『 』 【 】 § ※ ☆ ★ ○ ● ■ △ ▲ ▽ ▼ → 〓 ◁ ◀ ▷ ▶ ♤ ♣ ⊙ ◈ ▣ ◐ ◑ ▧ ▦ ▩ ♨ ☏ ☎ ‡ ㉿ ↕ ↗ ↙ ↖ ↘ ㈜ № ㏇ ™ ㏂ + - < = > ± × ÷ ≠ ≤ ≥ ∞ ∴ ♂ ♀ ∠ ⊥ ⌒ ∂ ∇ ≡ ≒ ≪ ≫ √ ∽ ∝ ∵ ∫ ∬ ∈ ∋ ⊆ ⊇ ⊂ ⊃ ∮ ∪ ∩ ∑ ∏ ∧ ∨ ¬ ⇒ ⇔ ∀ ∃';
+var S2 = '─ │ ┌ ┐ ┘ └ ├ ┬ ┤ ┴ ┼ ━ ┃ ┏ ┓ ┛ ┗ ┣ ┳ ┫ ┻ ╋ ┠ ┯ ┨ ┷ ┿ ┝ ┰ ┥ ┸ ╂ ┒ ┑ ┚ ┙ ┖ ┕ ┎ ┍ ┞ ┟ ┡ ┢ ┦ ┧ ┩ ┪ ┭ ┮ ┱ ┲ ┵ ┶ ┹ ┺ ┽ ┾ ╀ ╁ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊';
+var S3 = '½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ¹ ² ³ ⁴ ⁿ ₁ ₂ ₃ ₄ 0 1 2 3 4 5 6 7 8 9 ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ $ % ₩ ° ′ ″ ℃ Å ¢ £ ¥ ¤ ℉ ‰ ㎕ ㎖ ㎗ ℓ ㎘ ㏄ ㎣ ㎤ ㎥ ㎦ ㎙ ㎚ ㎛ ㎜ ㎝ ㎞ ㎟ ㎠ ㎡ ㎢ ㏊ ㎍ ㎎ ㎏ ㏏ ㎈ ㎉ ㏈ ㎧ ㎨ ㎰ ㎱ ㎲ ㎳ ㎴ ㎵ ㎶ ㎷ ㎸ ㎹ ㎀ ㎁ ㎂ ㎃ ㎄ ㎺ ㎻ ㎼ ㎽ ㎾ ㎿ ㎐ ㎑ ㎒ ㎓ ㎔ Ω ㏀ ㏁ ㎊ ㎋ ㎌ ㏖ ㏅ ㎭ ㎮ ㎯ ㏛ ㎩ ㎪ ㎫ ㎬ ㏝ ㏐ ㏓ ㏉ ㏜ ㏆';
+var S4 = 'ㅥ ㅦ ㅧ ㅨ ㅩ ㅪ ㅫ ㅬ ㅭ ㅮ ㅰ ㅯ ㅱ ㅲ ㅳ ㅴ ㅵ ㅶ ㅷ ㅸ ㅹ ㅺ ㅻ ㅼ ㅽ ㅾ ㅿ ㆀ ㆁ ㆂ ㆃ ㆄ ㆅ ㆆ ㆇ ㆈ ㆉ ㆊ ㆋ ㆌ ㆍ ㆎ';
+var S5 = '㉠ ㉡ ㉢ ㉣ ㉤ ㉥ ㉦ ㉧ ㉨ ㉩ ㉪ ㉫ ㉬ ㉭ ㉮ ㉯ ㉰ ㉱ ㉲ ㉳ ㉴ ㉶ ㉶ ㉷ ㉸ ㉹ ㉺ ㉻ ㈀ ㈁ ㈂ ㈃ ㈄ ㈅ ㈆ ㈇ ㈈ ㈉ ㈊ ㈋ ㈌ ㈍ ㈎ ㈏ ㈐ ㈑ ㈒ ㈓ ㈔ ㈕ ㈖ ㈗ ㈘ ㈙ ㈚ ㈛ ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⒜ ⒝ ⒞ ⒟ ⒠ ⒡ ⒢ ⒣ ⒤ ⒥ ⒦ ⒧ ⒨ ⒩ ⒪ ⒫ ⒬ ⒭ ⒮ ⒯ ⒰ ⒱ ⒲ ⒳ ⒴ ⒵ ⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾ ⑿ ⒀ ⒁ ⒂';
+var japan1 = 'ぁ か さ た ど び ぽ ょ ゑ あ が ざ だ な ぴ ま よ を ぃ き し ち に ふ み ら ん い ぎ じ ぢ ぬ ぶ む り ぅ く す っ ね ぷ め る う ぐ ず つ の へ も れ ぇ け せ づ は べ ゃ ろ え げ ぜ て ば ぺ や ゎ ぉ こ そ で ぱ ほ ゅ わ お ご ぞ と ひ ぼ ゆ ゐ';
+var japan2 = 'ァ カ サ タ ド ビ ポ ョ ヱ ア ガ ザ ダ ナ ピ マ ヨ ヲ ィ キ シ チ ニ フ ミ ラ ン イ ギ ジ ヂ ヌ ブ ム リ ヴ ゥ ク ス ッ ネ プ メ ル ヵ ウ グ ズ ツ ノ ヘ モ レ ヶ ェ ケ セ ヅ ハ ベ ャ ロ エ ゲ ゼ テ バ ペ ヤ ヮ ォ コ ソ デ パ ホ ュ ワ オ ゴ ゾ ト ヒ ボ ユ ヰ';
+
+c = S1.split(' ');
+var button = [ { alt : "", img : 'input.gif', cmd : inputChar },
+ { alt : "", img : 'cancel.gif', cmd : popupClose } ];
+
+var oEditor = null;
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ var dlg = new Dialog(oEditor);
+ dlg.showButton(button);
+
+ setupEvent();
+ dlg.setDialogHeight();
+}
+
+function hover(obj, val) {
+ obj.style.backgroundColor = val ? "#5579aa" : "#fff";
+ obj.style.color = val ? "#fff" : "#000";
+}
+
+function showTable() {
+ var k = 0;
+ var len = c.length;
+ var w = 9;
+ var h = 20;
+ var span, i, j, tr, td;
+
+ var table = document.createElement('table');
+ table.border = 0;
+ table.cellSpacing = 1;
+ table.cellPadding = 0;
+ table.align = 'center';
+
+ var getChar = function() {
+ document.getElementById('fm_input').value = document.getElementById('fm_input').value + c[this.id];
+ };
+ var mouseOver = function() {
+ hover(this, true);
+ };
+ var mouseOut = function() {
+ hover(this, false);
+ };
+ for (i=0; i < w; i++) {
+ tr = table.insertRow(i);
+ for (j = 0; j < h; j++) {
+ td = tr.insertCell(j);
+ td.className = 'schar';
+
+ if ( len < k+1) {
+ td.appendChild(document.createTextNode('\u00a0'));
+ }
+ else {
+ td.style.cursor = 'pointer';
+ td.id = k;
+ td.onclick = getChar;
+ td.onmouseover = mouseOver;
+ td.onmouseout = mouseOut;
+ span = document.createElement("span");
+ span.style.fontSize = "13px";
+ span.appendChild(document.createTextNode(c[k]));
+ td.appendChild(span);
+ }
+ k++;
+ }
+ }
+
+ var output = document.getElementById('output');
+ if (output.hasChildNodes()) {
+ for (i=0; i 0) {
+ cell = createHeadCell('col');
+ }
+ else {
+ cell = document.createElement('td');
+ }
+ }
+ else if (header === 'row' && j === 0) {
+ cell = createHeadCell('row');
+ }
+ else {
+ cell = document.createElement('td');
+ }
+
+ if (border) {
+ cell.style.borderStyle = 'solid';
+ cell.style.borderWidth = table.style.borderWidth;
+ cell.style.borderColor = table.style.borderColor;
+ }
+// cell.setAttribute("width", cellWidth);
+ cell.appendChild(document.createTextNode('\u00a0'));
+ row.appendChild(cell);
+ }
+ }
+
+ if (oHead.hasChildNodes()) {
+ table.appendChild(oHead);
+ }
+
+ table.appendChild(oBody);
+
+ if (summaryValue !== '') {
+ table.setAttribute('summary', summaryValue);
+ }
+ if (width) {
+ table.style.width = width;
+ }
+ if (height) {
+ table.style.height = height;
+ }
+ if (align) {
+ table.setAttribute("align", align);
+ }
+ if (bgcolor) {
+ table.setAttribute("bgcolor", bgcolor);
+ }
+
+ table.setAttribute("cellpadding", cellpd);
+ table.setAttribute("cellspacing", cellsp);
+
+ if (captionValue !== '') {
+ var hideCaption, tableCaption;
+ tableCaption = table.createCaption();
+ tableCaption.appendChild(document.createTextNode(captionValue));
+
+ hideCaption = document.getElementById('hideCaption');
+ if (hideCaption.checked === true) {
+ tableCaption.style.visibility = 'hidden';
+ tableCaption.style.overFlow = 'hidden';
+ tableCaption.style.lineHeight = '0px';
+ tableCaption.style.position = 'absolute';
+ tableCaption.style.display = 'none';
+ }
+ }
+
+ table.id = oEditor.makeRandomString();
+ oEditor.insertHtmlPopup(table.cloneNode(true));
+ var newTable = oEditor.$(table.id);
+ newTable.removeAttribute('id');
+
+ if (cssclass) {
+ newTable.className = cssclass;
+ }
+ if (cssid) {
+ newTable.id = cssid;
+ }
+
+ var focusCell = newTable.getElementsByTagName('th')[0];
+ if (oEditor.undefined(focusCell)) {
+ focusCell = newTable.getElementsByTagName('td')[0];
+ }
+
+ if (oEditor.getBrowser().msie) {
+ var cursor = oEditor.doc.body.createTextRange();
+ cursor.moveToElementText(focusCell);
+ cursor.collapse(false);
+ cursor.select();
+ oEditor.backupRange(oEditor.getRange());
+ }
+ else {
+ var selection = oEditor.getSelection();
+ var range = oEditor.getRange();
+ range.selectNodeContents(focusCell);
+ range.collapse(false);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
+
+ oEditor.popupWinClose();
+}
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit },
+ { alt : "", img : 'cancel.gif', cmd : popupClose } ];
+
+ var dlg = new Dialog(oEditor);
+ dlg.showButton(button);
+ dlg.setDialogHeight();
+}
diff --git a/plugin/editor/cheditor5/popup/js/table_modify.js b/plugin/editor/cheditor5/popup/js/table_modify.js
new file mode 100644
index 000000000..30ff2c575
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/js/table_modify.js
@@ -0,0 +1,640 @@
+// ================================================================
+// CHEditor 5
+// ----------------------------------------------------------------
+// Homepage: http://www.chcode.com
+// Copyright (c) 1997-2014 CHSOFT
+// ================================================================
+var oEditor = null;
+var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit },
+ { alt : "", img : 'cancel.gif', cmd : popupClose } ];
+
+var colour = ["ffffcc","ffcc66","ff9900","ffcc99","ff6633","ffcccc","cc9999","ff6699","ff99cc","ff66cc","ffccff","cc99cc","cc66ff","cc99ff","9966cc","ccccff","9999cc","3333ff","6699ff","0066ff","99ccff","66ccff","99cccc","ccffff","99ffcc","66cc99","66ff99","99ff99","ccffcc","33ff33","66ff00","ccff99","99ff00","ccff66","cccc66","ffffff",
+ "ffff99","ffcc00","ff9933","ff9966","cc3300","ff9999","cc6666","ff3366","ff3399","ff00cc","ff99ff","cc66cc","cc33ff","9933cc","9966ff","9999ff","6666ff","3300ff","3366ff","0066cc","3399ff","33ccff","66cccc","99ffff","66ffcc","33cc99","33ff99","66ff66","99cc99","00ff33","66ff33","99ff66","99ff33","ccff00","cccc33","cccccc",
+ "ffff66","ffcc33","cc9966","ff6600","ff3300","ff6666","cc3333","ff0066","ff0099","ff33cc","ff66ff","cc00cc","cc00ff","9933ff","6600cc","6633ff","6666cc","3300cc","0000ff","3366cc","0099ff","00ccff","339999","66ffff","33ffcc","00cc99","00ff99","33ff66","66cc66","00ff00","33ff00","66cc00","99cc66","ccff33","999966","999999",
+ "ffff33","cc9900","cc6600","cc6633","ff0000","ff3333","993333","cc3366","cc0066","cc6699","ff33ff","cc33cc","9900cc","9900ff","6633cc","6600ff","666699","3333cc","0000cc","0033ff","6699cc","3399cc","669999","33ffff","00ffcc","339966","33cc66","00ff66","669966","00cc00","33cc00","66cc33","99cc00","cccc99","999933","666666",
+ "ffff00","cc9933","996633","993300","cc0000","ff0033","990033","996666","993366","cc0099","ff00ff","990099","996699","660099","663399","330099","333399","000099","0033cc","003399","336699","0099cc","006666","00ffff","33cccc","009966","00cc66","339933","336633","33cc33","339900","669933","99cc33","666633","999900","333333",
+ "cccc00","996600","663300","660000","990000","cc0033","330000","663333","660033","990066","cc3399","993399","660066","663366","330033","330066","333366","000066","000033","003366","006699","003333","336666","00cccc","009999","006633","009933","006600","003300","00cc33","009900","336600","669900","333300","666600","000000"];
+
+var none = '없음';
+var modifyTable;
+var beforeHeaderType;
+var whichColor = null;
+
+function popupClose() {
+ oEditor.popupWinCancel();
+}
+
+function isError() {
+ alert('표 정보를 얻을 수 없습니다. 수정하실 표을 다시 한 번 선택해 주십시오.');
+ popupClose();
+}
+
+function init(dialog) {
+ oEditor = this;
+ oEditor.dialog = dialog;
+
+ var dlg = new Dialog(oEditor);
+ dlg.showButton(button);
+ dlg.setDialogHeight();
+
+ var rng = oEditor.range, pNode;
+
+ if (oEditor.W3CRange) {
+ pNode = rng.commonAncestorContainer;
+ if (!rng.collapsed &&
+ rng.startContainer === rng.endContainer &&
+ rng.startOffset - rng.endOffset < 2 &&
+ rng.startContainer.hasChildNodes())
+ {
+ pNode = rng.startContainer.childNodes[rng.startOffset];
+ }
+
+ while (pNode.nodeType === 3) {
+ pNode = pNode.parentNode;
+ }
+
+ if (pNode.nodeName !== 'TD' && pNode.nodeName !== 'TH' && pNode.nodeName !== 'CAPTION' && pNode.nodeName !== 'TABLE')
+ {
+ isError();
+ return;
+ }
+ }
+ else {
+ if (rng.item) {
+ pNode = rng.item(0);
+ if (pNode.nodeName.toLowerCase() !== 'table') {
+ isError();
+ return;
+ }
+ }
+ else {
+ pNode = rng.parentElement();
+ }
+ }
+
+ while (pNode && pNode.nodeName.toLowerCase() !== 'table') {
+ pNode = pNode.parentNode;
+ }
+
+ if (pNode.nodeName.toLowerCase() !== 'table') {
+ isError();
+ return;
+ }
+
+ modifyTable = pNode;
+ var border, el_size, fm_size, el_type, fm_type, cellpd, cellsp, bgcolor, idbgcolor,
+ bordercolor, idbordercolor, captionValue, summaryValue, caption, captionInput, summary;
+
+ border = modifyTable.getAttribute('border');
+ if (!border || isNaN(border)) {
+ border = parseInt(modifyTable.style.borderWidth, 10);
+ if (!border) {
+ border = 0;
+ }
+ }
+ document.getElementById("bordersize").value = border;
+
+ if (modifyTable.className !== '') {
+ document.getElementById('cssClass').value = modifyTable.className;
+ }
+ if (modifyTable.id !== '') {
+ document.getElementById('cssId').value = modifyTable.id;
+ }
+
+ el_size = modifyTable.getAttribute('width');
+ if (!el_size) {
+ el_size = modifyTable.style.width;
+ }
+
+ fm_size = document.getElementById("width");
+ el_type = 'px';
+ fm_type = document.getElementById("widthtype");
+
+ if (el_size) {
+ el_type = (/%$/.test(el_size)) ? '%' : 'px';
+ el_size = parseInt(el_size, 10);
+ if (isNaN(el_size)) {
+ el_size = '';
+ }
+ }
+ else {
+ el_size = '';
+ }
+
+ fm_size.value = el_size;
+ fm_type.value = el_type;
+
+ el_size = modifyTable.getAttribute('height');
+ if (!el_size) {
+ el_size = modifyTable.style.height;
+ }
+ fm_size = document.getElementById("height");
+ el_type = 'px';
+ fm_type = document.getElementById("heighttype");
+
+ if (el_size) {
+ el_type = (/\%$/.test(el_size)) ? '%' : 'px';
+ el_size = parseInt(el_size, 10);
+ if (isNaN(el_size)) {
+ el_size = '';
+ }
+ }
+ else {
+ el_size = '';
+ }
+
+ fm_size.value = el_size;
+ fm_type.value = el_type;
+
+ fm_type = modifyTable.getAttribute('align');
+ if (!fm_type) {
+ fm_type = 'none';
+ }
+ document.getElementById("talign").value = fm_type;
+
+ cellpd = modifyTable.getAttribute('cellpadding');
+ if (isNaN(cellpd)) {
+ cellpd = 0;
+ }
+ document.getElementById("cellpd").value = cellpd || 0;
+
+ cellsp = modifyTable.getAttribute('cellspacing');
+ if (isNaN(cellsp)) {
+ cellsp = 0;
+ }
+ document.getElementById("cellsp").value = cellsp || 0;
+
+ bgcolor = modifyTable.getAttribute('bgcolor');
+ idbgcolor = document.getElementById("idbgcolor");
+ if (bgcolor) {
+ if (/rgb/.test(bgcolor)) {
+ bgcolor = oEditor.colorConvert(bgcolor, 'hex');
+ }
+ idbgcolor.value = bgcolor.toLowerCase();
+ idbgcolor.style.backgroundColor = idbgcolor.value;
+ }
+ else {
+ idbgcolor.value = none;
+ }
+
+ bordercolor = modifyTable.getAttribute('bordercolor');
+ if (!bordercolor) {
+ bordercolor = modifyTable.style.borderColor;
+ if (bordercolor) {
+ bordercolor = oEditor.colorConvert(bordercolor, 'hex');
+ }
+ else {
+ bordercolor = null;
+ }
+ }
+
+ idbordercolor = document.getElementById("idbordercolor");
+ if (bordercolor) {
+ if (/rgb/.test(bordercolor)) {
+ bordercolor = oEditor.colorConvert(bordercolor, 'hex');
+ }
+ idbordercolor.value = bordercolor.toLowerCase();
+ idbordercolor.style.backgroundColor = idbordercolor.value;
+ }
+ else {
+ idbordercolor.value = none;
+ }
+
+ caption = modifyTable.getElementsByTagName('caption')[0];
+ if (caption) {
+ captionValue = oEditor.trimSpace(caption.innerHTML);
+ if (captionValue !== '') {
+ captionInput = document.getElementById('tableCaption');
+ captionInput.value = captionValue;
+
+ if (caption.style.visibility === 'hidden') {
+ document.getElementById('hideCaption').checked = 'checked';
+ }
+ }
+ }
+
+ summaryValue = modifyTable.getAttribute('summary');
+ if (summaryValue) {
+ summaryValue = oEditor.trimSpace(summaryValue);
+ if (summaryValue !== '') {
+ summary = document.getElementById('tableSummary');
+ summary.value = summaryValue;
+ }
+ }
+
+ var tableHeader, rows, i, j, cells, headCol, headRow, rowLength, rowCellLength, cellLength, header, headTagName;
+ headCol = headRow = null;
+ headTagName = 'th';
+
+ tableHeader = document.getElementById('tableHeader');
+ rows = (modifyTable.rows && modifyTable.rows.length > 0) ? modifyTable.rows : modifyTable.getElementsByTagName('tr');
+ rowLength = rows.length;
+
+ document.getElementById('numrows').appendChild(document.createTextNode(rowLength));
+
+ if (rowLength > 0) {
+ cells = rows[0].cells;
+ cellLength = cells.length;
+ if (cellLength > 0) {
+ for (j=0; j < cellLength; j++) {
+ if (cells[j].tagName.toLowerCase() === headTagName) {
+ headCol = 'col';
+ }
+ else {
+ headCol = null;
+ break;
+ }
+ }
+ }
+
+ rowCellLength = 0;
+ for (i=0; i < rowLength; i++) {
+ headRow = (rows[i].cells[0] && rows[i].cells[0].tagName.toLowerCase() === headTagName) ? 'row' : null;
+ if (rowCellLength < rows[i].cells.length) {
+ rowCellLength = rows[i].cells.length;
+ }
+ }
+
+ if (headRow && headCol && cellLength === 1) {
+ headCol = null;
+ }
+ document.getElementById('numcols').appendChild(document.createTextNode(rowCellLength));
+ }
+
+ header = (headCol && headRow) ? 'all' : headCol || headRow || 'none';
+ tableHeader.value = beforeHeaderType = header;
+}
+
+function getColor()
+{
+ var color = this.bgColor;
+ var input = document.getElementById("id"+whichColor);
+ input.style.backgroundColor = input.value = color;
+}
+
+function drawColor() {
+ var table, tr, td, insideTable, k = 0, i, j, tr2, td2;
+
+ table = document.createElement('table');
+ table.cellPadding = 0;
+ table.cellSpacing = 0;
+ table.border = 0;
+ table.align = 'center';
+ tr = table.insertRow(0);
+ td = tr.insertCell(0);
+ td.style.backgroundColor = '#fff';
+
+ insideTable = document.createElement('table');
+ insideTable.border = 0;
+ insideTable.cellSpacing = 1;
+ insideTable.cellPadding = 0;
+ insideTable.align = 'center';
+
+ var onMouseOver = function() { this.className = 'colorCellMouseOver'; };
+ var onMouseOut = function() { this.className = 'colorCellMouseOut'; };
+
+ for (i = 0; i < 6; i++) {
+ tr2 = insideTable.insertRow(i);
+ for (j = 0; j < 36; j++) {
+ td2 = tr2.insertCell(j);
+ td2.setAttribute('bgColor', '#' + colour[k]);
+ td2.className = 'colorCellMouseOut';
+ td2.onclick = getColor;
+ td2.appendChild(document.createTextNode('\u00a0'));
+ td2.onmouseover = onMouseOver;
+ td2.onmouseout = onMouseOut;
+ k++;
+ }
+ }
+
+ td.appendChild(insideTable);
+ document.getElementById('colorWrapper').appendChild(table);
+}
+
+function setColor(which) {
+ whichColor = which;
+}
+
+function doSubmit()
+{
+ var width, widthType, widthValue, cellWidth, i, j, row, rows, cell;
+ width = document.getElementById("width");
+ widthType = document.getElementById("widthtype").value;
+ if (width) {
+ widthValue = parseInt(oEditor.trimSpace(width.value), 10);
+ if (isNaN(widthValue)) {
+ cellWidth = widthValue = null;
+ }
+ else {
+ modifyTable.removeAttribute('width');
+ modifyTable.style.width = widthValue + widthType;
+ rows = modifyTable.rows;
+ if (rows.length > 0) {
+ for (i=0; i < rows.length; i++) {
+ row = rows[i];
+ for (j=0; j < row.cells.length; j++) {
+ cellWidth = parseInt(widthValue/row.cells.length, 10) + widthType;
+ cell = row.cells[j];
+ cell.setAttribute("width", cellWidth);
+ }
+ }
+ }
+ }
+ }
+
+ var height, heightValue;
+ height = document.getElementById("height");
+ if (height) {
+ heightValue = parseInt(oEditor.trimSpace(height.value), 10);
+ if (isNaN(heightValue)) {
+ heightValue = null;
+ }
+ else {
+ heightValue += document.getElementById("heighttype").value;
+ modifyTable.removeAttribute('height');
+ modifyTable.style.height = heightValue;
+ }
+ }
+
+ var cellpadding, cellpaddingValue;
+ cellpadding = document.getElementById("cellpd");
+ if (cellpadding) {
+ cellpaddingValue = oEditor.trimSpace(cellpadding.value);
+ if (!cellpaddingValue || isNaN(cellpaddingValue)) {
+ cellpaddingValue = 0;
+ }
+ else {
+ cellpaddingValue = parseInt(cellpaddingValue, 10);
+ }
+ modifyTable.setAttribute('cellpadding', cellpaddingValue);
+ }
+
+ var cellspacing, cellspacingValue;
+ cellspacing = document.getElementById("cellsp");
+ if (cellspacing) {
+ cellspacingValue = oEditor.trimSpace(cellspacing.value);
+ if (!cellspacingValue || isNaN(cellspacingValue)) {
+ cellspacingValue = 0;
+ }
+ else {
+ cellspacingValue = parseInt(cellspacingValue, 10);
+ }
+ modifyTable.setAttribute('cellspacing', cellspacingValue);
+ }
+
+ var bgcolor, bgcolorValue;
+ bgcolor = document.getElementById("idbgcolor");
+ if (bgcolor) {
+ bgcolorValue = oEditor.trimSpace(bgcolor.value);
+ if (bgcolorValue !== '' && bgcolorValue !== none) {
+ modifyTable.removeAttribute('bgcolor');
+ modifyTable.bgColor = bgcolorValue;
+ }
+ }
+
+ var align, alignValue;
+ align = document.getElementById("talign");
+ if (align) {
+ alignValue = align.value;
+ if (alignValue !== 'none') {
+ modifyTable.removeAttribute('align');
+ modifyTable.setAttribute('align', alignValue);
+ }
+ }
+
+ var cssclass, cssclassValue, cssid, cssidValue;
+ cssclass = document.getElementById('cssClass');
+ cssclassValue = oEditor.trimSpace(cssclass.value);
+ if (cssclassValue !== '') {
+ modifyTable.className = cssclassValue;
+ }
+ else {
+ modifyTable.removeAttribute('class');
+ }
+
+ cssid = document.getElementById('cssId');
+ cssidValue = oEditor.trimSpace(cssid.value);
+ if (cssidValue !== '') {
+ modifyTable.id = cssidValue;
+ }
+ else {
+ modifyTable.removeAttribute('id');
+ }
+
+ var caption = document.getElementById('tableCaption');
+ var captionValue = oEditor.trimSpace(caption.value);
+ var summary = document.getElementById('tableSummary');
+ var summaryValue = oEditor.trimSpace(summary.value);
+ var oCaption;
+
+ if (summaryValue !== '') {
+ modifyTable.setAttribute('summary', summaryValue);
+ }
+ if (captionValue !== '') {
+ var hideCaption, tableCaption;
+ tableCaption = modifyTable.createCaption();
+ tableCaption.innerHTML = captionValue;
+
+ hideCaption = document.getElementById('hideCaption');
+ if (hideCaption.checked === true) {
+ tableCaption.style.visibility = 'hidden';
+ tableCaption.style.overFlow = 'hidden';
+ tableCaption.style.lineHeight = '0px';
+ tableCaption.style.position = 'absolute';
+ tableCaption.style.display = 'none';
+ }
+ else {
+ tableCaption.removeAttribute('style');
+ }
+ }
+ else {
+ oCaption = modifyTable.getElementsByTagName('caption')[0];
+ if (oCaption) {
+ modifyTable.removeChild(oCaption);
+ }
+ }
+
+ var copyAttribute = function(target, source) {
+ var attr, attrValue, nodeName;
+ attr = source.attributes;
+ for (i=0; i= 0; j--) {
+ row.deleteCell(j);
+ }
+
+ for (j=0; j < newCells.length; j++) {
+ row.appendChild(newCells[j]);
+ }
+
+ if (newTagName === 'th') {
+ oHead = modifyTable.getElementsByTagName('thead')[0];
+ if (!oHead) {
+ oHead = document.createElement('thead');
+ modifyTable.insertBefore(oHead, modifyTable.firstChild);
+ oHead.appendChild(row);
+ }
+ }
+ else if (row.parentNode.nodeName.toLowerCase() === 'thead') {
+ oHead = row.parentNode;
+ if (rows[1]) {
+ rows[1].parentNode.insertBefore(row, rows[1]);
+ }
+ else {
+ modifyTable.insertBefore(row, oHead);
+ }
+ modifyTable.removeChild(oHead);
+ }
+ };
+
+ var replaceRow = function (rows, newTagName) {
+ var len, newCell, sourceCell;
+ len = rows.length;
+ for (i=0; i < len; i++) {
+ row = rows[i];
+ sourceCell = row.cells[0];
+ newCell = document.createElement(newTagName);
+
+ if (newTagName === 'th') {
+ newCell.setAttribute('scope', 'row');
+ }
+ else {
+ sourceCell.removeAttribute('scope');
+ }
+
+ row.insertBefore(newCell, sourceCell);
+ copyAttribute(newCell, sourceCell);
+ copyChildNodes(newCell, sourceCell);
+ row.deleteCell(1);
+ }
+ };
+
+ var border, borderValue;
+ if (beforeHeaderType !== tableHeader) {
+ rows = (modifyTable.rows && modifyTable.rows.length > 0) ?
+ modifyTable.rows :
+ modifyTable.getElementsByTagName('tr');
+
+ if (tableHeader === 'col') {
+ replaceRow(rows, 'td');
+ replaceCol(rows, 'th');
+ }
+ else if (tableHeader === 'row') {
+ replaceCol(rows, 'td');
+ replaceRow(rows, 'th');
+ }
+ else if (tableHeader === 'all') {
+ replaceCol(rows, 'th');
+ replaceRow(rows, 'th');
+ }
+ else if (tableHeader === 'none') {
+ replaceCol(rows, 'td');
+ replaceRow(rows, 'td');
+ }
+
+ oCaption = modifyTable.getElementsByTagName('caption')[0];
+ if (oCaption && oCaption !== modifyTable.firstChild) {
+ modifyTable.insertBefore(oCaption, modifyTable.firstChild);
+ }
+ }
+
+
+ border = document.getElementById("bordersize");
+ if (border) {
+ borderValue = oEditor.trimSpace(border.value);
+ if (isNaN(borderValue) === false) {
+ var borderColor, borderColorValue;
+ borderValue = parseInt(borderValue, 10);
+ rows = (modifyTable.rows && modifyTable.rows.length > 0) ?
+ modifyTable.rows :
+ modifyTable.getElementsByTagName('tr');
+
+ if (borderValue) {
+ borderColor = document.getElementById("idbordercolor");
+ if (borderColor) {
+ borderColorValue = oEditor.trimSpace(borderColor.value);
+ }
+ if (!borderColorValue || borderColorValue === none) {
+ borderColorValue = '#000000';
+ }
+
+ borderColorValue = oEditor.colorConvert(borderColorValue, 'rgb');
+
+ modifyTable.style.border = borderValue + 'px solid ' + borderColorValue;
+ modifyTable.style.borderCollapse = "collapse";
+ modifyTable.removeAttribute('border');
+
+ for (i=0; i < rows.length; i++) {
+ row = rows[i];
+ for (j=0; j < row.cells.length; j++) {
+ cell = row.cells[j];
+ cell.style.border = borderValue + 'px solid ' + borderColorValue;
+ }
+ }
+ }
+ else if (borderValue === 0) {
+ modifyTable.removeAttribute('border');
+ modifyTable.style.border = '';
+ modifyTable.style.borderCollapse = '';
+ for (i=0; i < rows.length; i++) {
+ row = rows[i];
+ for (j=0; j < row.cells.length; j++) {
+ cell = row.cells[j];
+ cell.style.border = '';
+ }
+ }
+ }
+ }
+ }
+
+ oEditor.editArea.focus();
+ oEditor.backupRange(oEditor.restoreRange());
+ oEditor.clearStoredSelections();
+ oEditor.popupWinClose();
+}
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/link.html b/plugin/editor/cheditor5/popup/link.html
new file mode 100644
index 000000000..62b45d6b0
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/link.html
@@ -0,0 +1,70 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugin/editor/cheditor5/popup/media.html b/plugin/editor/cheditor5/popup/media.html
new file mode 100644
index 000000000..a2addd74b
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/media.html
@@ -0,0 +1,40 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugin/editor/cheditor5/popup/symbol.html b/plugin/editor/cheditor5/popup/symbol.html
new file mode 100644
index 000000000..039564fe9
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/symbol.html
@@ -0,0 +1,26 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+ 선택한 문자:
+
+
+
+
diff --git a/plugin/editor/cheditor5/popup/table.html b/plugin/editor/cheditor5/popup/table.html
new file mode 100644
index 000000000..a35b2584a
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/table.html
@@ -0,0 +1,178 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/popup/table_modify.html b/plugin/editor/cheditor5/popup/table_modify.html
new file mode 100644
index 000000000..4a84260f2
--- /dev/null
+++ b/plugin/editor/cheditor5/popup/table_modify.html
@@ -0,0 +1,180 @@
+
+
+
+ CHEditor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/template.xml b/plugin/editor/cheditor5/template.xml
new file mode 100644
index 000000000..8aef7b6f0
--- /dev/null
+++ b/plugin/editor/cheditor5/template.xml
@@ -0,0 +1,368 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <html>
+
+
+
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/editor/cheditor5/utils/crossdomain.xml b/plugin/editor/cheditor5/utils/crossdomain.xml
new file mode 100644
index 000000000..786354ea5
--- /dev/null
+++ b/plugin/editor/cheditor5/utils/crossdomain.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+