bonny/WordPress-Simple-Fields — pull request #81 by studioanino (2013-03-02 03:31:13+00:00)
Title: Preserves repeatable TinyMCE fields on re-ordering

TinyMCE field content buffering doesn't work so well on WP versions newer than 3.4.2. I tested on 3.5, 3.5.1, and nightlies for the past week. The problem could have been introduced through newer versions of TinyMCE, jQuery, jQuery UI or WP code.

My solution follows TinyMCE guidelines for moving editor instances in the DOM. It then applies whatever is in the editor since this often differs from what TinyMCE has in memory; mostly due to WP's own live formatting in the editor.

This also fixes issue #73 ("Repeatable fields and loss of data on update"), a really serious bug if using multiple TinyMCE fields.

Lastly it's important to note that data loss can still occur if user attempts to drag the whole metabox. Options include disabling this action outright or running similar buffering for that 'sortable' event.