matcha-components 20.229.0 → 20.231.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1847 @@
1
+ if(typeof window.SUNEDITOR=='undefined') window.SUNEDITOR = {};
2
+
3
+ /** default language english */
4
+ SUNEDITOR.defaultLang = {
5
+ toolbar : {
6
+ fontFamily : 'Font',
7
+ fontFamilyDelete : 'Remove Font Family',
8
+ formats : 'Formats',
9
+ bold : 'Bold',
10
+ underline : 'Underline',
11
+ italic : 'Italic',
12
+ strike : 'Strike',
13
+ fontColor : 'Font Color',
14
+ hiliteColor : 'Background Color',
15
+ indent : 'Indent',
16
+ outdent : 'Outdent',
17
+ align : 'Align',
18
+ alignLeft : 'Align left',
19
+ alignRight : 'Align right',
20
+ alignCenter : 'Align center',
21
+ justifyFull : 'Justify full',
22
+ left : 'Left',
23
+ right : 'Right',
24
+ center : 'Center',
25
+ bothSide : 'Justify full',
26
+ list : 'list',
27
+ orderList : 'Ordered list',
28
+ unorderList : 'Unordered list',
29
+ line : 'Line',
30
+ table : 'Table',
31
+ link : 'Link',
32
+ image : 'Picture',
33
+ video : 'Video',
34
+ fullScreen : 'Full Screen',
35
+ htmlEditor : 'Code View'
36
+ },
37
+ dialogBox : {
38
+ linkBox : {
39
+ title : 'Insert Link',
40
+ url : 'URL to link',
41
+ text : 'Text to display'
42
+ },
43
+ imageBox : {
44
+ title : 'Insert Image',
45
+ file : 'Select from files',
46
+ url : 'Image URL',
47
+ resize100 : 'resize 100%',
48
+ resize75 : 'resize 75%',
49
+ resize50 : 'resize 50%',
50
+ resize25 : 'resize 25%',
51
+ remove : 'remove image'
52
+ },
53
+ videoBox : {
54
+ title : 'Insert Video',
55
+ url : 'Media embed URL, YouTube',
56
+ width : 'Width',
57
+ height : 'Height'
58
+ },
59
+ submitButton : 'Submit'
60
+ }
61
+ };
62
+
63
+ /**
64
+ * wysiwyg web editor
65
+ *
66
+ * suneditor.js
67
+ * Copyright 2017 JiHong Lee.
68
+ * MIT license.
69
+ */
70
+ (function(){
71
+ /**
72
+ * utile func
73
+ * @type {{returnTrue}}
74
+ */
75
+ var func = (function(){
76
+ return {
77
+ returnTrue : function() {
78
+ return true;
79
+ }
80
+ };
81
+ })();
82
+
83
+ /**
84
+ * document func
85
+ * @type {{getArrayIndex, nextIdx, prevIdx, isCell, getListChildren, getParentNode, changeTxt, changeClass, addClass, removeClass, toggleClass}}
86
+ */
87
+ var dom = (function(){
88
+ return {
89
+ getArrayIndex : function(array, element) {
90
+ var idx = -1;
91
+
92
+ for(var i=0; i<array.length; i++) {
93
+ if(array[i] === element) {
94
+ idx = i;
95
+ break;
96
+ }
97
+ }
98
+
99
+ return idx;
100
+ },
101
+
102
+ nextIdx : function(array, item) {
103
+ var idx = this.getArrayIndex(array, item);
104
+ if (idx === -1) return -1;
105
+
106
+ return idx + 1;
107
+ },
108
+
109
+ prevIdx : function(array, item) {
110
+ var idx = this.getArrayIndex(array, item);
111
+ if (idx === -1) return -1;
112
+
113
+ return idx - 1;
114
+ },
115
+
116
+ isCell : function(node) {
117
+ return node && /^TD$|^TH$/i.test(node.nodeName);
118
+ },
119
+
120
+ getListChildren : function(element, validation) {
121
+ var children = [];
122
+ validation = validation || func.returnTrue;
123
+
124
+ (function recursionFunc(current){
125
+ if (element !== current && validation(current)) {
126
+ children.push(current);
127
+ }
128
+ for (var i = 0, len = current.children.length; i < len; i++) {
129
+ recursionFunc(current.children[i]);
130
+ }
131
+ })(element);
132
+
133
+ return children;
134
+ },
135
+
136
+ getParentNode : function(element, tagName) {
137
+ var check = new RegExp("^"+tagName+"$", "i");
138
+
139
+ while(!check.test(element.tagName)) {
140
+ element = element.parentNode;
141
+ }
142
+
143
+ return element;
144
+ },
145
+
146
+ changeTxt : function(element, txt) {
147
+ element.textContent = txt;
148
+ },
149
+
150
+ changeClass : function(element, className) {
151
+ element.className = className;
152
+ },
153
+
154
+ addClass : function(element, className) {
155
+ if(!element) return;
156
+
157
+ var check = new RegExp("(\\s|^)" + className + "(\\s|$)");
158
+ if(check.test(element.className)) return;
159
+
160
+ element.className += " " + className;
161
+ },
162
+
163
+ removeClass : function(element, className) {
164
+ if(!element) return;
165
+
166
+ var check = new RegExp("(\\s|^)" + className + "(\\s|$)");
167
+ element.className = element.className.replace(check, " ").trim();
168
+ },
169
+
170
+ toggleClass : function(element, className) {
171
+ var check = new RegExp("(\\s|^)" + className + "(\\s|$)");
172
+
173
+ if (check.test(element.className)) {
174
+ element.className = element.className.replace(check, " ").trim();
175
+ }
176
+ else {
177
+ element.className += " " + className;
178
+ }
179
+ }
180
+ };
181
+ })();
182
+
183
+ /**
184
+ * SunEditor
185
+ * @param context
186
+ */
187
+ var core = function(context){
188
+ /** ë°°́—´ ê´€ë ¨ */
189
+ var list = (function(){
190
+ var commandMap = {
191
+ 'FONT': context.tool.fontFamily,
192
+ 'B' : context.tool.bold,
193
+ 'U' : context.tool.underline,
194
+ 'I' : context.tool.italic,
195
+ 'STRIKE' : context.tool.strike
196
+ };
197
+
198
+ /** 글꼴 목록 ê°€́ ¸́˜¤ê¸° */
199
+ var fontFamilyMap = {};
200
+ var list_fontFamily = context.tool.list_fontFamily.children;
201
+
202
+ list_fontFamily[0].firstChild.getAttribute("data-value");
203
+ for(var i=0; i<list_fontFamily.length; i++) {
204
+ fontFamilyMap[list_fontFamily[i].firstChild.getAttribute("data-value").replace(/\s*/g,"")] = list_fontFamily[i].firstChild.getAttribute("data-txt");
205
+ }
206
+
207
+ if(context.tool.list_fontFamily_add) {
208
+ list_fontFamily = context.tool.list_fontFamily_add.children;
209
+ for(var i=0; i<list_fontFamily.length; i++) {
210
+ fontFamilyMap[list_fontFamily[i].firstChild.getAttribute("data-value").replace(/\s*/g,"")] = list_fontFamily[i].firstChild.getAttribute("data-txt");
211
+ }
212
+ }
213
+
214
+ list_fontFamily = null;
215
+
216
+ return {
217
+ commandMap : commandMap,
218
+ fontFamilyMap : fontFamilyMap
219
+ }
220
+ })();
221
+
222
+ /** selection ê´€ë ¨ */
223
+ var wysiwygSelection = (function(){
224
+ return {
225
+ focus : function(){
226
+ context.element.wysiwygWindow.document.body.focus();
227
+ },
228
+
229
+ isEdgePoint : function(container, offset) {
230
+ return (offset === 0) || (offset === container.nodeValue.length);
231
+ },
232
+
233
+ createRange : function() {
234
+ return context.element.wysiwygWindow.document.createRange();
235
+ },
236
+
237
+ getSelection : function() {
238
+ return context.element.wysiwygWindow.getSelection();
239
+ },
240
+
241
+ getPElementInFocusNode : function() {
242
+ var parentElement = context.argument._selectionNode;
243
+ while(!/^P$/i.test(parentElement.tagName) && !/^BODY$/i.test(parentElement.tagName)) {
244
+ parentElement = parentElement.parentNode;
245
+ }
246
+
247
+ return parentElement;
248
+ }
249
+ }
250
+ })();
251
+
252
+ /** ́—ë””í„° */
253
+ var editor = (function(){
254
+ return {
255
+ subMenu : null,
256
+ originSub : null,
257
+ modalForm : null,
258
+ tabSize : 4,
259
+
260
+ pure_execCommand : function(command, showDefaultUI, value) {
261
+ context.element.wysiwygWindow.document.execCommand(command, showDefaultUI, value);
262
+ },
263
+
264
+ cancel_table_picker : function() {
265
+ context.tool.tableHighlight.style.width = "1em";
266
+ context.tool.tableHighlight.style.height = "1em";
267
+ context.tool.tableUnHighlight.style.width = "5em";
268
+ context.tool.tableUnHighlight.style.height = "5em";
269
+ dom.changeTxt(context.tool.tableDisplay, "1 x 1");
270
+ },
271
+
272
+ subOff : function() {
273
+ if(this.subMenu) {
274
+ this.subMenu.style.display = "none";
275
+ this.subMenu = null;
276
+ this.cancel_table_picker();
277
+ }
278
+ if(this.modalForm) {
279
+ this.modalForm.style.display = "none";
280
+ context.dialog.back.style.display = "none";
281
+ context.dialog.modalArea.style.display = "none";
282
+ }
283
+ if(context.argument._imageElement) {
284
+ event.cancel_resize_image();
285
+ }
286
+
287
+ return;
288
+ },
289
+
290
+ toggleFrame : function(){
291
+ if(!context.argument._wysiwygActive) {
292
+ var ec = {"&amp;":"&","&nbsp;":"\u00A0","&quot;":"\"","&lt;":"<","&gt;":">"};
293
+ var source_html = context.element.source.value.replace(/&[a-z]+;/g, function(m){ return (typeof ec[m] === "string")?ec[m]:m; });
294
+ context.element.wysiwygWindow.document.body.innerHTML = source_html.trim().length > 0? source_html: "<p>&#65279</p>";
295
+ context.element.wysiwygWindow.document.body.scrollTop = 0;
296
+ context.element.source.style.display = "none";
297
+ context.element.wysiwygElement.style.display = "block";
298
+ context.argument._wysiwygActive = true;
299
+ }
300
+ else {
301
+ context.element.source.value = context.element.wysiwygWindow.document.body.innerHTML.trim();
302
+ context.element.wysiwygElement.style.display = "none";
303
+ context.element.source.style.display = "block";
304
+ context.argument._wysiwygActive = false;
305
+ }
306
+ },
307
+
308
+ toggleFullScreen : function(element){
309
+ if(!context.argument._isFullScreen) {
310
+ context.element.topArea.style.position = "fixed";
311
+ context.element.topArea.style.top = "0";
312
+ context.element.topArea.style.left = "0";
313
+ context.element.topArea.style.width = "100%";
314
+ context.element.topArea.style.height = "100%";
315
+
316
+ context.argument._innerHeight_fullScreen = (window.innerHeight - context.tool.bar.offsetHeight);
317
+ context.element.editorArea.style.height = context.argument._innerHeight_fullScreen + "px";
318
+
319
+ dom.removeClass(element.firstElementChild, 'ico_full_screen_e');
320
+ dom.addClass(element.firstElementChild, 'ico_full_screen_i');
321
+ }
322
+ else {
323
+ context.element.topArea.style.cssText = context.argument._originCssText;
324
+ context.element.editorArea.style.height = context.argument._innerHeight + "px";
325
+
326
+ dom.removeClass(element.firstElementChild, 'ico_full_screen_i');
327
+ dom.addClass(element.firstElementChild, 'ico_full_screen_e');
328
+ }
329
+
330
+ context.argument._isFullScreen = !context.argument._isFullScreen;
331
+ },
332
+
333
+ appendHr : function(value) {
334
+ var borderStyle = "";
335
+ switch(value) {
336
+ case 'hr1':
337
+ borderStyle = "black 1px solid";
338
+ break;
339
+ case 'hr2':
340
+ borderStyle = "black 1px dotted";
341
+ break;
342
+ case 'hr3':
343
+ borderStyle = "black 1px dashed";
344
+ break;
345
+ }
346
+
347
+ var oHr = document.createElement("HR");
348
+ oHr.style.border = "black 0px none";
349
+ oHr.style.borderTop = borderStyle;
350
+ oHr.style.height = "1px";
351
+ context.argument._selectionNode.parentNode.appendChild(oHr);
352
+
353
+ editor.appendP(oHr);
354
+ },
355
+
356
+ appendTable : function(x, y) {
357
+ var oTable = document.createElement("TABLE");
358
+
359
+ var tableHTML = '<tbody>';
360
+ while(y>0) {
361
+ tableHTML += '<tr>';
362
+ var tdCnt = x;
363
+ while(tdCnt>0) {
364
+ tableHTML += '<td><p>&#65279</p></td>';
365
+ --tdCnt;
366
+ }
367
+ tableHTML += '</tr>';
368
+ --y;
369
+ }
370
+ tableHTML += '</tbody>';
371
+
372
+ oTable.innerHTML = tableHTML;
373
+
374
+ editor.insertNode(oTable);
375
+ editor.appendP(oTable);
376
+ },
377
+
378
+ appendP : function(element) {
379
+ var oP = document.createElement("P");
380
+ oP.innerHTML = '&#65279';
381
+ element.parentNode.insertBefore(oP, element.nextElementSibling);
382
+ },
383
+
384
+ openDialog : function(kind) {
385
+ var focusText = null;
386
+
387
+ switch(kind) {
388
+ case 'link':
389
+ this.modalForm = context.dialog.link;
390
+ focusText = context.dialog.linkText;
391
+ break;
392
+ case 'image':
393
+ this.modalForm = context.dialog.image;
394
+ focusText = context.dialog.imgInputUrl;
395
+ break;
396
+ case 'video':
397
+ this.modalForm = context.dialog.video;
398
+ focusText = context.dialog.videoInputUrl;
399
+ break;
400
+ }
401
+
402
+ context.dialog.modalArea.style.display = "block";
403
+ context.dialog.back.style.display = "block";
404
+ context.dialog.modal.style.display = "block";
405
+ this.modalForm.style.display = "block";
406
+
407
+ this.subMenu = context.dialog.modal;
408
+
409
+ focusText.focus();
410
+ },
411
+
412
+ showLoding : function() {
413
+ context.element.loding.style.display = "block";
414
+ },
415
+
416
+ closeLoding : function() {
417
+ context.element.loding.style.display = "none";
418
+ },
419
+
420
+ insertNode : function(oNode) {
421
+ var selection = wysiwygSelection.getSelection();
422
+ var nativeRng = null;
423
+
424
+ if(selection.rangeCount > 0) {
425
+ nativeRng = selection.getRangeAt(0);
426
+ } else {
427
+ selection = context.argument._copySelection;
428
+
429
+ nativeRng = wysiwygSelection.createRange();
430
+ nativeRng.setStart(selection.focusNode, selection.anchorOffset);
431
+ nativeRng.setEnd(selection.focusNode, selection.focusOffset);
432
+ }
433
+
434
+ var startCon = nativeRng.startContainer;
435
+ var startOff = nativeRng.startOffset;
436
+ var endCon = nativeRng.endContainer;
437
+ var endOff = nativeRng.endOffset;
438
+
439
+ var pNode = startCon;
440
+ if(/^#text$/i.test(startCon.nodeName)) {
441
+ pNode = startCon.parentNode;
442
+ }
443
+
444
+ /** ë²”́œ„́„ 택 ́—†́„때 */
445
+ if(startCon === endCon && startOff === endOff) {
446
+ if(/^#text$/i.test(selection.focusNode.nodeName)) {
447
+ var rightNode = selection.focusNode.splitText(endOff);
448
+ pNode.insertBefore(oNode, rightNode);
449
+ }
450
+ else {
451
+ if(/^BR$/i.test(pNode.lastChild.nodeName)) {
452
+ pNode.removeChild(pNode.lastChild);
453
+ }
454
+ pNode.appendChild(oNode);
455
+ }
456
+ }
457
+ /** ë²”́œ„́„ 택 í–ˆ́„때 */
458
+ else {
459
+ var removeNode = startCon;
460
+ var rightNode = null;
461
+ var isSameContainer = startCon === endCon;
462
+
463
+ if(isSameContainer) {
464
+ if(!wysiwygSelection.isEdgePoint(endCon, endOff)) {
465
+ rightNode = endCon.splitText(endOff);
466
+ }
467
+
468
+ if(!wysiwygSelection.isEdgePoint(startCon, startOff)) {
469
+ removeNode = startCon.splitText(startOff);
470
+ }
471
+
472
+ pNode.removeChild(removeNode);
473
+ }
474
+ else {
475
+ var nodes = [];
476
+ var container = startCon;
477
+ while(container.nodeType == 3 && !(endCon == container)) {
478
+ nodes.push(container);
479
+ container = container.nextSibling;
480
+ }
481
+
482
+ nodes.push(container);
483
+
484
+ for(var i=0; i<nodes.length; i++) {
485
+ pNode.removeChild(nodes[i]);
486
+ }
487
+ }
488
+
489
+ pNode.insertBefore(oNode, rightNode);
490
+ }
491
+ }
492
+ };
493
+ })();
494
+
495
+ /** ́´ë²¤íЏ */
496
+ var event = (function(){
497
+ var resize_window = function() {
498
+ // if(context.tool.barHeight == context.tool.bar.offsetHeight) return;
499
+
500
+ if(context.argument._isFullScreen) {
501
+ context.argument._innerHeight_fullScreen += ((context.tool.barHeight - context.tool.bar.offsetHeight) + (this.innerHeight - context.argument._windowHeight));
502
+ context.element.editorArea.style.height = context.argument._innerHeight_fullScreen + "px";
503
+ }
504
+
505
+ context.tool.barHeight = context.tool.bar.offsetHeight;
506
+ context.argument._windowHeight = this.innerHeight;
507
+ };
508
+
509
+ var onClick_toolbar = function(e) {
510
+ var targetElement = e.target;
511
+ var display = targetElement.getAttribute("data-display");
512
+ var command = targetElement.getAttribute("data-command");
513
+ var className = targetElement.className;
514
+
515
+ e.preventDefault();
516
+ e.stopPropagation();
517
+
518
+ wysiwygSelection.focus();
519
+
520
+ while(!command && !display && !/layer_color|layer_url|editor_tool/.test(className) && !/^BODY$/i.test(targetElement.tagName)){
521
+ targetElement = targetElement.parentNode;
522
+ command = targetElement.getAttribute("data-command");
523
+ display = targetElement.getAttribute("data-display");
524
+ className = targetElement.className;
525
+ }
526
+
527
+ var value = targetElement.getAttribute("data-value");
528
+ var txt = targetElement.getAttribute("data-txt");
529
+
530
+ /** ́„œë¸Œë©”뉴 ë³´́´ê¸° */
531
+ if(display || /^BODY$/i.test(targetElement.tagName)) {
532
+ var nextSibling = editor.subMenu;
533
+ editor.subOff();
534
+
535
+ if(targetElement.nextElementSibling != null && targetElement.nextElementSibling != nextSibling){
536
+ editor.subMenu = targetElement.nextElementSibling;
537
+ editor.subMenu.style.display = "block";
538
+ editor.originSub = editor.subMenu.previousElementSibling;
539
+ }
540
+ else if(/modal/.test(display)) {
541
+ editor.openDialog(command);
542
+ }
543
+
544
+ nextSibling = null;
545
+
546
+ return;
547
+ }
548
+
549
+ if(/layer_color/.test(className) && /^BUTTON$/i.test(e.target.tagName)) {
550
+ value = e.target.textContent;
551
+ }
552
+
553
+ /** ́»¤ë©˜ë“œ ëª…ë ¹́–´ ́‹¤í–‰ */
554
+ if(command) {
555
+ if(/fontName/.test(command)) {
556
+ dom.changeTxt(editor.originSub.firstElementChild, txt);
557
+ editor.pure_execCommand(command, false, value);
558
+ }
559
+ else if(/format/.test(command)) {
560
+ editor.pure_execCommand("formatBlock", false, value);
561
+ }
562
+ else if(/justifyleft|justifyright|justifycenter|justifyfull/.test(command)) {
563
+ dom.changeTxt(editor.originSub.firstElementChild, targetElement.title.split(" ")[0]);
564
+ // dom.changeClass(editor.originSub.firstElementChild, targetElement.firstElementChild.className);
565
+ editor.pure_execCommand(command, false);
566
+ }
567
+ else if(/foreColor|hiliteColor/.test(command)) {
568
+ editor.pure_execCommand(command, false, value);
569
+ }
570
+ else if(/horizontalRules/.test(command)) {
571
+ editor.appendHr(value);
572
+ }
573
+ else if(/sorceFrame/.test(command)) {
574
+ editor.toggleFrame();
575
+ dom.toggleClass(targetElement, 'on');
576
+ }
577
+ else if(/fullScreen/.test(command)) {
578
+ editor.toggleFullScreen(targetElement);
579
+ dom.toggleClass(targetElement, "on");
580
+ }
581
+ else if(/indent|outdent/.test(command)) {
582
+ editor.pure_execCommand(command, false);
583
+ }
584
+ else if(/insertTable/.test(command)) {
585
+ editor.appendTable(context.argument._tableXY[0], context.argument._tableXY[1]);
586
+ }
587
+ else {
588
+ editor.pure_execCommand(command, false, value);
589
+ dom.toggleClass(targetElement, "on");
590
+ }
591
+
592
+ editor.subOff();
593
+ }
594
+
595
+ };
596
+
597
+ var onMouseDown_wysiwyg = function(e) {
598
+ var targetElement = e.target;
599
+
600
+ editor.subOff();
601
+
602
+ if(/^IMG$/i.test(targetElement.nodeName)) {
603
+ /** ie,firefox image resize handle : false*/
604
+ targetElement.setAttribute('unselectable', 'on');
605
+ targetElement.contentEditable = false;
606
+
607
+ var resizeDiv = context.element.imageResizeDiv;
608
+ var w = targetElement.offsetWidth;
609
+ var h = targetElement.offsetHeight;
610
+
611
+ var parentElement = targetElement.offsetParent;
612
+ var parentT = 1;
613
+ var parentL = 1;
614
+ while(parentElement) {
615
+ parentT += (parentElement.offsetTop + parentElement.clientTop);
616
+ parentL += (parentElement.offsetLeft + + parentElement.clientLeft);
617
+ parentElement = parentElement.offsetParent;
618
+ }
619
+ context.argument._imageResize_parent_t = (context.tool.bar.offsetHeight + parentT);
620
+ context._imageResize_parent_l = parentL;
621
+
622
+ var t = (targetElement.offsetTop + context.argument._imageResize_parent_t - context.element.wysiwygWindow.document.body.scrollTop);
623
+ var l = (targetElement.offsetLeft + parentL);
624
+
625
+ resizeDiv.style.top = t + "px";
626
+ resizeDiv.style.left = l + "px";
627
+ resizeDiv.style.width = w + "px";
628
+ resizeDiv.style.height = h + "px";
629
+
630
+ context.element.imageResizeBtn.style.top = (h + t) + "px";
631
+ context.element.imageResizeBtn.style.left = l + "px";
632
+
633
+ dom.changeTxt(context.element.imageResizeDisplay, w + " x " + h);
634
+
635
+ context.argument._imageElement = targetElement;
636
+ context.argument._imageElement_w = w;
637
+ context.argument._imageElement_h = h;
638
+ context.argument._imageElement_t = t;
639
+ context.argument._imageElement_l = l;
640
+
641
+ context.element.imageResizeDiv.style.display = "block";
642
+ context.element.imageResizeBtn.style.display = "block";
643
+ }
644
+ else if(/^HTML$/i.test(targetElement.nodeName)){
645
+ wysiwygSelection.focus();
646
+ }
647
+ };
648
+
649
+ /** selection 객́²´ ë³µ́‚¬́š©(IE...) */
650
+ function copyObj(obj) {
651
+ var copy = {};
652
+ for (var attr in obj) {
653
+ copy[attr] = obj[attr];
654
+ }
655
+ return copy;
656
+ }
657
+
658
+ var onSelectionChange_wysiwyg = function() {
659
+ context.argument._copySelection = copyObj(wysiwygSelection.getSelection());
660
+ context.argument._selectionNode = wysiwygSelection.getSelection().anchorNode;
661
+
662
+ var selectionParent = context.argument._selectionNode;
663
+ var selectionNodeStr = "";
664
+ var fontFamily = context.tool.default_fontFamily;
665
+ while(!/^P$|^BODY$|^HTML$/i.test(selectionParent.nodeName)) {
666
+ selectionNodeStr += selectionParent.nodeName + "|";
667
+ if(/^FONT$/i.test(selectionParent.nodeName) && selectionParent.face.length > 0) {
668
+ var selectFont = list.fontFamilyMap[selectionParent.face.replace(/\s*/g,"")];
669
+ fontFamily = (selectFont? selectFont: fontFamily);
670
+ break;
671
+ }
672
+ selectionParent = selectionParent.parentNode;
673
+ }
674
+
675
+ if(/^SPAN$/i.test(selectionParent.nodeName)) {
676
+ for(var i=0; i<selectionParent.children.length; i++) {
677
+ selectionNodeStr += selectionParent.children[i].tagName;
678
+ }
679
+ }
680
+
681
+
682
+ /** add */
683
+ var onNode = selectionNodeStr.split("|");
684
+ var map = "B|U|I|STRIKE|FONT|";
685
+ for(var i=0; i<onNode.length - 1; i++) {
686
+ var nodeName = (/^STRONG$/.test(onNode[i])? 'B': (/^EM/.test(onNode[i])? 'I': onNode[i]));
687
+ if(/^FONT$/i.test(nodeName)) {
688
+ dom.changeTxt(list.commandMap[nodeName], fontFamily);
689
+ }
690
+ else {
691
+ dom.addClass(list.commandMap[nodeName], "on");
692
+ }
693
+ map = map.replace(nodeName+"|", "");
694
+ }
695
+
696
+ /** remove */
697
+ map = map.split("|");
698
+ for(var i=0; i<map.length - 1; i++) {
699
+ if(/^FONT$/i.test(map[i])) {
700
+ dom.changeTxt(list.commandMap[map[i]], fontFamily);
701
+ }
702
+ else {
703
+ dom.removeClass(list.commandMap[map[i]], "on");
704
+ }
705
+ }
706
+ };
707
+
708
+ var onKeyDown_wysiwyg = function(e) {
709
+ var target = e.target;
710
+ var keyCode = e.keyCode;
711
+ var shift = e.shiftKey;
712
+ var ctrl = e.ctrlKey;
713
+ var alt = e.altKey;
714
+
715
+
716
+ switch(keyCode) {
717
+ case 8: /**backspace key*/
718
+ if(target.childElementCount === 1 && target.children[0].innerHTML === "<br>") {
719
+ e.preventDefault();
720
+ e.stopPropagation();
721
+ return false;
722
+ }
723
+ break;
724
+ case 9: /**tab key*/
725
+ e.preventDefault();
726
+ e.stopPropagation();
727
+
728
+ if(ctrl || alt) break;
729
+
730
+ var currentNode = wysiwygSelection.getPElementInFocusNode().parentNode;
731
+
732
+ if(currentNode && /^TD$/i.test(currentNode.tagName)) {
733
+ var table = dom.getParentNode(currentNode, "table");
734
+ var cells = dom.getListChildren(table, dom.isCell);
735
+ var idx = shift? dom.prevIdx(cells, currentNode): dom.nextIdx(cells, currentNode);
736
+
737
+ if(idx === cells.length && !shift) idx = 0;
738
+ if(idx === -1 && shift) idx = cells.length - 1;
739
+
740
+ var moveCell = cells[idx];
741
+ if(!moveCell) return false;
742
+
743
+ var range = wysiwygSelection.createRange();
744
+ range.setStart(moveCell, 0);
745
+ range.setEnd(moveCell, 0);
746
+
747
+ var selection = wysiwygSelection.getSelection();
748
+ if (selection.rangeCount > 0) {
749
+ selection.removeAllRanges();
750
+ }
751
+ selection.addRange(range);
752
+
753
+ break;
754
+ }
755
+
756
+ /** P 노드́¼ë•Œ */
757
+ if(shift) break;
758
+
759
+ var tabText = context.element.wysiwygWindow.document.createTextNode(new Array(editor.tabSize + 1).join("\u00A0"));
760
+ editor.insertNode(tabText);
761
+
762
+ var selection = wysiwygSelection.getSelection();
763
+ var rng = wysiwygSelection.createRange();
764
+
765
+ rng.setStart(tabText, editor.tabSize);
766
+ rng.setEnd(tabText, editor.tabSize);
767
+
768
+ if (selection.rangeCount > 0) {
769
+ selection.removeAllRanges();
770
+ }
771
+
772
+ selection.addRange(rng);
773
+
774
+ break;
775
+ }
776
+ };
777
+
778
+ var onScroll_wysiwyg = function() {
779
+ if(context.argument._imageElement) {
780
+ var t = (context.argument._imageElement.offsetTop + context.argument._imageResize_parent_t - context.element.wysiwygWindow.scrollY);
781
+
782
+ context.element.imageResizeDiv.style.top = t + "px"
783
+ context.element.imageResizeBtn.style.top = (t + context.argument._imageElement_h) + "px";
784
+ }
785
+ };
786
+
787
+ var onClick_dialog = function(e) {
788
+ if(/modal-dialog/.test(e.target.className) || /close/.test(e.target.getAttribute("data-command"))) {
789
+ editor.subOff();
790
+ }
791
+ };
792
+
793
+ var onChange_imgInput = function() {
794
+ try {
795
+ if (this.files && this.files[0]) {
796
+ editor.showLoding();
797
+ editor.subOff();
798
+
799
+ var reader = new FileReader();
800
+
801
+ reader.onload = function () {
802
+ try {
803
+ context.argument._imageFileSrc = reader.result;
804
+
805
+ var oImg = document.createElement("IMG");
806
+ oImg.src = context.dialog.imgInputUrl.value.trim().length > 0 ? context.dialog.imgInputUrl.value : context.argument._imageFileSrc;
807
+ oImg.style.width = context.user.imageSize;
808
+ // wysiwygSelection.getPElementInFocusNode().appendChild(oImg);
809
+ editor.insertNode(oImg);
810
+ // editor.appendP(oImg);
811
+
812
+ context.argument._imageFileSrc = null;
813
+ context.dialog.imgInputFile.value = "";
814
+ context.dialog.imgInputUrl.value = "";
815
+ } finally {
816
+ editor.closeLoding();
817
+ }
818
+ };
819
+
820
+ reader.readAsDataURL(this.files[0]);
821
+ }
822
+ } catch(e) {
823
+ editor.closeLoding();
824
+ }
825
+ };
826
+
827
+ var onClick_imageResizeBtn = function(e) {
828
+ var command = e.target.getAttribute("data-command") || e.target.parentNode.getAttribute("data-command");
829
+
830
+ if(!command) return;
831
+
832
+ if(/^\d+$/.test(command)) {
833
+ context.argument._imageElement.style.height = "";
834
+ context.argument._imageElement.style.width = command + "%";
835
+ }
836
+ else if(/remove/.test(command)){
837
+ context.argument._imageElement.remove();
838
+ }
839
+
840
+ editor.subOff();
841
+ wysiwygSelection.focus();
842
+
843
+ e.preventDefault();
844
+ e.stopPropagation();
845
+ };
846
+
847
+ var onMouseDown_image_ctrl = function(e) {
848
+ e.preventDefault();
849
+ e.stopPropagation();
850
+
851
+ context.element.resizeBackground.style.display = "block";
852
+ context.element.imageResizeBtn.style = "none";
853
+
854
+ document.addEventListener('mousemove', resize_image);
855
+ document.addEventListener('mouseup', function(){
856
+ document.removeEventListener('mousemove', resize_image);
857
+ cancel_resize_image();
858
+ });
859
+ };
860
+
861
+ var resize_image = function(e) {
862
+ var w = (e.clientX - context.argument._imageElement_l - context.element.topArea.offsetLeft);
863
+ var h = ((context.argument._imageElement_h/context.argument._imageElement_w) * w);
864
+
865
+ context.argument._imageElement.style.width = w + "px";
866
+ context.argument._imageElement.style.height = h + "px";
867
+
868
+ var parentElement = context.argument._imageElement.offsetParent;
869
+ var parentL = 1;
870
+ while(parentElement) {
871
+ parentL += (parentElement.offsetLeft + + parentElement.clientLeft);
872
+ parentElement = parentElement.offsetParent;
873
+ }
874
+
875
+ var l = (context.argument._imageElement.offsetLeft + parentL);
876
+
877
+ context.element.imageResizeDiv.style.left = l + "px";
878
+ context.element.imageResizeDiv.style.width = w + "px";
879
+ context.element.imageResizeDiv.style.height = h + "px";
880
+
881
+ dom.changeTxt(context.element.imageResizeDisplay, Math.round(w) + " x " + Math.round(h));
882
+ };
883
+
884
+ var cancel_resize_image = function() {
885
+ context.element.resizeBackground.style.display = "none";
886
+ context.element.imageResizeDiv.style.display = "none";
887
+ context.element.imageResizeBtn.style.display = "none";
888
+ // context.argument._imageElement = null;
889
+ };
890
+
891
+ var onMouseMove_tablePicker = function(e) {
892
+ var x = Math.ceil(e.offsetX/18);
893
+ var y = Math.ceil(e.offsetY/18);
894
+ x = x<1? 1: x;
895
+ y = y<1? 1: y;
896
+ context.tool.tableHighlight.style.width = x + "em";
897
+ context.tool.tableHighlight.style.height = y + "em";
898
+
899
+ var x_u = x<5? 5: (x>9? 10: x+1);
900
+ var y_u = y<5? 5: (y>9? 10: y+1);
901
+ context.tool.tableUnHighlight.style.width = x_u + "em";
902
+ context.tool.tableUnHighlight.style.height = y_u + "em";
903
+
904
+ dom.changeTxt(context.tool.tableDisplay, x + " x " + y);
905
+ context.argument._tableXY = [x, y];
906
+ };
907
+
908
+ var onMouseDown_resizeBar = function(e) {
909
+ context.argument._resizeClientY = e.clientY;
910
+ context.element.resizeBackground.style.display = "block";
911
+
912
+ document.addEventListener('mousemove', resize_editor);
913
+ document.addEventListener('mouseup', function () {
914
+ document.removeEventListener('mousemove', resize_editor);
915
+ context.element.resizeBackground.style.display = "none";
916
+ });
917
+ };
918
+
919
+ var resize_editor = function(e) {
920
+ var resizeInterval = (e.clientY - context.argument._resizeClientY);
921
+
922
+ context.element.editorArea.style.height = (context.element.editorArea.offsetHeight + resizeInterval) + "px";
923
+
924
+ context.argument._innerHeight = (context.element.editorArea.offsetHeight + resizeInterval);
925
+
926
+ context.argument._resizeClientY = e.clientY;
927
+ };
928
+
929
+ var dialog_submit = function(e) {
930
+ var className = this.classList[this.classList.length - 1];
931
+
932
+ editor.showLoding();
933
+ editor.subOff();
934
+
935
+ e.preventDefault();
936
+ e.stopPropagation();
937
+
938
+ try {
939
+ switch(className) {
940
+ case 'sun-editor-id-submit-link':
941
+ if(context.dialog.linkText.value.trim().length === 0) break;
942
+
943
+ var url = /^https?:\/\//.test(context.dialog.linkText.value)? context.dialog.linkText.value: "http://" + context.dialog.linkText.value;
944
+ var anchor = context.dialog.linkAnchorText || context.dialog.document.getElementById("linkAnchorText");
945
+ var anchorText = anchor.value.length === 0? url: anchor.value;
946
+
947
+ var oA = document.createElement("A");
948
+ oA.href = url;
949
+ oA.textContent = anchorText;
950
+
951
+ editor.insertNode(oA);
952
+ // editor.pure_execCommand("createLink", false, url);
953
+ // wysiwygSelection.getSelection().focusNode.parentNode.text = anchorText;
954
+
955
+ context.dialog.linkText.value = "";
956
+ context.dialog.linkAnchorText.value = "";
957
+ break;
958
+ case 'sun-editor-id-submit-image':
959
+ if(!context.argument._imageFileSrc && context.dialog.imgInputUrl.value.trim().length === 0) break;
960
+
961
+ var oImg = document.createElement("IMG");
962
+ oImg.src = context.dialog.imgInputUrl.value.trim().length>0? context.dialog.imgInputUrl.value: context.argument._imageFileSrc;
963
+ oImg.style.width = "350px";
964
+
965
+ // wysiwygSelection.getPElementInFocusNode().appendChild(oImg);
966
+ editor.insertNode(oImg);
967
+ // editor.appendP(oImg);
968
+
969
+ context.argument._imageFileSrc = null;
970
+ context.dialog.imgInputFile.value = "";
971
+ context.dialog.imgInputUrl.value = "";
972
+ break;
973
+ case'sun-editor-id-submit-video':
974
+ if(context.dialog.videoInputUrl.value.trim().length === 0) break;
975
+
976
+ var url = context.dialog.videoInputUrl.value.replace(/^https?:/, '');
977
+ var oIframe = document.createElement("IFRAME");
978
+ var x_v = context.dialog.video_x.value;
979
+ var y_v = context.dialog.video_y.value;
980
+
981
+ /** youtube */
982
+ if(/youtu\.?be/.test(url)) {
983
+ url = url.replace('watch?v=', '');
984
+ if(!/^\/\/.+\/embed\//.test(url)) {
985
+ var youtubeUrl = url.match(/^\/\/.+\//)[0]
986
+ url = url.replace(youtubeUrl, '//www.youtube.com/embed/');
987
+ }
988
+ }
989
+
990
+ oIframe.src = url;
991
+ oIframe.width = (/^\d+$/.test(x_v)? x_v: context.user.videoX);
992
+ oIframe.height = (/^\d+$/.test(y_v)? y_v: context.user.videoY);
993
+ oIframe.frameBorder = "0";
994
+ oIframe.allowFullscreen = true;
995
+
996
+ // wysiwygSelection.getPElementInFocusNode().appendChild(oIframe);
997
+ editor.insertNode(oIframe);
998
+ editor.appendP(oIframe);
999
+
1000
+ context.dialog.videoInputUrl.value = "";
1001
+ context.dialog.video_x.value = context.user.videoX;
1002
+ context.dialog.video_y.value = context.user.videoY;
1003
+
1004
+ break;
1005
+ }
1006
+ }catch(e) {
1007
+ editor.closeLoding();
1008
+ return false;
1009
+ }
1010
+
1011
+ editor.closeLoding();
1012
+ return false;
1013
+ };
1014
+
1015
+ /** ́´ë²¤íЏ 등록 */
1016
+ window.onresize = function(){resize_window()};
1017
+ context.tool.bar.addEventListener("click", onClick_toolbar);
1018
+ context.dialog.modal.addEventListener("click", onClick_dialog);
1019
+ context.element.imageResizeBtn.addEventListener('click', onClick_imageResizeBtn);
1020
+ context.element.wysiwygWindow.addEventListener("keydown", onKeyDown_wysiwyg);
1021
+ context.dialog.imgInputFile.addEventListener("change", onChange_imgInput);
1022
+ context.element.wysiwygWindow.addEventListener('scroll', onScroll_wysiwyg);
1023
+ context.tool.tablePicker.addEventListener('mousemove', onMouseMove_tablePicker);
1024
+ context.element.resizebar.addEventListener("mousedown", onMouseDown_resizeBar);
1025
+ context.element.imageResizeController.addEventListener('mousedown', onMouseDown_image_ctrl);
1026
+ context.element.wysiwygWindow.addEventListener("mousedown", onMouseDown_wysiwyg);
1027
+ context.element.wysiwygWindow.document.addEventListener("selectionchange", onSelectionChange_wysiwyg);
1028
+ for(var i=0; i<context.dialog.forms.length; i++) {
1029
+ context.dialog.forms[i].getElementsByClassName("btn-primary")[0].addEventListener("click", dialog_submit);
1030
+ };
1031
+
1032
+ return {
1033
+ cancel_resize_image : cancel_resize_image
1034
+ };
1035
+ })();
1036
+
1037
+ /**
1038
+ * user func
1039
+ * @type {{save, getContent, setContent, appendContent, disabled, enabled, show, hide}}
1040
+ */
1041
+ var user = (function() {
1042
+ return {
1043
+ save : function() {
1044
+ if(context.argument._wysiwygActive) {
1045
+ context.element.textElement.innerHTML = context.element.wysiwygWindow.document.body.innerHTML;
1046
+ } else {
1047
+ context.element.textElement.innerHTML = context.element.source.value;
1048
+ }
1049
+ },
1050
+
1051
+ getContent : function() {
1052
+ var content = "";
1053
+ if(context.argument._wysiwygActive) {
1054
+ content = context.element.wysiwygWindow.document.body.innerHTML;
1055
+ } else {
1056
+ content = context.element.source.value;
1057
+ }
1058
+ return content;
1059
+ },
1060
+
1061
+ setContent : function(content) {
1062
+ if(context.argument._wysiwygActive) {
1063
+ context.element.wysiwygWindow.document.body.innerHTML = content;
1064
+ } else {
1065
+ context.element.source.value = content;
1066
+ }
1067
+ },
1068
+
1069
+ appendContent : function(content) {
1070
+ if(context.argument._wysiwygActive) {
1071
+ context.element.wysiwygWindow.document.body.innerHTML += content;
1072
+ } else {
1073
+ context.element.source.value += content;
1074
+ }
1075
+ },
1076
+
1077
+ disabled : function() {
1078
+ context.tool.cover.style.display = "block";
1079
+ context.element.wysiwygWindow.document.body.setAttribute("contenteditable", false);
1080
+ },
1081
+
1082
+ enabled : function() {
1083
+ context.tool.cover.style.display = "none";
1084
+ context.element.wysiwygWindow.document.body.setAttribute("contenteditable", true);
1085
+ },
1086
+
1087
+ show : function() {
1088
+ context.element.topArea.style.cssText = context.argument._originCssText;
1089
+ },
1090
+
1091
+ hide : function() {
1092
+ context.element.topArea.style.display = "none";
1093
+ }
1094
+ };
1095
+ })();
1096
+
1097
+ return {
1098
+ save : user.save,
1099
+ getContent : user.getContent,
1100
+ setContent : user.setContent,
1101
+ appendContent : user.appendContent,
1102
+ disabled : user.disabled,
1103
+ enabled : user.enabled,
1104
+ show : user.show,
1105
+ hide : user.hide
1106
+ }
1107
+ };
1108
+
1109
+ var createEditor = function (options){
1110
+ var lang = SUNEDITOR.lang? SUNEDITOR.lang: SUNEDITOR.defaultLang;
1111
+
1112
+ var toolBar = function() {
1113
+ var html = '<div class="sun-editor-id-toolbar-cover"></div>'+
1114
+ /** 글꼴, 포멧 */
1115
+ '<div class="tool_module">'+
1116
+ ' <ul class="editor_tool">';
1117
+ if(options.showFont) {
1118
+ html += ''+
1119
+ ' <li class="compact_editor">'+
1120
+ ' <button type="button" class="btn_editor btn_font" title="'+lang.toolbar.fontFamily+'" data-display="sub">'+
1121
+ ' <span class="txt sun-editor-font-family">'+lang.toolbar.fontFamily+'</span><span class="img_editor ico_more"></span>'+
1122
+ ' </button>'+
1123
+ ' <div class="layer_editor" style="display: none;">'+
1124
+ ' <div class="inner_layer list_family">'+
1125
+ ' <ul class="list_editor sun-editor-list-font-family">'+
1126
+ ' <li><button type="button" class="btn_edit default" data-command="fontName" data-value="inherit" data-txt="'+lang.toolbar.fontFamily+'" style="font-family:inherit;">'+lang.toolbar.fontFamilyDelete+'</button></li>'+
1127
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Arial" data-txt="Arial" style="font-family:Arial;">Arial</button></li>'+
1128
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Comic Sans MS" data-txt="Comic Sans MS" style="font-family:Comic Sans MS;">Comic Sans MS</button></li>'+
1129
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Courier New,Courier" data-txt="Courier New" style="font-family:Courier New,Courier;">Courier New</button></li>'+
1130
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Georgia" data-txt="Georgia" style="font-family:Georgia;">Georgia</button></li>'+
1131
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="tahoma" data-txt="tahoma" style="font-family:tahoma;">Tahoma</button></li>'+
1132
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Trebuchet MS,Helvetica" data-txt="Trebuchet MS" style="font-family:Trebuchet MS,Helvetica;">Trebuchet MS</button></li>'+
1133
+ ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="Verdana" data-txt="Verdana" style="font-family:Verdana;">Verdana</button></li>'+
1134
+ ' </ul>';
1135
+ /** ́‚¬́š©́ž ́¶”ê°€ 글꼴 */
1136
+ if(options.addFont) {
1137
+ html += ' <ul class="list_editor list_family_add sun-editor-list-font-family-add">';
1138
+ for (var i = 0; i < options.addFont.length; i++) {
1139
+ var font = options.addFont[i];
1140
+ html += ' <li><button type="button" class="btn_edit" data-command="fontName" data-value="'+font.value+'" data-txt="'+font.text+'" style="font-family:'+font.value+'">'+font.text+'</button></li>';
1141
+ }
1142
+ html += ' </ul>';
1143
+ }
1144
+
1145
+ html += ' </div>'+
1146
+ ' </div>'+
1147
+ ' </li>';
1148
+ }
1149
+ if(options.showFormats) {
1150
+ html += ''+
1151
+ ' <li class="compact_editor">'+
1152
+ ' <button type="button" class="btn_editor btn_size" title="'+lang.toolbar.formats+'" data-display="sub">'+
1153
+ ' <span class="txt">'+lang.toolbar.formats+'</span><span class="img_editor ico_more"></span>'+
1154
+ ' </button>'+
1155
+ ' <div class="layer_editor layer_size">'+
1156
+ ' <div class="inner_layer">'+
1157
+ ' <ul class="list_editor font_size_list">'+
1158
+ ' <li><button type="button" class="btn_edit" style="height:30px;" data-command="format" data-value="P"><p style="font-size:13pt;">nomal</p></button></li>'+
1159
+ ' <li><button type="button" class="btn_edit" style="height:45px;" data-command="format" data-value="h1"><h1>Header 1</h1></button></li>'+
1160
+ ' <li><button type="button" class="btn_edit" style="height:34px;" data-command="format" data-value="h2"><h2>Header 2</h2></button></li>'+
1161
+ ' <li><button type="button" class="btn_edit" style="height:26px;" data-command="format" data-value="h3"><h3>Header 3</h3></button></li>'+
1162
+ ' <li><button type="button" class="btn_edit" style="height:23px;" data-command="format" data-value="h4"><h4>Header 4</h4></button></li>'+
1163
+ ' <li><button type="button" class="btn_edit" style="height:19px;" data-command="format" data-value="h5"><h5>Header 5</h5></button></li>'+
1164
+ ' <li><button type="button" class="btn_edit" style="height:15px;" data-command="format" data-value="h6"><h6>Header 6</h6></button></li>'+
1165
+ ' </ul>'+
1166
+ ' </div>'+
1167
+ ' </div>'+
1168
+ ' </li>' ;
1169
+ }
1170
+ html += '</ul>'+
1171
+ '</div>'+
1172
+ /** 굵게, ë°‘́¤„ 등 */
1173
+ '<div class="tool_module">'+
1174
+ ' <ul class="editor_tool">';
1175
+ if(options.showBold) {
1176
+ html += ''+
1177
+ ' <li class="compact_editor">'+
1178
+ ' <button type="button" class="btn_editor sun-editor-id-bold" title="'+lang.toolbar.bold+' (Ctrl+B)" data-command="bold"><div class="ico_bold"></div></button>'+
1179
+ ' </li>';
1180
+ }
1181
+ if(options.showUnderline) {
1182
+ html += ''+
1183
+ ' <li class="compact_editor">'+
1184
+ ' <button type="button" class="btn_editor sun-editor-id-underline" title="'+lang.toolbar.underline+' (Ctrl+U)" data-command="underline"><div class="ico_underline"></div></button>'+
1185
+ ' </li>';
1186
+ }
1187
+ if(options.showItalic) {
1188
+ html += ''+
1189
+ ' <li>'+
1190
+ ' <button type="button" class="btn_editor sun-editor-id-italic" title="'+lang.toolbar.italic+' (Ctrl+I)" data-command="italic"><div class="ico_italic"></div></button>'+
1191
+ ' </li>';
1192
+ }
1193
+ if(options.showStrike) {
1194
+ html += ''+
1195
+ ' <li>'+
1196
+ ' <button type="button" class="btn_editor sun-editor-id-strike" title="'+lang.toolbar.strike+' (Ctrl+D)" data-command="strikethrough"><div class="ico_strike"></div></button>'+
1197
+ ' </li>';
1198
+ }
1199
+ html +='</ul>'+
1200
+ '</div>'+
1201
+ /** ́ƒ‰́ƒ ́„ 택 */
1202
+ '<div class="tool_module">'+
1203
+ ' <ul class="editor_tool">';
1204
+ if(options.showFontColor) {
1205
+ html += ''+
1206
+ ' <li class="compact_editor">'+
1207
+ ' <div class="box_color" data-display="sub">'+
1208
+ ' <strong class="screen_out">'+lang.toolbar.fontColor+'</strong>'+
1209
+ ' <button type="button" class="btn_editor" title="'+lang.toolbar.fontColor+'">'+
1210
+ ' <div class="ico_fcolor">'+
1211
+ ' <em class="color_font" style="background-color:#1f92fe"></em>'+
1212
+ ' </div>'+
1213
+ ' </button>'+
1214
+ ' </div>'+
1215
+ ' <div class="layer_editor layer_color" data-command="foreColor">'+
1216
+ ' <div class="inner_layer">'+
1217
+ ' <div class="pallet_bgcolor">'+
1218
+ ' <ul class="list_color list_bgcolor">'+
1219
+ ' <li><button type="button" class="btn_color color_ff0000" style="background-color:#ff0000;">#ff0000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1220
+ ' <li><button type="button" class="btn_color color_ff5e00" style="background-color:#ff5e00;">#ff5e00<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1221
+ ' <li><button type="button" class="btn_color color_ffe400" style="background-color:#ffe400;">#ffe400<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1222
+ ' <li><button type="button" class="btn_color color_abf200" style="background-color:#abf200;">#abf200<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1223
+ ' <li><button type="button" class="btn_color color_00d8ff" style="background-color:#00d8ff;">#00d8ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1224
+ ' <li><button type="button" class="btn_color color_0055ff" style="background-color:#0055ff;">#0055ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1225
+ ' <li><button type="button" class="btn_color color_6600ff" style="background-color:#6600ff;">#6600ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1226
+ ' <li><button type="button" class="btn_color color_ff00dd" style="background-color:#ff00dd;">#ff00dd<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1227
+ ' <li><button type="button" class="btn_color color_000000" style="background-color:#000000;">#000000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1228
+ ' <li><button type="button" class="btn_color color_ffd8d8" style="background-color:#ffd8d8;">#ffd8d8<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1229
+ ' <li><button type="button" class="btn_color color_fae0d4" style="background-color:#fae0d4;">#fae0d4<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1230
+ ' <li><button type="button" class="btn_color color_faf4c0" style="background-color:#faf4c0;">#faf4c0<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1231
+ ' <li><button type="button" class="btn_color color_e4f7ba" style="background-color:#e4f7ba;">#e4f7ba<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1232
+ ' <li><button type="button" class="btn_color color_d4f4fa" style="background-color:#d4f4fa;">#d4f4fa<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1233
+ ' <li><button type="button" class="btn_color color_d9e5ff" style="background-color:#d9e5ff;">#d9e5ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1234
+ ' <li><button type="button" class="btn_color color_e8d9ff" style="background-color:#e8d9ff;">#e8d9ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1235
+ ' <li><button type="button" class="btn_color color_ffd9fa" style="background-color:#ffd9fa;">#ffd9fa<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1236
+ ' <li><button type="button" class="btn_color color_ffffff color_white" style="background-color:#ffffff;">#ffffff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1237
+ ' <li><button type="button" class="btn_color color_ffa7a7" style="background-color:#ffa7a7;">#ffa7a7<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1238
+ ' <li><button type="button" class="btn_color color_ffc19e" style="background-color:#ffc19e;">#ffc19e<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1239
+ ' <li><button type="button" class="btn_color color_faed7d" style="background-color:#faed7d;">#faed7d<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1240
+ ' <li><button type="button" class="btn_color color_cef279" style="background-color:#cef279;">#cef279<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1241
+ ' <li><button type="button" class="btn_color color_b2ebf4" style="background-color:#b2ebf4;">#b2ebf4<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1242
+ ' <li><button type="button" class="btn_color color_b2ccff" style="background-color:#b2ccff;">#b2ccff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1243
+ ' <li><button type="button" class="btn_color color_d1b2ff" style="background-color:#d1b2ff;">#d1b2ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1244
+ ' <li><button type="button" class="btn_color color_ffb2f5" style="background-color:#ffb2f5;">#ffb2f5<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1245
+ ' <li><button type="button" class="btn_color color_bdbdbd" style="background-color:#bdbdbd;">#bdbdbd<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1246
+ ' <li><button type="button" class="btn_color color_f15f5f" style="background-color:#f15f5f;">#f15f5f<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1247
+ ' <li><button type="button" class="btn_color color_f29661" style="background-color:#f29661;">#f29661<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1248
+ ' <li><button type="button" class="btn_color color_e5d85c" style="background-color:#e5d85c;">#e5d85c<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1249
+ ' <li><button type="button" class="btn_color color_bce55c" style="background-color:#bce55c;">#bce55c<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1250
+ ' <li><button type="button" class="btn_color color_5cd1e5" style="background-color:#5cd1e5;">#5cd1e5<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1251
+ ' <li><button type="button" class="btn_color color_6699ff" style="background-color:#6699ff;">#6699ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1252
+ ' <li><button type="button" class="btn_color color_a366ff" style="background-color:#a366ff;">#a366ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1253
+ ' <li><button type="button" class="btn_color color_f261df" style="background-color:#f261df;">#f261df<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1254
+ ' <li><button type="button" class="btn_color color_8c8c8c" style="background-color:#8c8c8c;">#8c8c8c<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1255
+ ' <li><button type="button" class="btn_color color_980000" style="background-color:#980000;">#980000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1256
+ ' <li><button type="button" class="btn_color color_993800" style="background-color:#993800;">#993800<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1257
+ ' <li><button type="button" class="btn_color color_998a00" style="background-color:#998a00;">#998a00<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1258
+ ' <li><button type="button" class="btn_color color_6b9900" style="background-color:#6b9900;">#6b9900<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1259
+ ' <li><button type="button" class="btn_color color_008299" style="background-color:#008299;">#008299<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1260
+ ' <li><button type="button" class="btn_color color_003399" style="background-color:#003399;">#003399<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1261
+ ' <li><button type="button" class="btn_color color_3d0099" style="background-color:#3d0099;">#3d0099<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1262
+ ' <li><button type="button" class="btn_color color_990085" style="background-color:#990085;">#990085<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1263
+ ' <li><button type="button" class="btn_color color_353535" style="background-color:#353535;">#353535<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1264
+ ' <li><button type="button" class="btn_color color_670000" style="background-color:#670000;">#670000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1265
+ ' <li><button type="button" class="btn_color color_662500" style="background-color:#662500;">#662500<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1266
+ ' <li><button type="button" class="btn_color color_665c00" style="background-color:#665c00;">#665c00<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1267
+ ' <li><button type="button" class="btn_color color_476600" style="background-color:#476600;">#476600<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1268
+ ' <li><button type="button" class="btn_color color_005766" style="background-color:#005766;">#005766<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1269
+ ' <li><button type="button" class="btn_color color_002266" style="background-color:#002266;">#002266<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1270
+ ' <li><button type="button" class="btn_color color_290066" style="background-color:#290066;">#290066<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1271
+ ' <li><button type="button" class="btn_color color_660058" style="background-color:#660058;">#660058<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1272
+ ' <li class="compact_color"><button type="button" class="btn_color" style="background-color:#222222;">#222222<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1273
+ ' </ul>'+
1274
+ ' </div>'+
1275
+ ' </div>'+
1276
+ ' </div>'+
1277
+ ' </li>';
1278
+ }
1279
+ if(options.showHiliteColor) {
1280
+ html += ''+
1281
+ ' <li>'+
1282
+ ' <strong class="screen_out">'+lang.toolbar.hiliteColor+'</strong>'+
1283
+ ' <button type="button" class="btn_editor btn_fbgcolor" title="'+lang.toolbar.hiliteColor+'" data-display="sub">'+
1284
+ ' <div class="img_editor ico_fcolor_w">'+
1285
+ ' <em class="color_font" style="background-color:#1f92fe"></em>'+
1286
+ ' </div>'+
1287
+ ' </button>'+
1288
+ ' <div class="layer_editor layer_color" data-command="hiliteColor">'+
1289
+ ' <div class="inner_layer">'+
1290
+ ' <div class="pallet_bgcolor pallet_text">'+
1291
+ ' <ul class="list_color list_bgcolor">'+
1292
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#1e9af9;">#1e9af9<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1293
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#00b8c6;">#00b8c6<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1294
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#6cce02;">#6cce02<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1295
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#ff9702;">#ff9702<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1296
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#ff0000;">#ff0000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1297
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#ff00dd;">#ff00dd<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1298
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#6600ff;">#6600ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1299
+ ' <li><button type="button" class="btn_color" style="color:#000;background-color:#cce9ff;">#cce9ff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1300
+ ' <li><button type="button" class="btn_color" style="color:#000;background-color:#fcfd4c;">#fcfd4c<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1301
+ ' <li><button type="button" class="btn_color color_white" style="color:#000;background-color:#ffffff;">#ffffff<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1302
+ ' <li><button type="button" class="btn_color" style="color:#000;background-color:#dfdede;">#dfdede<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1303
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#8c8c8c;">#8c8c8c<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1304
+ ' <li><button type="button" class="btn_color" style="color:#fff;background-color:#000000;">#000000<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1305
+ ' <li class="compact_color"><button type="button" class="btn_color" style="background-color:#222222;">#222222<span class="bg_check"></span><span class="bg_btnframe"></span></button></li>'+
1306
+ ' </ul>'+
1307
+ ' </div>'+
1308
+ ' </div>'+
1309
+ ' </div>'+
1310
+ ' </li>';
1311
+ }
1312
+ html +='</ul>'+
1313
+ '</div>';
1314
+ /** 들́—¬́“°ê¸°, ë‚´́–´́“°ê¸° */
1315
+ if(options.showInOutDent) {
1316
+ html += ''+
1317
+ '<div class="tool_module">'+
1318
+ ' <ul class="editor_tool">'+
1319
+ ' <li>'+
1320
+ ' <button type="button" class="btn_editor" title="'+lang.toolbar.indent+'" data-command="indent">'+
1321
+ ' <div class="img_editor ico_indnet"></div>'+
1322
+ ' </button>'+
1323
+ ' </li>'+
1324
+ ' <li>'+
1325
+ ' <button type="button" class="btn_editor" title="'+lang.toolbar.outdent+'" data-command="outdent">'+
1326
+ ' <div class="img_editor ico_outdent"></div>'+
1327
+ ' </button>'+
1328
+ ' </li>'+
1329
+ ' </ul>'+
1330
+ '</div>';
1331
+ }
1332
+ /** ́ •ë ¬, 구분́„ ́ƒ́ž */
1333
+ html += '<div class="tool_module">'+
1334
+ ' <ul class="editor_tool">';
1335
+ if(options.showAlign) {
1336
+ html += ''+
1337
+ ' <li>'+
1338
+ ' <strong class="screen_out">'+lang.toolbar.align+'</strong>'+
1339
+ ' <button type="button" class="btn_editor btn_align" title="'+lang.toolbar.align+'" data-display="sub">'+
1340
+ ' <span class="img_editor ico_align_l">'+lang.toolbar.alignLeft+'</span>'+
1341
+ ' </button>'+
1342
+ ' <div class="layer_editor layer_align">'+
1343
+ ' <div class="inner_layer inner_layer_type2">'+
1344
+ ' <ul class="list_editor">'+
1345
+ ' <li><button type="button" class="btn_edit btn_align" data-command="justifyleft" title="'+lang.toolbar.alignLeft+'"><span class="img_editor ico_align_l"></span>'+lang.toolbar.left+'</button></li>'+
1346
+ ' <li><button type="button" class="btn_edit btn_align" data-command="justifycenter" title="'+lang.toolbar.alignCenter+'"><span class="img_editor ico_align_c"></span>'+lang.toolbar.center+'</button></li>'+
1347
+ ' <li><button type="button" class="btn_edit btn_align" data-command="justifyright" title="'+lang.toolbar.alignRight+'"><span class="img_editor ico_align_r"></span>'+lang.toolbar.right+'</button></li>'+
1348
+ ' <li><button type="button" class="btn_edit btn_align" data-command="justifyfull" title="'+lang.toolbar.justifyFull+'"><span class="img_editor ico_align_f"></span>'+lang.toolbar.bothSide+'</button></li>'+
1349
+ ' </ul>'+
1350
+ ' </div>'+
1351
+ ' </div>'+
1352
+ ' </li>';
1353
+ }
1354
+ if(options.showList) {
1355
+ html += ''+
1356
+ ' <li>'+
1357
+ ' <button type="button" class="btn_editor" title="'+lang.toolbar.list+'" data-display="sub">'+
1358
+ ' <div class="img_editor ico_list ico_list_num"></div>'+
1359
+ ' </button>'+
1360
+ ' <div class="layer_editor layer_list">'+
1361
+ ' <div class="inner_layer inner_layer_type2">'+
1362
+ ' <ul class="list_editor">'+
1363
+ ' <li><button type="button" class="btn_edit" data-command="insertOrderedList" data-value="DECIMAL" title="'+lang.toolbar.orderList+'"><span class="img_editor ico_list ico_list_num"></span></button></li>'+
1364
+ ' <li><button type="button" class="btn_edit" data-command="insertUnorderedList" data-value="DISC" title="'+lang.toolbar.unorderList+'"><span class="img_editor ico_list ico_list_square"></span></button></li>'+
1365
+ ' </ul>'+
1366
+ ' </div>'+
1367
+ ' </div>'+
1368
+ ' </li>';
1369
+ }
1370
+ if(options.showLine) {
1371
+ html += ''+
1372
+ ' <li>'+
1373
+ ' <strong class="screen_out">'+lang.toolbar.line+'</strong>'+
1374
+ ' <button type="button" class="btn_editor btn_line" title="'+lang.toolbar.line+'" data-display="sub">'+
1375
+ ' <hr style="border-width: 1px 0px 0px; border-style: solid none none; border-color: black; border-image: initial; height: 1px;">'+
1376
+ ' <hr style="border-width: 1px 0px 0px; border-style: dotted none none; border-color: black; border-image: initial; height: 1px;">'+
1377
+ ' <hr style="border-width: 1px 0px 0px; border-style: dashed none none; border-color: black; border-image: initial; height: 1px;">'+
1378
+ ' </button>'+
1379
+ ' <div class="layer_editor layer_line">'+
1380
+ ' <div class="inner_layer inner_layer_type2">'+
1381
+ ' <ul class="list_editor">'+
1382
+ ' <li><button type="button" class="btn_edit btn_line" data-command="horizontalRules" data-value="hr1">'+
1383
+ ' <hr style="border-width: 1px 0px 0px; border-style: solid none none; border-color: black; border-image: initial; height: 1px;">'+
1384
+ ' </button>'+
1385
+ ' </li>'+
1386
+ ' <li>'+
1387
+ ' <button type="button" class="btn_edit btn_line" data-command="horizontalRules" data-value="hr2">'+
1388
+ ' <hr style="border-width: 1px 0px 0px; border-style: dotted none none; border-color: black; border-image: initial; height: 1px;">'+
1389
+ ' </button>'+
1390
+ ' </li>'+
1391
+ ' <li>'+
1392
+ ' <button type="button" class="btn_edit btn_line" data-command="horizontalRules" data-value="hr3">'+
1393
+ ' <hr style="border-width: 1px 0px 0px; border-style: dashed none none; border-color: black; border-image: initial; height: 1px;">'+
1394
+ ' </button>'+
1395
+ ' </li>'+
1396
+ ' </ul>'+
1397
+ ' </div>'+
1398
+ ' </div>'+
1399
+ ' </li>';
1400
+ }
1401
+ html +='</ul>'+
1402
+ '</div>'+
1403
+ /** í…Œ́´ë¸”, 링크, ́‚¬́§„ */
1404
+ '<div class="tool_module">'+
1405
+ ' <ul class="editor_tool">';
1406
+ if(options.showTable) {
1407
+ html += ''+
1408
+ ' <li>'+
1409
+ ' <button class="btn_editor" title="'+lang.toolbar.table+'" data-display="sub" data-command="table">'+
1410
+ ' <div class="img_editor ico_table"></div>'+
1411
+ ' </button>'+
1412
+ ' <div class="table-content" style="display: none;">'+
1413
+ ' <div class="table-data-form">'+
1414
+ ' <div class="table-picker sun-editor-id-table-picker" data-command="insertTable" data-value="1x1"></div>'+
1415
+ ' <div class="table-highlighted sun-editor-id-table-highlighted"></div>'+
1416
+ ' <div class="table-unhighlighted sun-editor-id-table-unhighlighted"></div>'+
1417
+ ' </div>'+
1418
+ ' <div class="table-display sun-editor-table-display">1 x 1</div>'+
1419
+ ' </div>'+
1420
+ ' </li>';
1421
+ }
1422
+ if(options.showLink) {
1423
+ html += ''+
1424
+ ' <li>'+
1425
+ ' <button class="btn_editor" title="'+lang.toolbar.link+'" data-display="modal" data-command="link">'+
1426
+ ' <div class="img_editor ico_url"></div>'+
1427
+ ' </button>'+
1428
+ ' </li>';
1429
+ }
1430
+ if(options.showImage) {
1431
+ html += ''+
1432
+ ' <li>'+
1433
+ ' <button class="btn_editor" title="'+lang.toolbar.image+'" data-display="modal" data-command="image">'+
1434
+ ' <div class="img_editor ico_picture"></div>'+
1435
+ ' </button>'+
1436
+ ' </li>';
1437
+ }
1438
+ html += '</ul>'+
1439
+ '</div>'+
1440
+ /** 동́˜́ƒ, ́ „́²´í™”ë©´, ́†Œ́Š¤íŽ¸́§‘ */
1441
+ '<div class="tool_module">'+
1442
+ ' <ul class="editor_tool">';
1443
+ if(options.showVideo) {
1444
+ html += ''+
1445
+ ' <li>'+
1446
+ ' <button class="btn_editor" title="'+lang.toolbar.video+'" data-display="modal" data-command="video">'+
1447
+ ' <div class="img_editor ico_video"></div>'+
1448
+ ' </button>'+
1449
+ ' </li>';
1450
+ }
1451
+ if(options.showFullScreen) {
1452
+ html += ''+
1453
+ ' <li>'+
1454
+ ' <button class="btn_editor" title="'+lang.toolbar.fullScreen+'" data-command="fullScreen">'+
1455
+ ' <div class="img_editor ico_full_screen_e"></div>'+
1456
+ ' </button>'+
1457
+ ' </li>';
1458
+ }
1459
+ if(options.showCodeView) {
1460
+ html += ''+
1461
+ ' <li>'+
1462
+ ' <button class="btn_editor" title="'+lang.toolbar.htmlEditor+'" data-command="sorceFrame">'+
1463
+ ' <div class="img_editor ico_html"></div>'+
1464
+ ' </button>'+
1465
+ ' </li>';
1466
+ }
1467
+ html += '</ul>'+
1468
+ '</div>'+
1469
+ '';
1470
+
1471
+ return html;
1472
+ };
1473
+
1474
+ var dialogBox = function() {
1475
+ var html = ''+
1476
+ /** 다́´́–¼ë¡œê·¸ 백그라́š´ë“œ */
1477
+ '<div class="modal-dialog-background sun-editor-id-dialog-back" style="display: none;"></div>'+
1478
+ /** 다́´́–¼ë¡œê·¸ */
1479
+ '<div class="modal-dialog sun-editor-id-dialog-modal" style="display: none;">';
1480
+ /** 링크 ́‚½́ž… 다́´́–¼ë¡œê·¸ */
1481
+ html += ''+
1482
+ ' <div class="modal-content sun-editor-id-dialog-link" style="display: none;">'+
1483
+ ' <form class="editor_link">'+
1484
+ ' <div class="modal-header">'+
1485
+ ' <button type="button" data-command="close" class="close" aria-label="Close">'+
1486
+ ' <span aria-hidden="true" data-command="close">Ă—</span>'+
1487
+ ' </button>'+
1488
+ ' <h5 class="modal-title">'+lang.dialogBox.linkBox.title+'</h5>'+
1489
+ ' </div>'+
1490
+ ' <div class="modal-body">'+
1491
+ ' <div class="form-group">'+
1492
+ ' <label>'+lang.dialogBox.linkBox.url+'</label>'+
1493
+ ' <input class="form-control sun-editor-id-linkurl" type="text">'+
1494
+ ' </div>'+
1495
+ ' <div class="form-group">'+
1496
+ ' <label>'+lang.dialogBox.linkBox.text+'</label><input class="form-control sun-editor-id-linktext" type="text">'+
1497
+ ' </div>'+
1498
+ ' </div>'+
1499
+ ' <div class="modal-footer">'+
1500
+ ' <button type="submit" class="btn btn-primary sun-editor-id-submit-link"><span>'+lang.dialogBox.submitButton+'</span></button>'+
1501
+ ' </div>'+
1502
+ ' </form>'+
1503
+ ' </div>';
1504
+ /** ́´ë¯¸́§€ ́‚½́ž… 다́´́–¼ë¡œê·¸ */
1505
+ html += ''+
1506
+ ' <div class="modal-content sun-editor-id-dialog-image" style="display: none;">'+
1507
+ ' <form class="editor_image" method="post" enctype="multipart/form-data">'+
1508
+ ' <div class="modal-header">'+
1509
+ ' <button type="button" data-command="close" class="close" aria-label="Close">'+
1510
+ ' <span aria-hidden="true" data-command="close">Ă—</span>'+
1511
+ ' </button>'+
1512
+ ' <h5 class="modal-title">'+lang.dialogBox.imageBox.title+'</h5>'+
1513
+ ' </div>'+
1514
+ ' <div class="modal-body">'+
1515
+ ' <div class="form-group">'+
1516
+ ' <label>'+lang.dialogBox.imageBox.file+'</label>'+
1517
+ ' <input class="form-control sun-editor-id-image-file" type="file" accept="image/*" multiple="multiple">'+
1518
+ ' </div>'+
1519
+ ' <div class="form-group">'+
1520
+ ' <label>'+lang.dialogBox.imageBox.url+'</label><input class="form-control sun-editor-id-image-url" type="text">'+
1521
+ ' </div>'+
1522
+ ' </div>'+
1523
+ ' <div class="modal-footer">'+
1524
+ ' <button type="submit" class="btn btn-primary sun-editor-id-submit-image"><span>'+lang.dialogBox.submitButton+'</span></button>'+
1525
+ ' </div>'+
1526
+ ' </form>'+
1527
+ ' </div>';
1528
+ /** 동́˜́ƒ ́‚½́ž… 다́´́–¼ë¡œê·¸ */
1529
+ html += ''+
1530
+ ' <div class="modal-content sun-editor-id-dialog-video" style="display: none;">'+
1531
+ ' <form class="editor_video">'+
1532
+ ' <div class="modal-header">'+
1533
+ ' <button type="button" data-command="close" class="close" aria-label="Close">'+
1534
+ ' <span aria-hidden="true" data-command="close">Ă—</span>'+
1535
+ ' </button>'+
1536
+ ' <h5 class="modal-title">'+lang.dialogBox.videoBox.title+'</h5>'+
1537
+ ' </div>'+
1538
+ ' <div class="modal-body">'+
1539
+ ' <div class="form-group">'+
1540
+ ' <label>'+lang.dialogBox.videoBox.url+'</label>'+
1541
+ ' <input class="form-control sun-editor-id-video-url" type="text">'+
1542
+ ' </div>'+
1543
+ ' <div class="form-group form-size">'+
1544
+ ' <div class="size-text"><label class="size-w">'+lang.dialogBox.videoBox.width+'</label><label class="size-x"> </label><label class="size-h">'+lang.dialogBox.videoBox.height+'</label></div>'+
1545
+ ' <input type="text" class="form-size-control sun-editor-id-video-x"><label class="size-x">x</label><input type="text" class="form-size-control sun-editor-id-video-y">'+
1546
+ ' </div>'+
1547
+ ' </div>'+
1548
+ ' <div class="modal-footer">'+
1549
+ ' <button type="submit" class="btn btn-primary sun-editor-id-submit-video"><span>'+lang.dialogBox.submitButton+'</span></button>'+
1550
+ ' </div>'+
1551
+ ' </form>'+
1552
+ ' </div>';
1553
+ html +='</div>';
1554
+
1555
+ return html;
1556
+ };
1557
+
1558
+ var imgDIv = function() {
1559
+ return ''+
1560
+ '<div class="image-resize-dot tl"></div>'+
1561
+ '<div class="image-resize-dot tr"></div>'+
1562
+ '<div class="image-resize-dot bl"></div>'+
1563
+ '<div class="image-resize-dot br-controller sun-editor-img-controller"></div>'+
1564
+ '<div class="image-size-display sun-editor-id-img-display"></div>';
1565
+ };
1566
+
1567
+ var imgBtn = function() {
1568
+ return ''+
1569
+ '<div class="btn-group">'+
1570
+ ' <button type="button" data-command="100" title="'+lang.dialogBox.imageBox.resize100+'"><span class="note-fontsize-10">100%</span></button>'+
1571
+ ' <button type="button" data-command="75" title="'+lang.dialogBox.imageBox.resize75+'"><span class="note-fontsize-10">75%</span></button>'+
1572
+ ' <button type="button" data-command="50" title="'+lang.dialogBox.imageBox.resize50+'"><span class="note-fontsize-10">50%</span></button>'+
1573
+ ' <button type="button" data-command="25" title="'+lang.dialogBox.imageBox.resize25+'"><span class="note-fontsize-10">25%</span></button>'+
1574
+ '</div>'+
1575
+ '<div class="btn-group remove">'+
1576
+ ' <button type="button" data-command="remove" title="'+lang.dialogBox.imageBox.remove+'"><span class="image_remove">X</span></button>'+
1577
+ '</div>';
1578
+ };
1579
+
1580
+ return {
1581
+ toolBar : toolBar,
1582
+ dialogBox : dialogBox,
1583
+ imgDiv : imgDIv,
1584
+ imgBtn : imgBtn
1585
+ };
1586
+ };
1587
+
1588
+ /**
1589
+ * document create
1590
+ * @param element
1591
+ * @param options
1592
+ * @returns {{constructed: Element, options: *}}
1593
+ * @constructor
1594
+ */
1595
+ var Constructor = function(element, options) {
1596
+ if(!(typeof options === "object")) options = {};
1597
+
1598
+ /** ́‚¬́š©́ž ́˜µ́…˜ ́´ˆê¸°í™” */
1599
+ options.addFont = options.addFont || null;
1600
+ options.videoX = options.videoX || 560;
1601
+ options.videoY = options.videoY || 315;
1602
+ options.imageSize = options.imageSize || '350px';
1603
+ options.height = /^\d+/.test(options.height)? (/^\d+$/.test(options.height)? options.height+"px": options.height): element.clientHeight+"px";
1604
+ options.width = /^\d+/.test(options.width)? (/^\d+$/.test(options.width)? options.width+"px": options.width): (/%|auto/.test(element.style.width)? element.style.width: element.clientWidth+"px");
1605
+ /** 툴바 버튼 ë³´́´ê¸° ́„¤́ • */
1606
+ options.showFont = options.showFont !== undefined? options.showFont: true;
1607
+ options.showFormats = options.showFormats !== undefined? options.showFormats: true;
1608
+ options.showBold = options.showBold !== undefined? options.showBold: true;
1609
+ options.showUnderline = options.showUnderline !== undefined? options.showUnderline: true;
1610
+ options.showItalic = options.showItalic !== undefined? options.showItalic: true;
1611
+ options.showStrike = options.showStrike !== undefined? options.showStrike: true;
1612
+ options.showFontColor = options.showFontColor !== undefined? options.showFontColor: true;
1613
+ options.showHiliteColor = options.showHiliteColor !== undefined? options.showHiliteColor: true;
1614
+ options.showInOutDent = options.showInOutDent !== undefined? options.showInOutDent: true;
1615
+ options.showAlign = options.showAlign !== undefined? options.showAlign: true;
1616
+ options.showList = options.showList !== undefined? options.showList: true;
1617
+ options.showLine = options.showLine !== undefined? options.showLine: true;
1618
+ options.showTable = options.showTable !== undefined? options.showTable: true;
1619
+ options.showLink = options.showLink !== undefined? options.showLink: true;
1620
+ options.showImage = options.showImage !== undefined? options.showImage: true;
1621
+ options.showVideo = options.showVideo !== undefined? options.showVideo: true;
1622
+ options.showFullScreen = options.showFullScreen !== undefined? options.showFullScreen: true;
1623
+ options.showCodeView = options.showCodeView !== undefined? options.showCodeView: true;
1624
+
1625
+ /** ́µœ́ƒ́œ„ div */
1626
+ var top_div = document.createElement("DIV");
1627
+ top_div.className = "sun-editor";
1628
+ top_div.style.width = options.width;
1629
+ /** relative div */
1630
+ var relative = document.createElement("DIV");
1631
+ relative.className = "sun-editor-container";
1632
+
1633
+ /** 툴바 */
1634
+ var tool_bar = document.createElement("DIV");
1635
+ tool_bar.className = "sun-editor-id-toolbar";
1636
+ tool_bar.innerHTML = createEditor(options).toolBar();
1637
+
1638
+ /** ́—ë””í„° */
1639
+ var editor_div = document.createElement("DIV");
1640
+ editor_div.className = "sun-editor-id-editorArea";
1641
+ editor_div.style.height = options.height;
1642
+ /** iframe */
1643
+ var iframe = document.createElement("IFRAME");
1644
+ iframe.allowFullscreen = true;
1645
+ iframe.frameBorder = 0;
1646
+ iframe.className = "input_editor sun-editor-id-wysiwyg";
1647
+ iframe.style.display = "block";
1648
+ /** textarea */
1649
+ var textarea = document.createElement("TEXTAREA");
1650
+ textarea.className = "input_editor html sun-editor-id-source";
1651
+ textarea.style.display = "none";
1652
+
1653
+ /** 리́‚¬́´́¦ˆë°” */
1654
+ var resize_bar = document.createElement("DIV");
1655
+ resize_bar.className = "sun-editor-id-resizeBar";
1656
+
1657
+ /** 다́´́–¼ë¡œê·¸ */
1658
+ var dialog_div = document.createElement("DIV");
1659
+ dialog_div.className = "sun-editor-id-dialogBox";
1660
+ dialog_div.innerHTML = createEditor(options).dialogBox();
1661
+
1662
+ /** ́´ë¯¸́§€ ́¡°́ ˆ div */
1663
+ var resize_img = document.createElement("DIV");
1664
+ resize_img.className = "modal-image-resize";
1665
+ resize_img.innerHTML = createEditor(options).imgDiv();
1666
+ /** ́´ë¯¸́§€ ́¡°́ ˆ 버튼 */
1667
+ var resize_img_button = document.createElement("DIV");
1668
+ resize_img_button.className = "image-resize-btn";
1669
+ resize_img_button.innerHTML = createEditor(options).imgBtn();
1670
+
1671
+ /** 로딩 ë°•́Ф */
1672
+ var loding_box = document.createElement("DIV");
1673
+ loding_box.className = "sun-editor-id-loding";
1674
+ loding_box.innerHTML = "<div class=\"ico-loding\"></div>";
1675
+
1676
+ /** resize 동́ž‘́‹œ background */
1677
+ var resize_back = document.createElement("DIV");
1678
+ resize_back.className = "sun-editor-id-resize-background";
1679
+
1680
+ /** ́‚¬́š©́ž ́˜µ́…˜ ê°’ 넣기 */
1681
+ dialog_div.getElementsByClassName('sun-editor-id-video-x')[0].value = options.videoX;
1682
+ dialog_div.getElementsByClassName('sun-editor-id-video-y')[0].value = options.videoY;
1683
+
1684
+ /** append */
1685
+ editor_div.appendChild(iframe);
1686
+ editor_div.appendChild(textarea);
1687
+ relative.appendChild(tool_bar);
1688
+ relative.appendChild(editor_div);
1689
+ relative.appendChild(resize_bar);
1690
+ relative.appendChild(dialog_div);
1691
+ relative.appendChild(resize_back);
1692
+ relative.appendChild(resize_img);
1693
+ relative.appendChild(resize_img_button);
1694
+ relative.appendChild(loding_box);
1695
+ top_div.appendChild(relative);
1696
+
1697
+ return {
1698
+ constructed : {
1699
+ _top : top_div,
1700
+ _toolBar : tool_bar,
1701
+ _editorArea : editor_div,
1702
+ _resizeBar : resize_bar,
1703
+ _dialog : dialog_div,
1704
+ _loding : loding_box,
1705
+ _resizeImg : resize_img,
1706
+ _resizeImgBtn : resize_img_button,
1707
+ _resizeBack : resize_back
1708
+ },
1709
+ options : options
1710
+ };
1711
+ };
1712
+
1713
+ /**
1714
+ * option and module define
1715
+ * @param cons
1716
+ * @param options
1717
+ * @returns {...}
1718
+ * @constructor
1719
+ */
1720
+ var Context = function(element, cons, options) {
1721
+ /** ë‚´ë¶€ ́˜µ́…˜ê°’ ́´ˆê¸°í™” */
1722
+ options._originCssText = cons._top.style.cssText;
1723
+ options._innerHeight = cons._editorArea.clientHeight;
1724
+
1725
+ setTimeout(function(){
1726
+ cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0].contentWindow.document.head.innerHTML = ''+
1727
+ '<meta charset=\"utf-8\">' +
1728
+ '<style type=\"text/css\">' +
1729
+ ' body {margin:15px; word-break:break-all; overflow:auto; font-family:sans-serif;} p {margin:0; padding:0;} blockquote {margin-top:0; margin-bottom:0; margin-right:0;}' +
1730
+ ' table {table-layout:fixed; border:1px solid rgb(204, 204, 204); width:100%; max-width:100%; margin-bottom:20px; background-color:transparent; border-spacing:0px; border-collapse:collapse;}'+
1731
+ ' table tr {border:1px solid #ccc;}'+
1732
+ ' table tr td {border:1px solid #ccc; padding:8px;}'+
1733
+ '</style>';
1734
+ cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0].contentWindow.document.body.setAttribute("contenteditable", true);
1735
+ if(element.value.length > 0) {
1736
+ cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0].contentWindow.document.body.innerHTML = '<p>'+element.value+'</p>';
1737
+ } else {
1738
+ cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0].contentWindow.document.body.innerHTML = '<p>&#65279</p>';
1739
+ }
1740
+ }, 0);
1741
+
1742
+ return {
1743
+ argument : {
1744
+ _copySelection : null,
1745
+ _selectionNode : null,
1746
+ _imageFileSrc : null,
1747
+ _imageElement : null,
1748
+ _imageElement_w : 0,
1749
+ _imageElement_h : 0,
1750
+ _imageElement_l : 0,
1751
+ _imageElement_t : 0,
1752
+ _imageResize_parent_t : 0,
1753
+ _imageResize_parent_l : 0,
1754
+ _wysiwygActive : true,
1755
+ _isFullScreen : false,
1756
+ _innerHeight_fullScreen : 0,
1757
+ _tableXY : [],
1758
+ _resizeClientY : 0,
1759
+ _originCssText : options._originCssText,
1760
+ _innerHeight : options._innerHeight,
1761
+ _windowHeight : window.innerHeight
1762
+ },
1763
+ element : {
1764
+ textElement: element,
1765
+ topArea: cons._top,
1766
+ resizebar: cons._resizeBar,
1767
+ editorArea: cons._editorArea,
1768
+ wysiwygWindow: cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0].contentWindow,
1769
+ wysiwygElement: cons._editorArea.getElementsByClassName('sun-editor-id-wysiwyg')[0],
1770
+ source: cons._editorArea.getElementsByClassName('sun-editor-id-source')[0],
1771
+ loding : cons._loding,
1772
+ imageResizeDiv : cons._resizeImg,
1773
+ imageResizeController : cons._resizeImg.getElementsByClassName('sun-editor-img-controller')[0],
1774
+ imageResizeDisplay : cons._resizeImg.getElementsByClassName('sun-editor-id-img-display')[0],
1775
+ imageResizeBtn : cons._resizeImgBtn,
1776
+ resizeBackground : cons._resizeBack
1777
+ },
1778
+ tool : {
1779
+ bar : cons._toolBar,
1780
+ barHeight : cons._toolBar.offsetHeight,
1781
+ cover : cons._toolBar.getElementsByClassName('sun-editor-id-toolbar-cover')[0],
1782
+ bold : cons._toolBar.getElementsByClassName('sun-editor-id-bold')[0],
1783
+ underline : cons._toolBar.getElementsByClassName('sun-editor-id-underline')[0],
1784
+ italic : cons._toolBar.getElementsByClassName('sun-editor-id-italic')[0],
1785
+ strike : cons._toolBar.getElementsByClassName('sun-editor-id-strike')[0],
1786
+ tablePicker : cons._toolBar.getElementsByClassName('sun-editor-id-table-picker')[0],
1787
+ tableHighlight : cons._toolBar.getElementsByClassName('sun-editor-id-table-highlighted')[0],
1788
+ tableUnHighlight : cons._toolBar.getElementsByClassName('sun-editor-id-table-unhighlighted')[0],
1789
+ tableDisplay : cons._toolBar.getElementsByClassName('sun-editor-table-display')[0],
1790
+ fontFamily : cons._toolBar.getElementsByClassName('sun-editor-font-family')[0],
1791
+ default_fontFamily : cons._toolBar.getElementsByClassName('sun-editor-font-family')[0].textContent,
1792
+ list_fontFamily : cons._toolBar.getElementsByClassName('sun-editor-list-font-family')[0],
1793
+ list_fontFamily_add : cons._toolBar.getElementsByClassName('sun-editor-list-font-family-add')[0]
1794
+ },
1795
+ dialog : {
1796
+ modalArea : cons._dialog,
1797
+ back : cons._dialog.getElementsByClassName('sun-editor-id-dialog-back')[0],
1798
+ modal : cons._dialog.getElementsByClassName('sun-editor-id-dialog-modal')[0],
1799
+ forms : cons._dialog.getElementsByTagName('FORM'),
1800
+ link : cons._dialog.getElementsByClassName('sun-editor-id-dialog-link')[0],
1801
+ linkText : cons._dialog.getElementsByClassName('sun-editor-id-linkurl')[0],
1802
+ linkAnchorText : cons._dialog.getElementsByClassName('sun-editor-id-linktext')[0],
1803
+ image : cons._dialog.getElementsByClassName('sun-editor-id-dialog-image')[0],
1804
+ imgInputFile : cons._dialog.getElementsByClassName('sun-editor-id-image-file')[0],
1805
+ imgInputUrl : cons._dialog.getElementsByClassName('sun-editor-id-image-url')[0],
1806
+ video : cons._dialog.getElementsByClassName('sun-editor-id-dialog-video')[0],
1807
+ videoInputUrl : cons._dialog.getElementsByClassName('sun-editor-id-video-url')[0],
1808
+ video_x : cons._dialog.getElementsByClassName('sun-editor-id-video-x')[0],
1809
+ video_y : cons._dialog.getElementsByClassName('sun-editor-id-video-y')[0]
1810
+ },
1811
+ user : {
1812
+ videoX : options.videoX,
1813
+ videoY : options.videoY,
1814
+ imageSize : options.imageSize
1815
+ }
1816
+ }
1817
+ };
1818
+
1819
+ /**
1820
+ * create Suneditor
1821
+ * @param elementId
1822
+ * @param options
1823
+ * @returns {core}
1824
+ */
1825
+ SUNEDITOR.create = function (elementId, options) {
1826
+ var element = document.getElementById(elementId);
1827
+
1828
+ if(element === null || element === undefined) {
1829
+ alert('Suneditor creation failed :\n\rThe element for that id was not found');
1830
+ return null;
1831
+ }
1832
+
1833
+ var cons = Constructor(element, options);
1834
+
1835
+ /** 형́ œ 노드로 ́ƒ́„± 후 ́ˆ¨ê¹€ */
1836
+ if(typeof element.nextElementSibling === 'object') {
1837
+ element.parentNode.insertBefore(cons.constructed._top, element.nextElementSibling);
1838
+ } else {
1839
+ element.parentNode.appendChild(cons.constructed._top);
1840
+ }
1841
+
1842
+ element.style.display = "none";
1843
+
1844
+ return new core(Context(element, cons.constructed, cons.options));
1845
+ };
1846
+
1847
+ })();