Fix TimyMCE init when launching DFW and respect wpautop setting there, see #17144
git-svn-id: http://svn.automattic.com/wordpress/trunk@18609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
39ba82bb3f
commit
12c6ba5771
|
@ -335,33 +335,39 @@ PubSub.prototype.publish = function( topic, args ) {
|
|||
});
|
||||
|
||||
ps.subscribe( 'shown', function() { // This event occurs after the DFW overlay is shown
|
||||
var interim_init;
|
||||
|
||||
s.visible = true;
|
||||
|
||||
// init the standard TinyMCE instance if missing
|
||||
if ( s.has_tinymce && ! s.is_mce_on ) {
|
||||
htmled = document.getElementById(s.editor_id), old_val = htmled.value;
|
||||
|
||||
htmled.value = switchEditors.wpautop( old_val );
|
||||
interim_init = function(mce, ed) {
|
||||
var el = ed.getElement(), old_val = el.value, settings = tinyMCEPreInit.mceInit[s.editor_id];
|
||||
|
||||
if ( settings && settings.wpautop && typeof(switchEditors) != 'undefined' )
|
||||
el.value = switchEditors.wpautop( el.value );
|
||||
|
||||
tinyMCE.settings.setup = function(ed) {
|
||||
ed.onInit.add(function(ed) {
|
||||
ed.hide();
|
||||
delete tinyMCE.settings.setup;
|
||||
ed.getElement().value = old_val;
|
||||
tinymce.onAddEditor.remove(interim_init);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
tinymce.onAddEditor.add(interim_init);
|
||||
tinyMCE.init(tinyMCEPreInit.mceInit[s.editor_id]);
|
||||
|
||||
s.is_mce_on = true;
|
||||
}
|
||||
});
|
||||
|
||||
ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW.
|
||||
|
||||
var htmled_is_hidden = $('#' + s.editor_id).is(':hidden');
|
||||
// Make sure the correct editor is displaying.
|
||||
if ( s.has_tinymce && s.mode === 'tinymce' && $('#' + s.editor_id).is(':visible') ) {
|
||||
if ( s.has_tinymce && s.mode === 'tinymce' && !htmled_is_hidden ) {
|
||||
switchEditors.go( $('#'+s.editor_id+'-tmce').get(0) );
|
||||
} else if ( s.mode === 'html' && $('#' + s.editor_id).is(':hidden') ) {
|
||||
} else if ( s.mode === 'html' && htmled_is_hidden ) {
|
||||
switchEditors.go( $('#'+s.editor_id+'-html').get(0) );
|
||||
}
|
||||
|
||||
|
@ -407,6 +413,8 @@ PubSub.prototype.publish = function( topic, args ) {
|
|||
ed = tinyMCE.get('wp_mce_fullscreen');
|
||||
|
||||
if ( from === 'html' && to === 'tinymce' ) {
|
||||
|
||||
if ( tinyMCE.get(s.editor_id).getParam('wpautop') && typeof(switchEditors) != 'undefined' )
|
||||
s.textarea_obj.value = switchEditors.wpautop( s.textarea_obj.value );
|
||||
|
||||
if ( 'undefined' == typeof(ed) )
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -86,7 +86,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110820', 1 );
|
||||
|
||||
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110802', 1 );
|
||||
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110826', 1 );
|
||||
|
||||
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
|
||||
|
||||
|
|
Loading…
Reference in New Issue