diff --git wp-admin/js/editor.js wp-admin/js/editor.js
index a63a51c..5f45e52 100644
|
|
|
484 | 484 | } ); |
485 | 485 | } |
486 | 486 | |
| 487 | /** |
| 488 | * @summary Re-init editors in metaboxes. |
| 489 | * |
| 490 | * @since 4.8.0 |
| 491 | * |
| 492 | * @memberof switchEditors |
| 493 | * |
| 494 | * @returns {void} |
| 495 | */ |
| 496 | function reinit_metabox_editors() { |
| 497 | // We check the context. |
| 498 | if ( ! tinymce || 'object' !== typeof tinymce ) { |
| 499 | return; |
| 500 | } |
| 501 | // We get all instances of the editors. |
| 502 | var editors = tinymce.get(); |
| 503 | // We iterate through the list of editors. |
| 504 | $.each( editors, function( index, editor ) { |
| 505 | // We ignore the main editor and make sure the editor is in a metabox. |
| 506 | if ( 'content' !== editor.id && $( editor.editorContainer ).parents( '.meta-box-sortables' ).length === 1 ) { |
| 507 | // Check if we are displaying Quicktags or TinyMCE. |
| 508 | if ( ! editor.isHidden() ) { |
| 509 | // If tinyMCE we save (localy) the content. |
| 510 | editor.save(); |
| 511 | } |
| 512 | // Remove the instance of the editor. |
| 513 | tinymce.remove( editor ); |
| 514 | // And then re-init it. |
| 515 | tinymce.init( tinyMCEPreInit.mceInit[ editor.id ] ); |
| 516 | // If we were viewing Quicktags we switch back to the tab. |
| 517 | if ( editor.isHidden() ) { |
| 518 | $( '#' + editor.id + '-html' ).click(); |
| 519 | } |
| 520 | } |
| 521 | }); |
| 522 | } |
| 523 | |
487 | 524 | window.wp = window.wp || {}; |
488 | 525 | window.wp.editor = window.wp.editor || {}; |
489 | 526 | window.wp.editor.autop = wpautop; |
490 | 527 | window.wp.editor.removep = pre_wpautop; |
| 528 | window.wp.editor.reinit_metabox_editors = reinit_metabox_editors; |
491 | 529 | |
492 | 530 | exports = { |
493 | 531 | go: switchEditor, |
494 | 532 | wpautop: wpautop, |
495 | 533 | pre_wpautop: pre_wpautop, |
| 534 | reinit_metabox_editors: reinit_metabox_editors, |
496 | 535 | _wp_Autop: autop, |
497 | 536 | _wp_Nop: removep |
498 | 537 | }; |
diff --git wp-admin/js/postbox.js wp-admin/js/postbox.js
index bbc73b2..75e9e13 100644
|
|
var postboxes; |
240 | 240 | } |
241 | 241 | |
242 | 242 | postboxes.save_order(page); |
| 243 | |
| 244 | // If DOM is reordered we re-init potential WYSIWYG editors. |
| 245 | if ( 'function' === typeof wp.editor.reinit_metabox_editors ) { |
| 246 | wp.editor.reinit_metabox_editors(); |
| 247 | } |
243 | 248 | }, |
244 | 249 | receive: function(e,ui) { |
245 | 250 | if ( 'dashboard_browser_nag' == ui.item[0].id ) |