以下的說明: http://www.farinspace.com/multiple-wordpress-wysiwyg-visual-editors/jQuery的UI與TinyMCE的編輯div的排序導致文本消失
我在我的metaboxes得到了一些不錯的所見即所得的編輯器
我的標記看起來像:
<div class="sortable">
<div class="sortme">
<?php $mb->the_field('extra_content2'); ?>
<div class="customEditor"><textarea name="<?php $mb->the_name(); ?>"><?php echo wp_richedit_pre($mb->get_the_value()); ?></textarea></div>
</div>
<div class="sortme"
<?php $mb->the_field('extra_content3'); ?>
<div class="customEditor"><textarea name="<?php $mb->the_name(); ?>"><?php echo wp_richedit_pre($mb->get_the_value()); ?></textarea></div>
</div>
</div>
這僅僅是WP_alchemy(也來自farinspace.com),用於包裹在一個div
一個textarea和腳本第在告訴tinymce踢:
function my_admin_print_footer_scripts()
{
?><script type="text/javascript">/* <![CDATA[ */
jQuery(function($)
{
var i=1;
$('.customEditor textarea').each(function(e)
{
var id = $(this).attr('id');
if (!id)
{
id = 'customEditor-' + i++;
$(this).attr('id',id);
}
tinyMCE.execCommand('mceAddControl', false, id);
});
});
/* ]]> */</script><?php
}
// important: note the priority of 99, the js needs to be placed after tinymce loads
add_action('admin_print_footer_scripts','my_admin_print_footer_scripts',99);
該部分工作正常。但是當我嘗試在jQueryUI的排序踢:
$('.sortable').sortable();
它讓我多.sortme div的排序,但在編輯器中的內容消失。我怎樣才能使文本持久?它在沒有tinymce編輯器的情況下工作得很好,所以我認爲這是一個衝突w /不知何故。
看似重複http://stackoverflow.com/questions/3919928/tinymce的-instances-jQuery排序 – 2015-08-11 18:09:34