mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
textarea 에디터 미리보기에서 오류가 발생되는 문제 수정
This commit is contained in:
parent
77418672bb
commit
56d62a816f
5 changed files with 61 additions and 12 deletions
|
|
@ -653,6 +653,7 @@ function doDocumentPreview(obj) {
|
||||||
'<form id="previewDocument" target="previewDocument" method="post" action="'+request_uri+'">'+
|
'<form id="previewDocument" target="previewDocument" method="post" action="'+request_uri+'">'+
|
||||||
'<input type="hidden" name="module" value="document" />'+
|
'<input type="hidden" name="module" value="document" />'+
|
||||||
'<input type="hidden" name="act" value="dispDocumentPreview" />'+
|
'<input type="hidden" name="act" value="dispDocumentPreview" />'+
|
||||||
|
'<input type="hidden" name="mid" value="' + current_mid +'" />'+
|
||||||
'<input type="hidden" name="content" />'+
|
'<input type="hidden" name="content" />'+
|
||||||
'</form>'
|
'</form>'
|
||||||
).appendTo(document.body);
|
).appendTo(document.body);
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,21 @@ class documentView extends document
|
||||||
return new Object(-1, 'msg_invalid_request');
|
return new Object(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = Context::get('content');
|
||||||
|
|
||||||
if(Context::get('logged_info')->is_admin != 'Y')
|
if(Context::get('logged_info')->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
Context::set('content', removeHackTag(Context::get('content')));
|
$content = removeHackTag($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Editor converter
|
||||||
|
$obj = new stdClass;
|
||||||
|
$obj->content = $content;
|
||||||
|
$obj->module_srl = getModel('module')->getModuleInfoByMid(Context::get('mid'))->module_srl;
|
||||||
|
$content = getModel('editor')->converter($obj, 'document');
|
||||||
|
|
||||||
|
Context::set('content', $content);
|
||||||
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('preview_page');
|
$this->setTemplateFile('preview_page');
|
||||||
Context::set('layout', 'none');
|
Context::set('layout', 'none');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
<load target="../../tpl/js/editor_common.js" />
|
||||||
<load target="css/textarea.css" />
|
<load target="css/textarea.css" />
|
||||||
|
<load target="js/textarea.js" />
|
||||||
|
<load target="js/interface.js" />
|
||||||
|
|
||||||
<div id="textarea_wrapper_{$editor_sequence}" class="rx_editor_wrapper">
|
<div id="textarea_wrapper_{$editor_sequence}" class="rx_editor_wrapper">
|
||||||
<textarea id="textarea_instance_{$editor_sequence}" class="rx_editor_textarea {$colorset}" data-editor-sequence="{$editor_sequence}" data-editor-primary-key-name="{$editor_primary_key_name}" data-editor-content-key-name="{$editor_content_key_name}"></textarea>
|
<textarea id="textarea_instance_{$editor_sequence}" class="rx_editor_textarea {$colorset}" data-editor-sequence="{$editor_sequence}" data-editor-primary-key-name="{$editor_primary_key_name}" data-editor-content-key-name="{$editor_content_key_name}"></textarea>
|
||||||
|
|
@ -19,17 +22,8 @@
|
||||||
textarea.css("word-wrap", "break-word");
|
textarea.css("word-wrap", "break-word");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load existing content
|
// Load
|
||||||
var content_key = textarea.data("editor-content-key-name");
|
editorTextarea({$editor_sequence});
|
||||||
var content_input = textarea.parents("form").find("input[name='" + content_key + "']");
|
|
||||||
if (content_input.size()) {
|
|
||||||
textarea.val(String(content_input.val()).stripTags().unescape());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save edited content
|
|
||||||
textarea.on("change", function() {
|
|
||||||
content_input.val(String($(this).val()).escape());
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
16
modules/editor/skins/textarea/js/interface.js
Normal file
16
modules/editor/skins/textarea/js/interface.js
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
function _getTextareaInstance(editor_sequence) {
|
||||||
|
return jQuery('#textarea_instance_' + editor_sequence);
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorGetContent(editor_sequence) {
|
||||||
|
return _getTextareaInstance(editor_sequence).val().escape();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorReplaceHTML(iframe_obj, content) {
|
||||||
|
var editor_sequence = parseInt(iframe_obj.id.replace(/^.*_/, ''), 10);
|
||||||
|
_getTextareaInstance(editor_sequence).val(String(content).stripTags());
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorGetIFrame(editor_sequence) {
|
||||||
|
return _getTextareaInstance(editor_sequence).get(0);
|
||||||
|
}
|
||||||
28
modules/editor/skins/textarea/js/textarea.js
Normal file
28
modules/editor/skins/textarea/js/textarea.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
function editorTextarea(editor_sequence) {
|
||||||
|
var textarea = jQuery("#textarea_instance_" + editor_sequence);
|
||||||
|
var content_key = textarea.data("editor-content-key-name");
|
||||||
|
var primary_key = textarea.data("editor-primary-key-name");
|
||||||
|
var insert_form = textarea.closest("form");
|
||||||
|
var content_input = insert_form.find("input[name='" + content_key + "']");
|
||||||
|
|
||||||
|
// Set editor keys
|
||||||
|
editorRelKeys[editor_sequence] = {};
|
||||||
|
editorRelKeys[editor_sequence].primary = insert_form.find("input[name='" + primary_key + "']");
|
||||||
|
editorRelKeys[editor_sequence].content = content_input;
|
||||||
|
editorRelKeys[editor_sequence].func = editorGetContent;
|
||||||
|
|
||||||
|
// Set editor_sequence
|
||||||
|
insert_form[0].setAttribute('editor_sequence', editor_sequence);
|
||||||
|
|
||||||
|
// Load existing content
|
||||||
|
if (content_input.size()) {
|
||||||
|
var content = String(content_input.val()).stripTags();
|
||||||
|
content_input.val(content);
|
||||||
|
textarea.val(content.unescape());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save edited content
|
||||||
|
textarea.on("change", function() {
|
||||||
|
content_input.val(String(jQuery(this).val()).escape());
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue