Enable textarea to be used as member agreement editor

This commit is contained in:
Kijin Sung 2018-03-06 21:58:33 +09:00
parent 499a7e4457
commit c4f3110291
3 changed files with 19 additions and 4 deletions

View file

@ -28,9 +28,6 @@ class editorView extends editor
// Load editor
$oEditorModel = getModel('editor');
$option = $oEditorModel->getEditorConfig();
$option->editor_skin = 'ckeditor';
$option->content_style = 'ckeditor_light';
$option->sel_editor_colorset = 'moono-lisa';
$option->primary_key_name = 'primary_key';
$option->content_key_name = 'content';
$option->allow_fileupload = FALSE;

View file

@ -4,6 +4,7 @@ function editorTextarea(editor_sequence) {
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 + "']");
var content = "";
// Set editor keys
editorRelKeys[editor_sequence] = {};
@ -16,7 +17,7 @@ function editorTextarea(editor_sequence) {
// Load existing content
if (content_input.size()) {
var content = String(content_input.val()).stripTags();
content = String(content_input.val()).stripTags();
content_input.val(content);
textarea.val(content.unescape());
}
@ -25,4 +26,19 @@ function editorTextarea(editor_sequence) {
textarea.on("change", function() {
content_input.val(String(jQuery(this).val()).escape());
});
// Copy content to another input and resize iframe if configured
if (window.editor_resize_iframe && window.editor_copy_input)
{
content = String(editor_copy_input.val()).stripTags();
editor_copy_input.val(content);
textarea.val(content.unescape());
textarea.on("resize", function(e){
editor_resize_iframe.height(textarea.height());
});
textarea.on("change", function() {
editor_copy_input.val(String(textarea.val()).escape());
});
editor_resize_iframe.height(textarea.height());
}
}

View file

@ -262,6 +262,8 @@ class memberAdminController extends member
$agreement = new stdClass;
$agreement->title = escape(utf8_trim($args->{'agreement_' . $i . '_title'}));
$agreement->content = $args->{'agreement_' . $i . '_content'};
$agreement->use_editor = $args->use_editor;
getModel('editor')->converter($agreement, 'document');
$agreement->type = $args->{'agreement_' . $i . '_type'};
if (!in_array($agreement->type, array('required', 'optional', 'disabled')))
{