### Initialize SmartEditor2 without Frame Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html Initializes SmartEditor2 with various configuration options when not running in an iframe. This setup enables the toolbar, vertical resizer, and mode changer. ```javascript if(window.frameElement){ jindo.$("se2\_sample").style.display = "none"; }else{ var oEditor = createSEditor2(jindo.$("ir1"), { bUseToolbar : true, bUseVerticalResizer : true, bUseModeChanger : true, //aAdditionalFontList : [["MS UI Gothic", "MS UI Gothic"], ["Comic Sans MS", "Comic Sans MS"],["TEST","TEST"]], fOnBeforeUnload : function(){ //예제 코드 //return "내용이 변경되었습니다."; } }); oEditor.run({ fnOnAppReady: function(){ //예제 코드 //oEditor.exec("PASTE_HTML", ["로딩이 완료된 후에 본문에 삽입되는 text입니다."]); } }); } ``` -------------------------------- ### Retrieve HTML Content from Editor Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html Retrieves the current HTML content from the SmartEditor2 instance using the getIR() method. This is typically used to get the editor's content before submission. ```javascript function showHTML() { var sHTML = oEditor.getIR(); alert(sHTML); } ``` -------------------------------- ### Initialize Color Picker and Position Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/cheditor5/popup/table_modify.html Sets up the color picker's initial position and draws the color palette when the window loads. Ensures the color picker is correctly aligned with the table element. ```javascript var offsetTop, offsetLeft, obj, showColorSwitch=false, showColorSwitch=false, beforeButton=null, tableColorWrapper, colorPickerWrapper; window.onload = function() { tableColorWrapper = document.getElementById('tableColorWrapper'); colorPickerWrapper = document.getElementById('colorWrapper'); obj = tableColorWrapper; offsetTop = obj.offsetTop; offsetLeft = obj.offsetLeft; if (obj.offsetParent) { obj = obj.offsetParent; while (obj) { offsetTop += obj.offsetTop; offsetLeft += obj.offsetLeft; obj = obj.offsetParent; } } colorPickerWrapper.style.top = (offsetTop-74) + 'px'; colorPickerWrapper.style.left = offsetLeft + 'px'; drawColor(); }; ``` -------------------------------- ### CHEditor Color Picker Initialization and Logic Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/cheditor5/popup/table.html This JavaScript code initializes the color picker for the table popup. It calculates the picker's position and handles the logic for showing and hiding the color picker when a color swatch is clicked. ```JavaScript var offsetTop, offsetLeft, obj, showColorSwitch=false, showColorSwitch=false, beforeButton=null, tableColorWrapper, colorPickerWrapper; window.onload = function() { tableColorWrapper = document.getElementById('tableColorWrapper'); colorPickerWrapper = document.getElementById('colorWrapper'); obj = tableColorWrapper; offsetTop = obj.offsetTop; offsetLeft = obj.offsetLeft; if (obj.offsetParent) { obj = obj.offsetParent; while (obj) { offsetTop += obj.offsetTop; offsetLeft += obj.offsetLeft; obj = obj.offsetParent; } } colorPickerWrapper.style.top = (offsetTop-74) + 'px'; colorPickerWrapper.style.left = offsetLeft + 'px'; drawColor(); }; function showColorPicker(which, img) { showColorSwitch = !showColorSwitch; if (beforeButton && beforeButton !== img) { beforeButton.className = 'colorPickerButton'; showColorSwitch = true; } if (showColorSwitch) { displayAttr = 'block'; img.className = 'colorPickerButtonGray'; if (beforeButton === null || beforeButton !== img) { beforeButton = img; } setColor(which); } else { img.className = 'colorPickerButton'; displayAttr = 'none'; } document.getElementById('colorWrapper').style.display = displayAttr; } ``` -------------------------------- ### CHEditor Table Popup Options Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/cheditor5/popup/table.html These are the configuration options available in the table popup for CHEditor. They control table attributes like rows, columns, dimensions, spacing, borders, alignment, and captions. ```HTML 줄 수: 칸 수: * * * 너비: % px 높이: % px 셀 안 여백: 셀 간격: 테두리 굵기:  픽셀 정렬: 없음 왼쪽 가운데 오른쪽 * * * 표 제목: 표 제목 숨김: 표 요약: 표 헤더: 없음 첫 줄 첫 칸 모두 * * * CSS class: CSS id: 색 지정 테두리 색: 표 배경색: ``` -------------------------------- ### Paste HTML Content into Editor Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html Executes the PASTE_HTML command to insert specified HTML content into the SmartEditor2 instance. This is useful for dynamically adding formatted text. ```javascript function pasteHTML() { var sHTML = "이미지도 같은 방식으로 삽입합니다.<\/span>"; oEditor.exec("PASTE_HTML", [sHTML]); } ``` -------------------------------- ### Show/Hide Color Picker Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/cheditor5/popup/table_modify.html Toggles the visibility of the color picker and updates the styling of the clicked color swatch. Manages the state of the color picker to ensure only one is active at a time. ```javascript function showColorPicker(which, img) { showColorSwitch = !showColorSwitch; if (beforeButton && beforeButton !== img) { beforeButton.className = 'colorPickerButton'; showColorSwitch = true; } if (showColorSwitch) { displayAttr = 'block'; img.className = 'colorPickerButtonGray'; if (beforeButton === null || beforeButton !== img) { beforeButton = img; } setColor(which); } else { img.className = 'colorPickerButton'; displayAttr = 'none'; } document.getElementById('colorWrapper').style.display = displayAttr; } ``` -------------------------------- ### Add Unminified JS in SmartEditor2Skin.html Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/src_include.txt Add this line to SmartEditor2Skin.html to include the unminified JavaScript file, allowing for direct source code edits. ```html ``` -------------------------------- ### Set Default Font for Editor Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html Sets the default font family and size for the SmartEditor2 instance. This applies to any new text entered into the editor. ```javascript function setDefaultFont() { var sDefaultFont = '궁서'; var nFontSize = 24; oEditor.setDefaultFont(sDefaultFont, nFontSize); } ``` -------------------------------- ### Update and Submit Editor Contents Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html Updates the hidden textarea with the current editor content and then submits the form. This ensures that the editor's content is included in the form submission. ```javascript function submitContents() { oEditor.exec("UPDATE_CONTENTS_FIELD"); // 에디터의 내용이 textarea에 적용됩니다. // 에디터의 내용에 대한 값 검증은 이곳에서 document.getElementById("ir1").value를 이용해서 처리하면 됩니다. jindo.$("ir1").form.submit(); } ``` -------------------------------- ### Remove Minified JS in SmartEditor2Skin.html Source: https://github.com/gnuboard/youngcart5/blob/master/plugin/editor/smarteditor2/src_include.txt Delete this line from SmartEditor2Skin.html to remove the minified JavaScript file. ```html ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.