타 DHTML 에디터도 사용 할수 있도록 수정, cheditor5 추가

This commit is contained in:
gnuboard
2013-07-17 15:43:52 +09:00
parent fdd3342cb0
commit ce0814da58
278 changed files with 110 additions and 42 deletions

View File

@ -108,7 +108,7 @@ CKEDITOR.editorConfig = function( config ) {
config.fontSize_sizes = "7pt/9px;8pt/11px;9pt/12px;10pt/13px;11pt/15px;14pt/19px;18pt/24px;24pt/32px;36/48px;";
config.enterMode = CKEDITOR.ENTER_DIV;
config.shiftEnterMode = CKEDITOR.ENTER_DIV;
config.filebrowserUploadUrl = g4_ckeditor_url+"/upload.php?type=Images";
config.filebrowserUploadUrl = g4_editor_url+"/upload.php?type=Images";
config.keystrokes=[
// Formatting
[ CKEDITOR.CTRL + 81 /*Q*/, 'blockquote' ],

View File

@ -1,20 +1,22 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
function editor_html($id, $content, $ckeditor=true, $class="")
function editor_html($id, $content, $is_dhtml_editor=true)
{
global $g4;
global $g4, $config;
static $js = true;
$editor_url = G4_EDITOR_URL.'/'.$config['cf_editor'];
$html = "";
$html .= "<span class=\"sound_only\">웹에디터 시작</span>";
if ($ckeditor)
if ($is_dhtml_editor)
$html .= '<script>document.write("<div class=\'cke_sc\'><button type=\'button\' class=\'btn_cke_sc\'>단축키 일람</button></div>");</script>';
if ($js) {
$html .= "\n".'<script src="'.G4_CKEDITOR_URL.'/ckeditor.js"></script>';
$html .= "\n".'<script>var g4_ckeditor_url = "'.G4_CKEDITOR_URL.'";</script>';
$html .= "\n".'<script src="'.G4_CKEDITOR_URL.'/config.js"></script>';
$html .= "\n".'<script src="'.$editor_url.'/ckeditor.js"></script>';
$html .= "\n".'<script>var g4_editor_url = "'.$editor_url.'";</script>';
$html .= "\n".'<script src="'.$editor_url.'/config.js"></script>';
$html .= "\n<script>";
$html .= '
$(function(){
@ -23,7 +25,7 @@ function editor_html($id, $content, $ckeditor=true, $class="")
$(this).next("div.cke_sc_def").remove();
$(this).text("단축키 일람");
} else {
$(this).after("<div class=\'cke_sc_def\' />").next("div.cke_sc_def").load("'.G4_CKEDITOR_URL.'/shortcut.html");
$(this).after("<div class=\'cke_sc_def\' />").next("div.cke_sc_def").load("'.$editor_url.'/shortcut.html");
$(this).text("단축키 일람 닫기");
}
});
@ -35,17 +37,17 @@ function editor_html($id, $content, $ckeditor=true, $class="")
$js = false;
}
$ckeditor_class = $ckeditor ? "ckeditor" : "";
$html .= "\n<textarea id=\"$id\" name=\"$id\" class=\"$ckeditor_class $class\" style=\"width:100%;\" maxlength=\"65536\">$content</textarea>";
$ckeditor_class = $is_dhtml_editor ? "ckeditor" : "";
$html .= "\n<textarea id=\"$id\" name=\"$id\" class=\"$ckeditor_class\" style=\"width:100%;\" maxlength=\"65536\">$content</textarea>";
$html .= "\n<span class=\"sound_only\">웹 에디터 끝</span>";
return $html;
}
// textarea 로 값을 넘긴다. javascript 반드시 필요
function get_editor_js($id, $ckeditor=true)
function get_editor_js($id, $is_dhtml_editor=true)
{
if ( $ckeditor ) {
if ($is_dhtml_editor) {
return "var {$id}_editor_data = CKEDITOR.instances.{$id}.getData();\n";
} else {
return "var {$id}_editor = document.getElementById('{$id}');\n";
@ -54,12 +56,12 @@ function get_editor_js($id, $ckeditor=true)
// textarea 의 값이 비어 있는지 검사
function chk_editor_js($id, $ckeditor=true, $textarea_name="내용을")
function chk_editor_js($id, $is_dhtml_editor=true)
{
if ( $ckeditor ) {
return "if (!{$id}_editor_data) { alert(\"$textarea_name 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\nif (typeof(f.wr_content)!=\"undefined\") f.wr_content.value = {$id}_editor_data;\n";
if ($is_dhtml_editor) {
return "if (!{$id}_editor_data) { alert(\"내용을 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\nif (typeof(f.wr_content)!=\"undefined\") f.wr_content.value = {$id}_editor_data;\n";
} else {
return "if (!{$id}_editor.value) { alert(\"$textarea_name 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
}
}
?>

Some files were not shown because too many files have changed in this diff Show More