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

@ -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());
}
}