From 0a4a9e3f4748615d90b647643d77101326c33282 Mon Sep 17 00:00:00 2001 From: chicpro Date: Fri, 11 Sep 2015 16:42:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=A0=80=EC=9E=A5=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=9D=84=20=EC=B6=94=EA=B0=80=EB=90=9C=20?= =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=EC=97=90=EC=84=9C=EB=8F=84=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/write.php | 12 +++++-- config.php | 3 ++ js/autosave.js | 35 +++++++++++-------- plugin/editor/smarteditor2/autosave.editor.js | 13 +++++++ skin/board/basic/write.skin.php | 1 + skin/board/gallery/write.skin.php | 1 + theme/basic/skin/board/basic/write.skin.php | 1 + theme/basic/skin/board/gallery/write.skin.php | 1 + 8 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 plugin/editor/smarteditor2/autosave.editor.js diff --git a/bbs/write.php b/bbs/write.php index 3f026298a..accff38db 100644 --- a/bbs/write.php +++ b/bbs/write.php @@ -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 = ''.PHP_EOL; } $editor_html = editor_html('wr_content', $content, $is_dhtml_editor); $editor_js = ''; diff --git a/config.php b/config.php index 6f6a6bfed..e0bdaaf70 100644 --- a/config.php +++ b/config.php @@ -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에 각각 대응되므로 diff --git a/js/autosave.js b/js/autosave.js index b65891ff8..3de56cd81 100644 --- a/js/autosave.js +++ b/js/autosave.js @@ -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); } diff --git a/plugin/editor/smarteditor2/autosave.editor.js b/plugin/editor/smarteditor2/autosave.editor.js new file mode 100644 index 000000000..49978765a --- /dev/null +++ b/plugin/editor/smarteditor2/autosave.editor.js @@ -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; +} \ No newline at end of file diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index f0e7e91e8..34d190e7e 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -111,6 +111,7 @@ add_stylesheet('', 0 +
임시 저장된 글 목록 diff --git a/skin/board/gallery/write.skin.php b/skin/board/gallery/write.skin.php index 898489957..e8bcf7bd6 100644 --- a/skin/board/gallery/write.skin.php +++ b/skin/board/gallery/write.skin.php @@ -111,6 +111,7 @@ add_stylesheet('', 0 +
임시 저장된 글 목록 diff --git a/theme/basic/skin/board/basic/write.skin.php b/theme/basic/skin/board/basic/write.skin.php index f0e7e91e8..34d190e7e 100644 --- a/theme/basic/skin/board/basic/write.skin.php +++ b/theme/basic/skin/board/basic/write.skin.php @@ -111,6 +111,7 @@ add_stylesheet('', 0 +
임시 저장된 글 목록 diff --git a/theme/basic/skin/board/gallery/write.skin.php b/theme/basic/skin/board/gallery/write.skin.php index 898489957..e8bcf7bd6 100644 --- a/theme/basic/skin/board/gallery/write.skin.php +++ b/theme/basic/skin/board/gallery/write.skin.php @@ -111,6 +111,7 @@ add_stylesheet('', 0 +
임시 저장된 글 목록