',
'value': ''
};
this.build = function (options) {
Object.extend(this.NN, NN);
Object.extend(this.Config, NN.Config);
this.NN.DOM.oSelf = this;
this.Config.value = NN.Utils.stripslashes(this.getOpt('value'));
try {
if (this.getOpt('addToolbarBtn') != null) {
var arrTmp = this.getOpt('addToolbarBtn');
for (funcName in arrTmp) {
if (typeof arrTmp[funcName]['position'] == 'undefined') continue;
var arrTmp2 = arrTmp[funcName]['position'].split(',');
if (this.Config.toolbar[arrTmp2[0]]) this.Config.toolbar[arrTmp2[0]].splice(arrTmp2[1], 0, funcName);
if (this.Config.toolbarSimple[arrTmp2[0]]) {
this.Config.toolbarSimple[arrTmp2[0]].splice(arrTmp2[1], 0, funcName);
}
}
}
}
catch (e) {
if (typeof console != 'undefined') console.warn(e);
return;
}
this.oEvent = new NNEvent();
this.oEvent.add(document, 'mousedown', function (event) {
this.e = event;
}.bind2(this));
this.oEvent.add(window, 'unload', function () {
this.oEvent.destroy();
this.oEvent.destroy('static');
this.oEvent.purge.destroy();
}.bind2(this));
Object.extend(this.Config.id, {
'container': this.Config.instanceID + '_CONTAINER',
'toolbar': this.Config.instanceID + '_TOOLBAR',
'iframe': this.Config.instanceID + '_IFRAME',
'textarea': this.Config.instanceID + '_TEXTAREA'
});
this.layout.build();
installHyperscript(this.NN, this.getIFDoc());
this.oSelection = new NNEditorRange(this, this.getIFW());
};
this.layout = {
'oSelf': this,
'c': function (func) {
var oBtn = document.createElement('button');
var id = this.oSelf.Config.instanceID + '_BUTTON_' + func;
this.oSelf.arrayBT.push(id);
oBtn.setAttribute('id', id);
oBtn.setAttribute('type', 'button');
oBtn.setAttribute('title', NNEditor_Lang[func] || '');
try {
return oBtn;
}
finally {
oBtn = null;
}
},
'build': function () {
var
self = this,
ed = this.oSelf,
idCon = ed.getID('container');
var layout = '\
\
\
\
\
\
\
\
\
\
\
\
\
';
if (NN.Utils.g(this.oSelf.Config.instanceID + '_layout')) {
NN.Utils.g(this.oSelf.Config.instanceID + '_layout').innerHTML = layout;
}
else {
document.write(layout);
}
var oContainer = this.oSelf.getCon();
ed.oEvent.add(NN.Utils.g(this.oSelf.Config.instanceID + '_TOOLBAR'), 'click', function (e, objExtend) {
var objEvent = e.srcElement || e.target;
if (!objEvent.getAttribute('rel')) return;
self.makeContent();
if (typeof objExtend[objEvent.getAttribute('argv1') ] == 'object') {
if (typeof objExtend[objEvent.getAttribute('argv1') ]['method'] == 'function') {
this.exec[objEvent.getAttribute('argv1')] = objExtend[objEvent.getAttribute('argv1')]['method'].bind2(this, e, (objExtend[objEvent.getAttribute('argv1')]['param'] || ''));
}
else if (typeof objExtend[objEvent.getAttribute('argv1') ]['method'] == 'string') {
if (objExtend[objEvent.getAttribute('argv1') ]['method'] == 'defined') {}
else {
if (typeof console != "undefined") console.warn('error plugin: not defined function');
return;
} // method�꾨뱶�⑥닔媛� �뺤쓽�섏뼱 �덉� �딄퀬, �먮뵒�곗냼�ㅼ뿉�� �뺤쓽�섏� �딆븯�� ��
}
}
switch (objEvent.getAttribute('rel')) {
case 'default':
try {
eval('this.exec.' + objEvent.getAttribute('argv1') + '(e)');
}
catch (e) {
if (typeof console != 'undefined') {
console.warn('undefined toolbar function', e);
}
}
break;
case 'basic':
this.exec.basic(objEvent.getAttribute('argv1'), null);
switch (objEvent.getAttribute('argv1')) {
case 'bold':
case 'underline':
case 'cut':
case 'copy':
case 'paste':
case 'italic':
case 'strikethrough':
case 'superscript':
case 'subscript':
case 'removeformat':
case 'justifyleft':
case 'justifycenter':
case 'justifyright':
case 'justifyfull':
case 'insertorderedlist':
case 'insertunorderedlist':
case 'inserthorizontalrule':
this.Events.toolbarOver(e);
break;
}
NN.Utils.prevent(e);
break;
case 'viewSrc':
this.view.source();
NN.Utils.prevent(e);
break;
case 'fonttypePanel':
this.exec.fonttype(e);
NN.Utils.prevent(e);
break;
case 'fontsizePanel':
this.exec.fontsize(e);
NN.Utils.prevent(e);
break;
case 'fontcolorPanel':
this.exec.fontcolor(e);
NN.Utils.prevent(e);
break;
case 'fontbgcolorPanel':
this.exec.fontbgcolor(e);
NN.Utils.prevent(e);
break;
case 'evtPickColorDirect':
this.exec.evtPickColorDirect();
break;
case 'evtBgColorDirect':
this.exec.evtBgColorDirect();
break;
case 'full':
this.view.full();
break;
case 'html':
this.view.html();
break;
case 'table':
this.table.popup(e);
break;
case 'undo':
this.save.undo();
break;
case 'redo':
this.save.redo();
break;
case 'docunew':
this.save.docuNew();
break;
}
}.bind2Event(ed, ed.getOpt('addToolbarBtn')));
ed.Events.ctrlToobar = function (target, evtName, mode) {
if (typeof evtName == 'undefined') return;
var obj = typeof target == 'object' ? target : NN.Utils.g(target);
if (obj == null) return;
mode = mode || 'enable';
switch (mode) {
case 'enable':
if (NN.Browser.MSIE) obj.style.filter = 'alpha(opacity=100)';
else obj.style.opacity = 1;
this.oEvent.add(obj, 'click', evtName);
break;
case 'disable':
if (NN.Browser.MSIE) obj.style.filter = 'alpha(opacity=20)';
else obj.style.opacity = 0.3;
removeEvent(obj, 'click', evtName, true);
break;
}
}.bind2(ed);
ed.Events.toolbarOver = function (e) {
var oTarget = e.target || e.srcElement;
switch (e.type) {
case 'click':
if (oTarget.className.match('actived') != null) {
oTarget.className = oTarget.className.replace(new RegExp("actived"), "");
}
else {
oTarget.className += ' actived';
}
break;
case 'mouseover':
oTarget.className += ' hover';
break;
case 'mouseout':
oTarget.className = oTarget.className.replace(new RegExp("hover"), "");
break;
}
NN.Utils.prevent(e);
};
ed.Events.toolbarOverCTRL = function (e) {
var objEvent = e.srcElement || e.target;
if (objEvent.getAttribute('rel2') != 'm') return;
switch (e.type) {
case 'mouseover':
this.Events.toolbarOver(e);
break;
case 'mouseout':
this.Events.toolbarOver(e);
break;
}
}.bind2Event(ed);
ed.oEvent.add(NN.Utils.g(ed.Config.instanceID + '_TOOLBAR'), 'mouseover', ed.Events.toolbarOverCTRL);
ed.oEvent.add(NN.Utils.g(ed.Config.instanceID + '_TOOLBAR'), 'mouseout', ed.Events.toolbarOverCTRL);
ed.Events.tableGroupBT = ['tableModify', 'insertrow_before', 'insertrow_after', 'deleterow', 'insertcell_before', 'insertcell_after', 'deletecell', 'cellProp', 'rowProp', 'merge', 'mergeRecover'];
ed.Events.tableModify = function (evt) {
if (this.table.getInfo() == true) {
this.table.popupModify(evt);
}
}.bind2Event(this.oSelf);
ed.Events.insertrow_before = function () {
if (this.table.getInfo() == true) {
this.table.insertRow('before');
}
}.bind2Event(this.oSelf);
ed.Events.insertrow_after = function () {
if (this.table.getInfo() == true) {
this.table.insertRow('after');
}
}.bind2(this.oSelf);
ed.Events.deleterow = function () {
if (this.table.getInfo() == true) {
this.table.deleteRow();
}
}.bind2(this.oSelf);
ed.Events.insertcell_before = function () {
if (oThis.table.getInfo() == true) {
oThis.table.insertCell('before');
}
}.bind2(this.oSelf);
ed.Events.insertcell_after = function () {
if (this.table.getInfo() == true) {
this.table.insertCell('after');
}
}.bind2(this.oSelf);
ed.Events.deletecell = function () {
if (this.table.getInfo() == true) {
this.table.deleteCol();
}
}.bind2(this.oSelf);
ed.Events.cellProp = function (evt) {
if (this.table.getInfo() == true) {
this.table.cellProp(evt);
}
}.bind2Event(this.oSelf);
ed.Events.rowProp = function (evt) {
if (this.table.getInfo() == true) {
this.table.rowProp(evt);
}
}.bind2Event(this.oSelf);
ed.Events.merge = function (evt) {
if (this.table.getInfo() == true) {
this.table.merge(evt);
}
}.bind2Event(this.oSelf);
ed.Events.mergeRecover = function () {
if (this.table.getInfo() == true) {
this.table.mergeRecover();
}
}.bind2(this.oSelf);
ed.Events.unlink = this.oSelf.exec.unlink.bind2(this.oSelf.exec);
ed.Events.contextMouse = function (e) {
var obj = (e.srcElement || e.target);
switch (e.type) {
case 'mouseover':
if (obj.nodeName.toUpperCase() == 'LI') {
obj.className = 'iehover';
obj.style.backgroundColor = '#FBEEF1';
}
else {
obj.parentNode.className = 'iehover';
obj.parentNode.style.backgroundColor = '#FBEEF1';
}
break;
case 'mouseout':
if (obj.nodeName.toUpperCase() == 'LI') {
obj.className = '';
obj.style.backgroundColor = '';
}
else {
obj.parentNode.className = '';
obj.parentNode.style.backgroundColor = '';
}
break;
}
}.bind2Event(this.oSelf);
ed.Events.close = function () {
removeEvent(this, 'click', arguments.callee, true);
ed.exec.close();
};
ed.Events.evtFonttype = ed.exec.evtFonttype.bind2Event(ed);
ed.Events.evtFontsize = ed.exec.evtFontsize.bind2Event(ed);
ed.Events.evtPickColor = ed.exec.evtPickColor.bind2Event(ed);
ed.Events.evtBgColor = ed.exec.evtBgColor.bind2Event(ed);
ed.Events.evtPickColor2 = ed.exec.evtPickColor2.bind2Event(ed);
ed.Events.evtLink = ed.exec.evtLink.bind2Event(ed);
ed.Events.evtMovie = ed.exec.evtMovie.bind2(ed);
ed.Events.evtImage = ed.exec.evtImage.bind2(ed);
ed.Events.evtPresentExcel = ed.exec.evtPresentExcel.bind2(ed);
ed.Events.evtTable = ed.table.evtTable.bind2(ed);
ed.Events.evtTableModify = ed.table.evtTableModify.bind2(ed);
ed.Events.evtCellProp = ed.table.evtCellProp.bind2Event(ed);
ed.Events.evtRowProp = ed.table.evtRowProp.bind2Event(ed);
ed.Events.imageAttri = ed.exec.imageAttri.bind2Event(ed.exec);
ed.Events.evtImageAttri = ed.exec.evtImageAttri.bind2Event(ed);
var
oUL = document.createElement('ul'),
objExtend = this.oSelf.getOpt('addToolbarBtn'),
objRmBtn = this.oSelf.getOpt('rmBtn');
var arrayTool = this.oSelf.getOpt('toolbarType') == 'all' ? this.oSelf.getOpt('toolbar') : this.oSelf.getOpt('toolbarSimple');
for (var grpCnt = 0, groupTotal = arrayTool.length; grpCnt < groupTotal; grpCnt++) {
var oUL = document.createElement('UL');
oUL.className = NN.Browser.MSIE ? 'se_toolbar_left' : 'se_toolbar_left2';
var oLI = document.createElement('li');
oLI.innerHTML = '';
oUL.appendChild(oLI);
var objSubGroup = arrayTool[grpCnt];
for (var subGrpCnt = 0, subGrpTotal = objSubGroup.length; subGrpCnt < subGrpTotal; subGrpCnt++) {
var func = objSubGroup[subGrpCnt];
if (objRmBtn.search(func) != -1) continue;
var _title = NNEditor_Lang[func] || '';
var oLI = document.createElement('li');
oLI.className = func;
if (!func) continue;
var id = ed.Config.instanceID + '_BUTTON_' + func;
switch (func) {
case 'mode':
oLI.innerHTML = '
' + NNEditor_Lang['src'] + '
';
oUL.appendChild(oLI);
break;
case 'bold':
case 'underline':
case 'cut':
case 'copy':
case 'paste':
case 'italic':
case 'strikethrough':
case 'superscript':
case 'subscript':
case 'removeformat':
case 'justifyleft':
case 'justifycenter':
case 'justifyright':
case 'justifyfull':
case 'insertorderedlist':
case 'insertunorderedlist':
case 'inserthorizontalrule':
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'basic');
oBtn.setAttribute('argv1', func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case '/':
oLI.innerHTML = '';
oUL.appendChild(oLI);
break;
case '//':
var o = document.createElement('br');
o.className = 'clear';
oUL.appendChild(o);
oLI.innerHTML = '';
oUL.appendChild(oLI);
break;
case 'fonttype':
oLI.innerHTML = '
';
oUL.appendChild(oLI);
break;
case 'fontsize':
oLI.innerHTML = '
';
oUL.appendChild(oLI);
break;
case 'fontcolor':
oLI.innerHTML = '
';
oUL.appendChild(oLI);
break;
case 'fontbgcolor':
oLI.innerHTML = '
';
oUL.appendChild(oLI);
break;
case 'html':
case 'full':
var oBtn = this.c(func);
oBtn.setAttribute('rel', func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case 'table':
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'table');
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case 'tableModify':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'cellProp':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'rowProp':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'insertrow_before':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'insertrow_after':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
var oThis = this.oSelf;
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'deleterow':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'insertcell_before':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'insertcell_after':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'deletecell':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'merge':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'mergeRecover':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'unlink':
var oBtn = this.c(func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
ed.Events.ctrlToobar(oBtn, eval('ed.Events.' + func), 'disable');
break;
case 'undo':
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'undo');
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case 'redo':
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'redo');
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case 'docunew':
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'docunew');
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
case 'indent':
case 'outdent':
default:
var oBtn = this.c(func);
oBtn.setAttribute('rel', 'default');
oBtn.setAttribute('argv1', func);
oLI.appendChild(oBtn);
oUL.appendChild(oLI);
break;
}
if (typeof oBtn != 'undefined') {
if (typeof objExtend[func] == 'object') {
oBtn.style.cssText = objExtend[func]['cssText'];
}
oBtn.setAttribute('rel2', 'm');
}
}
NN.Utils.g(ed.Config.instanceID + '_TOOLBAR').appendChild(oUL);
oUL = null;
}
var oIFrame = document.createElement('iframe');
with(oIFrame) {
id = this.oSelf.getID('iframe');
frameBorder = 'no';
tabindex = 0;
style.width = '100%';
style.height = this.oSelf.getOpt('height') + 'px';
style.display = 'block';
}
oIFrame.setAttribute("tabIndex", 0);
NN.Utils.g(ed.Config.instanceID + '_iframe_container').appendChild(oIFrame);
var oText = document.createElement('textarea');
with(oText) {
id = this.oSelf.getID('textarea');
name = this.oSelf.getOpt('instanceID');
style.display = 'none';
style.width = '100%';
style.height = this.oSelf.getOpt('height') + 'px';
style.border = '0px none';
style.clear = 'both';
style.fontSize = '9pt';
style.fontFamily = 'gulim';
style.margin = 0;
style.padding = 0;
style.resize = 'none';
value = '
';
}
NN.Utils.g(ed.Config.instanceID + '_iframe_container').appendChild(oText);
this.initSet();
},
'useCss': function (s) {
if (NN.Browser.MSIE) return;
var oIFDoc = this.oSelf.getIFDoc();
oIFDoc.execCommand("styleWithCSS", 0, s);
},
'initSet': function () {
var
t = this,
ed = this.oSelf,
oIFDoc = ed.getIFDoc();
isNewTypingForUndo = false;
if (ed.getOpt('divideTagStyle')) {
var _START_HTML = ed.getOpt('START_HTML').replace('