### Get HTML Content
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html
Retrieves the current HTML content of the editor using the getIR() method. This is useful for previewing or processing the editor's content.
```javascript
function showHTML() {
var sHTML = oEditor.getIR();
alert(sHTML);
}
```
--------------------------------
### Get Editor HTML Content
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2noframe.html
Retrieves the current HTML content from the editor using the getIR() method.
```javascript
function showHTML() {
var sHTML = oEditor.getIR();
alert(sHTML);
}
```
--------------------------------
### Initialize Color Picker and Position
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/cheditor5/popup/table.html
Sets up the color picker's initial position based on the table color wrapper's offset. This script runs when the window loads.
```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();
};
```
--------------------------------
### Initialize SmartEditor2 (No Frame)
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2noframe.html
Initializes SmartEditor2 in a no-frame environment. Configure toolbar, resizer, and mode changer options. The `run` method executes editor functions upon readiness.
```javascript
if(window.frameElement){ jindo.$("se2\_sample").style.display = "none"; }else{ var oEditor = createSEditor2(jindo.$("ir1"), {
bUseToolbar : true, // 툴바 사용 여부 (true:사용/ false:사용하지 않음)
bUseVerticalResizer : true, // 입력창 크기 조절바 사용 여부 (true:사용/ false:사용하지 않음)
bUseModeChanger : true, // 모드 탭(Editor | HTML | TEXT) 사용 여부 (true:사용/ false:사용하지 않음)
//bSkipXssFilter : true, // client-side xss filter 무시 여부 (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입니다."]);
}
});
}
```
--------------------------------
### Initialize SmartEditor2 without Iframe
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html
Initializes SmartEditor2 with basic configurations like toolbar, vertical resizer, and mode changer enabled. This is the standard way to set up the editor on a page.
```javascript
if(window.frameElement){ jindo.$("se2\_sample").style.display = "none"; }else{
var oEditor = createSEditor2(jindo.$("ir1"), {
bUseToolbar : true, // 툴바 사용 여부 (true:사용/ false:사용하지 않음)
bUseVerticalResizer : true, // 입력창 크기 조절바 사용 여부 (true:사용/ false:사용하지 않음)
bUseModeChanger : true, // 모드 탭(Editor | HTML | TEXT) 사용 여부 (true:사용/ false:사용하지 않음)
//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입니다."]);
}
});
}
```
--------------------------------
### Set Default Font
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2noframe.html
Sets the default font family and size for the editor.
```javascript
function setDefaultFont() {
var sDefaultFont = '궁서';
var nFontSize = 24;
oEditor.setDefaultFont(sDefaultFont, nFontSize);
}
```
--------------------------------
### Paste HTML Content
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2noframe.html
Executes the PASTE_HTML command to insert specified HTML content into the editor.
```javascript
function pasteHTML() {
var sHTML = "이미지도 같은 방식으로 삽입합니다.<\/span>";
oEditor.exec("PASTE_HTML", [sHTML]);
}
```
--------------------------------
### Set Default Font
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html
Sets the default font family and size for the editor. This configuration applies to any new text entered into the editor.
```javascript
function setDefaultFont() {
var sDefaultFont = '궁서';
var nFontSize = 24;
oEditor.setDefaultFont(sDefaultFont, nFontSize);
}
```
--------------------------------
### Paste HTML Content
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html
Executes the PASTE_HTML command to insert HTML content into the editor. This is useful for dynamically adding pre-formatted text or elements.
```javascript
function pasteHTML() {
var sHTML = "이미지도 같은 방식으로 삽입합니다.<\/span>";
oEditor.exec("PASTE_HTML", [sHTML]);
}
```
--------------------------------
### Add Unminified JS in SmartEditor2Skin.html
Source: https://github.com/gnuboard/gnuboard5/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
```
--------------------------------
### Show/Hide Color Picker Functionality
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/cheditor5/popup/table.html
Toggles the display of the color picker and updates the styling of the color picker buttons. It also handles setting the selected color.
```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;
}
```
--------------------------------
### Update and Submit Editor Contents
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2noframe.html
Updates the hidden textarea with the editor's content and then submits the form. Use this before form submission to ensure the latest content is captured.
```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/gnuboard5/blob/master/plugin/editor/smarteditor2/src_include.txt
Delete this line from SmartEditor2Skin.html to remove the minified JavaScript file.
```html
```
--------------------------------
### Submit Editor Contents
Source: https://github.com/gnuboard/gnuboard5/blob/master/plugin/editor/smarteditor2/SmartEditor2_noframe.html
Updates the hidden textarea with the editor's current 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();
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.