#1087 CKEditor 기본 콘텐츠 스타일 추가

This commit is contained in:
bnu 2015-02-27 14:47:47 +09:00
parent d2d092a7eb
commit 571ebc37d3
9 changed files with 143 additions and 2 deletions

View file

@ -51,7 +51,7 @@ class editorModel extends editor
if(!$editor_config->comment_editor_height) if($editor_default_config->comment_editor_height? $editor_config->comment_editor_height = $editor_default_config->comment_editor_height : $editor_config->comment_editor_height = 100);
if(!$editor_config->editor_skin) if($editor_default_config->editor_skin? $editor_config->editor_skin = $editor_default_config->editor_skin : $editor_config->editor_skin = 'ckeditor');
if(!$editor_config->comment_editor_skin) if($editor_default_config->comment_editor_skin? $editor_config->comment_editor_skin = $editor_default_config->comment_editor_skin : $editor_config->comment_editor_skin = 'ckeditor');
if(!$editor_config->content_style) if($editor_default_config->content_style? $editor_config->content_style = $editor_default_config->content_style : $editor_config->content_style = 'default');
if(!$editor_config->content_style) if($editor_default_config->content_style? $editor_config->content_style = $editor_default_config->content_style : $editor_config->content_style = 'ckeditor_light');
if(!$editor_config->content_font && $editor_default_config->content_font) $editor_config->content_font = $editor_default_config->content_font;
if(!$editor_config->content_font_size && $editor_default_config->content_font_size) $editor_config->content_font_size = $editor_default_config->content_font_size;
@ -177,7 +177,7 @@ class editorModel extends editor
if(!$option->allow_fileupload) $allow_fileupload = false;
else $allow_fileupload = true;
// content_style setting
if(!$option->content_style) $option->content_style = 'default';
if(!$option->content_style) $option->content_style = 'ckeditor_light';
Context::set('content_style', $option->content_style);
Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style);
// Default font setting

View file

@ -0,0 +1,41 @@
//Insert uploaded file to editor
function ckInsertUploadedFile(editorSequence){
var temp_code='';
var settings = uploaderSettings[editorSequence];
var fileListAreaID = settings["fileListAreaID"];
var fileListObj = get_by_id(fileListAreaID);
if(!fileListObj) return;
if(editorMode[editorSequence]=='preview') return;
for(var i=0;i<fileListObj.options.length;i++) {
if(!fileListObj.options[i].selected) continue;
var file_srl = fileListObj.options[i].value;
if(!file_srl) continue;
var file = uploadedFiles[file_srl];
if(file.direct_download == 'Y') {
if(/\.(jpg|jpeg|png|gif)$/i.test(file.download_url)) {
if(loaded_images[file_srl]) {
var obj = loaded_images[file_srl];
}
else {
var obj = new Image();
obj.src = file.download_url;
}
temp_code += "<img src=\""+file.download_url+"\" alt=\""+file.source_filename+"\"";
if(obj.complete == true) { temp_code += " width=\""+obj.width+"\" height=\""+obj.height+"\""; }
temp_code += " />\r\n";
} else {
temp_code="<img src=\"common/img/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+file.download_url+"\" width=\"400\" height=\"320\" style=\"display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\"false\" alt=\"\" />";
}
} else {
temp_code="<a href=\""+file.download_url+"\">"+file.source_filename+"</a>\n";
}
}
cked_instance = 'ckeditor_instance_'+editorSequence;
CKEDITOR.instances[cked_instance].insertHtml(temp_code);
}

View file

@ -0,0 +1,41 @@
function editorStartTextarea(editor_sequence, content_key, primary_key) {
var obj = xGetElementById('editor_'+editor_sequence);
var use_html = xGetElementById('htm_'+editor_sequence).value;
obj.form.setAttribute('editor_sequence', editor_sequence);
obj.style.width = '100%';
editorRelKeys[editor_sequence] = new Array();
editorRelKeys[editor_sequence]["primary"] = obj.form[primary_key];
editorRelKeys[editor_sequence]["content"] = obj.form[content_key];
editorRelKeys[editor_sequence]["func"] = editorGetContentTextarea;
var content = obj.form[content_key].value;
if(use_html) {
content = content.replace(/<br([^>]*)>/ig,"\n");
if(use_html!='br') {
content = content.replace(/&lt;/g, "<");
content = content.replace(/&gt;/g, ">");
content = content.replace(/&quot;/g, '"');
content = content.replace(/&amp;/g, "&");
}
}
obj.value = content;
}
function editorGetContentTextarea(editor_sequence) {
var obj = xGetElementById('editor_'+editor_sequence);
var use_html = xGetElementById('htm_'+editor_sequence).value;
var content = obj.value.trim();
if(use_html) {
if(use_html!='br') {
content = content.replace(/&/g, "&amp;");
content = content.replace(/</g, "&lt;");
content = content.replace(/>/g, "&gt;");
content = content.replace(/\"/g, "&quot;");
}
content = content.replace(/(\r\n|\n)/g, "<br />");
}
return content;
}

View file

@ -0,0 +1,20 @@
@charset "utf-8";
/* NAVER (developers@xpressengine.com) */
.xe_content.edtiable {color:#000;font-size:13px;font-family:sans-serif;line-height:1.5;word-break:break-all;word-wrap:break-word}
.xe_content.edtiable img{border:0;max-width:100%;}
.xe_content.edtiable blockquote.q1,
.xe_content.edtiable blockquote.q2,
.xe_content.edtiable blockquote.q3,
.xe_content.edtiable blockquote.q4,
.xe_content.edtiable blockquote.q5,
.xe_content.edtiable blockquote.q6,
.xe_content.edtiable blockquote.q7{padding:10px;margin:0 15px}
.xe_content.edtiable blockquote.q1{padding:0 10px;border-left:2px solid #ccc}
.xe_content.edtiable blockquote.q2{padding:0 10px;background:url(./img/bg_qmark.gif) no-repeat left top}
.xe_content.edtiable blockquote.q3{border:1px solid #d9d9d9}
.xe_content.edtiable blockquote.q4{border:1px solid #d9d9d9;background:#fbfbfb}
.xe_content.edtiable blockquote.q5{border:2px solid #707070}
.xe_content.edtiable blockquote.q6{border:1px dashed #707070}
.xe_content.edtiable blockquote.q7{border:1px dashed #707070;background:#fbfbfb}
.xe_content.edtiable table .xe_selected_cell{background-color:#d6e9ff}
.xe_content.edtiable p{margin:0}

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="editor.css" />
<title>XpressEngine</title>
</head>
<body class="xe_content editable">
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2">
<title xml:lang="ko">XE CKEditor 기본 서식</title>
<version>1.8</version>
<date>2014-02-27</date>
<author email_address="developers@xpressengine.com" link="http://xpressengine.com/">
<name xml:lang="ko">NAVER</name>
</author>
</skin>

View file

@ -0,0 +1,19 @@
@charset "utf-8";
/* NAVER (developers@xpressengine.com) */
.xe_content {color:#000;font-size:13px;font-family:sans-serif;line-height:1.5}
.xe_content blockquote.q1,
.xe_content blockquote.q2,
.xe_content blockquote.q3,
.xe_content blockquote.q4,
.xe_content blockquote.q5,
.xe_content blockquote.q6,
.xe_content blockquote.q7{padding:10px;margin:0 15px}
.xe_content blockquote.q1{padding:0 10px;border-left:2px solid #ccc}
.xe_content blockquote.q2{padding:0 10px;background:url(./img/bg_qmark.gif) no-repeat left top}
.xe_content blockquote.q3{border:1px solid #d9d9d9}
.xe_content blockquote.q4{border:1px solid #d9d9d9;background:#fbfbfb}
.xe_content blockquote.q5{border:2px solid #707070}
.xe_content blockquote.q6{border:1px dashed #707070}
.xe_content blockquote.q7{border:1px dashed #707070;background:#fbfbfb}
.xe_content p{margin:0}

View file

@ -0,0 +1 @@
style.css