자동저장 기능을 추가된 에디터에서도 사용할 수 있도록 수정

This commit is contained in:
chicpro
2015-09-11 16:42:20 +09:00
parent 5cf2074338
commit 0a4a9e3f47
8 changed files with 51 additions and 16 deletions

View File

@ -390,9 +390,17 @@ if ($is_guest) {
}
$is_dhtml_editor = false;
// 모바일에서는 DHTML 에디터 사용불가
if ($config['cf_editor'] && !G5_IS_MOBILE && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) {
$is_dhtml_editor_use = false;
$editor_content_js = '';
if(!G5_IS_MOBILE || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)
$is_dhtml_editor_use = true;
// 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용
if ($config['cf_editor'] && $is_dhtml_editor_use && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) {
$is_dhtml_editor = true;
if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js'))
$editor_content_js = '<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/autosave.editor.js"></script>'.PHP_EOL;
}
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';

View File

@ -192,6 +192,9 @@ define('G5_THUMB_JPG_QUALITY', 90);
// 썸네일 png Compress 설정
define('G5_THUMB_PNG_COMPRESS', 5);
// 모바일 기기에서 DHTML 에디터 사용여부를 설정합니다.
define('G5_IS_MOBILE_DHTML_USE', true);
// ip 숨김방법 설정
/* 123.456.789.012 ip의 숨김 방법을 변경하는 방법은
\\1 은 123, \\2는 456, \\3은 789, \\4는 012에 각각 대응되므로

View File

@ -7,13 +7,18 @@ var save_wr_content = null;
function autosave() {
$("form#fwrite").each(function() {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
this.wr_content.value = CKEDITOR.instances.wr_content.getData();
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
this.wr_content.value = ed_wr_content.outputBodyHTML();
} else if (g5_editor.indexOf("smarteditor2") != -1 && typeof(oEditors)!="undefined" && typeof(oEditors.getById['wr_content'])!="undefined" ) {
this.wr_content.value = oEditors.getById['wr_content'].getIR();
if(g5_editor != "") {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
this.wr_content.value = CKEDITOR.instances.wr_content.getData();
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
this.wr_content.value = ed_wr_content.outputBodyHTML();
} else {
if(typeof get_editor_wr_content == "function") {
this.wr_content.value = get_editor_wr_content();
}
}
}
// 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함
if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) {
$.ajax({
@ -78,14 +83,16 @@ $(function(){
var subject = $(data).find("item").find("subject").text();
var content = $(data).find("item").find("content").text();
$("#wr_subject").val(subject);
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
ed_wr_content.putContents(content);
} else if (g5_editor.indexOf("smarteditor2") != -1 && typeof(oEditors)!="undefined" && typeof(oEditors.getById['wr_content'])!="undefined" ) {
oEditors.getById["wr_content"].exec("SET_CONTENTS", [""]);
//oEditors.getById["wr_content"].exec("SET_IR", [""]);
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);
if(g5_editor != "") {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
ed_wr_content.putContents(content);
} else {
if(typeof put_editor_wr_content == "function") {
put_editor_wr_content(content);
}
}
} else {
$("#fwrite #wr_content").val(content);
}

View File

@ -0,0 +1,13 @@
function get_editor_wr_content()
{
return oEditors.getById['wr_content'].getIR();;
}
function put_editor_wr_content(content)
{
oEditors.getById["wr_content"].exec("SET_CONTENTS", [""]);
//oEditors.getById["wr_content"].exec("SET_IR", [""]);
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);
return;
}

View File

@ -111,6 +111,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
<?php if ($is_member) { // 임시 저장된 글 기능 ?>
<script src="<?php echo G5_JS_URL; ?>/autosave.js"></script>
<?php if($editor_content_js) echo $editor_content_js; ?>
<button type="button" id="btn_autosave" class="btn_frmline">임시 저장된 글 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</button>
<div id="autosave_pop">
<strong>임시 저장된 글 목록</strong>

View File

@ -111,6 +111,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
<?php if ($is_member) { // 임시 저장된 글 기능 ?>
<script src="<?php echo G5_JS_URL; ?>/autosave.js"></script>
<?php if($editor_content_js) echo $editor_content_js; ?>
<button type="button" id="btn_autosave" class="btn_frmline">임시 저장된 글 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</button>
<div id="autosave_pop">
<strong>임시 저장된 글 목록</strong>

View File

@ -111,6 +111,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
<?php if ($is_member) { // 임시 저장된 글 기능 ?>
<script src="<?php echo G5_JS_URL; ?>/autosave.js"></script>
<?php if($editor_content_js) echo $editor_content_js; ?>
<button type="button" id="btn_autosave" class="btn_frmline">임시 저장된 글 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</button>
<div id="autosave_pop">
<strong>임시 저장된 글 목록</strong>

View File

@ -111,6 +111,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
<?php if ($is_member) { // 임시 저장된 글 기능 ?>
<script src="<?php echo G5_JS_URL; ?>/autosave.js"></script>
<?php if($editor_content_js) echo $editor_content_js; ?>
<button type="button" id="btn_autosave" class="btn_frmline">임시 저장된 글 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</button>
<div id="autosave_pop">
<strong>임시 저장된 글 목록</strong>