설치 방법
기본 설치 방법
파일 다운로드 및 압축 해제
다운로드한 ZIP 파일을 웹사이트 디렉토리에 압축 해제합니다.
HTML에 CSS와 JS 파일 포함
<link rel="stylesheet" href="path/to/xeditor.min.css">
<script src="path/to/xeditor.min.js"></script>
에디터 초기화
<div id="myEditor"></div>
<script>
const editor = new xEditor({
container: '#myEditor',
height: '400px',
toolbar: {
items: [
'bold', 'italic', 'underline', 'strikethrough', '|',
'fontFamily', 'fontSize', '|',
'textColor', 'backgroundColor', '|',
'alignLeft', 'alignCenter', 'alignRight', 'alignJustify', '|',
'orderedList', 'unorderedList', 'indent', 'outdent', '|',
'link', 'image', 'table', '|',
'undo', 'redo'
]
}
});
function getContent() {
const content = editor.getContent();
console.log(content);
}
function setContent(html) {
editor.setContent(html);
}
</script>
그누보드 5 설치 방법
xEditor 파일 업로드
다운로드한 파일을 /plugin/editor/xeditor/ 디렉토리에 업로드합니다.
에디터 설정 파일 수정
/plugin/editor/xeditor/config.php 파일을 생성합니다:
<?php
if (!defined('_GNUBOARD_')) exit;
function editor_html($id, $content, $is_dhtml_editor=true)
{
global $g5, $config, $board;
$editor_url = G5_PLUGIN_URL.'/editor/xeditor';
$html = "";
$html .= "<link rel=\"stylesheet\" href=\"{$editor_url}/xeditor.min.css\">\n";
$html .= "<script src=\"{$editor_url}/xeditor.min.js\"></script>\n";
$html .= "<div id=\"{$id}_editor\">{$content}</div>\n";
$html .= "<textarea id=\"{$id}\" name=\"{$id}\" style=\"display:none;\">{$content}</textarea>\n";
$html .= "<script>\n";
$html .= "var {$id}_editor = new xEditor({\n";
$html .= " container: '#{$id}_editor',\n";
$html .= " height: '350px'\n";
$html .= "});\n";
$html .= "\n";
$html .= "// 폼 전송 시 에디터 내용을 textarea에 복사\n";
$html .= "$(document).on('submit', 'form', function() {\n";
$html .= " $('#{$id}').val({$id}_editor.getContent());\n";
$html .= "});\n";
$html .= "</script>\n";
return $html;
}
?>
그누보드 관리자에서 에디터 선택
관리자 페이지 → 환경설정 → 기본환경설정에서 에디터를 'xeditor'로 변경합니다.
✅ 설치가 완료되었습니다! 게시판에서 xEditor를 사용할 수 있습니다.
워드프레스 설치 방법
플러그인 디렉토리에 업로드
/wp-content/plugins/xeditor-classic/ 디렉토리를 생성하고 파일을 업로드합니다.
플러그인 파일 생성
xeditor-classic.php 파일을 생성합니다:
<?php
add_action('admin_enqueue_scripts', 'xeditor_enqueue_scripts');
function xeditor_enqueue_scripts($hook) {
if ($hook == 'post.php' || $hook == 'post-new.php') {
wp_enqueue_style('xeditor-css', plugin_dir_url(__FILE__) . 'xeditor.min.css');
wp_enqueue_script('xeditor-js', plugin_dir_url(__FILE__) . 'xeditor.min.js', array(), '1.0.0', true);
wp_enqueue_script('xeditor-init', plugin_dir_url(__FILE__) . 'init.js', array('xeditor-js'), '1.0.0', true);
}
}
?>
플러그인 활성화
워드프레스 관리자 → 플러그인에서 'xEditor Classic'을 활성화합니다.
XE/라이믹스 설치 방법
에디터 모듈 업로드
/modules/editor/skins/xeditor/ 디렉토리에 파일을 업로드합니다.
스킨 정보 파일 생성
skin.xml 파일을 생성합니다:
<?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2">
<title xml:lang="ko">xEditor Classic</title>
<description xml:lang="ko">강력한 한국형 WYSIWYG 에디터</description>
<version>1.0.0</version>
<date>2025-01-10</date>
<author email="admin@xenix.net" link="https://xenix.net">
<name xml:lang="ko">xEditor Team</name>
</author>
</skin>
관리자에서 에디터 스킨 변경
관리자 페이지 → 설정 → 에디터 설정에서 'xEditor Classic'을 선택합니다.
CDN으로 사용하기
다운로드 없이 CDN을 통해 바로 사용할 수 있습니다:
<link rel="stylesheet" href="https://xenix.net/xedit_classic/xeditor.min.css">
<script src="https://xenix.net/xedit_classic/xeditor.min.js"></script>
<div id="editor"></div>
<script>
const editor = new xEditor({
container: '#editor',
height: '400px'
});
</script>
주요 옵션
const editor = new xEditor({
container: '#editor',
height: '400px',
width: '100%',
language: 'ko',
placeholder: '내용을 입력하세요',
theme: 'light',
autoSave: {
enabled: true,
interval: 30000
},
toolbar: {
position: 'top',
sticky: true,
items: [
'bold', 'italic', 'underline', '|',
'fontFamily', 'fontSize', '|',
'textColor', 'backgroundColor', '|',
'alignLeft', 'alignCenter', 'alignRight', '|',
'orderedList', 'unorderedList', '|',
'indent', 'outdent', '|',
'link', 'image', 'table', '|',
'undo', 'redo', '|',
'fullscreen'
]
}
});
⚠️ 주의사항: xEditor Classic은 Internet Explorer 11 이상에서 작동합니다.
최적의 성능을 위해 최신 브라우저 사용을 권장합니다.