mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
General cleanup of DOM traversal code in editor & uploader (should also fix #2303)
This commit is contained in:
parent
7dd3dd3838
commit
b9ea0e65b0
6 changed files with 49 additions and 48 deletions
|
|
@ -134,8 +134,7 @@
|
|||
versionCheck: false
|
||||
},
|
||||
loadXeComponent: true,
|
||||
enableToolbar: true,
|
||||
content_field: jQuery('[name={$editor_content_key_name}]')
|
||||
enableToolbar: true
|
||||
};
|
||||
|
||||
// Add style-sheet for the WYSIWYG
|
||||
|
|
@ -219,15 +218,15 @@
|
|||
var ckeApp = $('#ckeditor_instance_{$editor_sequence}').XeCkEditor(settings);
|
||||
|
||||
// Add use_editor and use_html fields to parent form.
|
||||
var parentform = $('#ckeditor_instance_{$editor_sequence}').parents('form');
|
||||
var parentform = $('#ckeditor_instance_{$editor_sequence}').closest('form');
|
||||
var use_editor = parentform.find("input[name='use_editor']");
|
||||
var use_html = parentform.find("input[name='use_html']");
|
||||
if (use_editor.size()) {
|
||||
if (use_editor.length) {
|
||||
use_editor.val("Y");
|
||||
} else {
|
||||
parentform.append('<input type="hidden" name="use_editor" value="Y" />');
|
||||
}
|
||||
if (use_html.size()) {
|
||||
if (use_html.length) {
|
||||
use_html.val("Y");
|
||||
} else {
|
||||
parentform.append('<input type="hidden" name="use_html" value="Y" />');
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
function reloadUploader(editor_sequence) {
|
||||
var container = $('#xefu-container-' + editor_sequence);
|
||||
if (container.length) {
|
||||
container.data('instance').loadFilelist($container);
|
||||
container.data('instance').loadFilelist(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,12 +70,12 @@
|
|||
|
||||
// Load editor info.
|
||||
var editor = $(this);
|
||||
var editor_sequence = editor.data('editor-sequence');
|
||||
var content_key = editor.data('editor-content-key-name');
|
||||
var primary_key = editor.data('editor-primary-key-name');
|
||||
var editor_sequence = editor.data('editorSequence');
|
||||
var content_key = editor.data('editorContentKeyName');
|
||||
var primary_key = editor.data('editorPrimaryKeyName');
|
||||
var insert_form = editor.closest('form');
|
||||
var content_input = insert_form.find('input,textarea').filter('[name=' + content_key + ']');
|
||||
var editor_height = editor.data('editor-height');
|
||||
var editor_height = editor.data('editorHeight');
|
||||
if (editor_height) {
|
||||
editor.css('height', editor_height + 'px');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
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 content_key = textarea.data("editorContentKeyName");
|
||||
var primary_key = textarea.data("editorPrimaryKeyName");
|
||||
var insert_form = textarea.closest("form");
|
||||
var content_input = insert_form.find("input[name='" + content_key + "']");
|
||||
var content = "";
|
||||
|
||||
|
||||
// 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()) {
|
||||
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());
|
||||
|
|
@ -41,4 +41,4 @@ function editorTextarea(editor_sequence) {
|
|||
});
|
||||
editor_resize_iframe.height(textarea.height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue