Ensure default editor is selected
git-svn-id: http://svn.automattic.com/wordpress/trunk@9019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d419fdb777
commit
72df1fc525
|
@ -1,6 +1,8 @@
|
|||
|
||||
switchEditors = {
|
||||
|
||||
mode : '',
|
||||
|
||||
I : function(e) {
|
||||
return document.getElementById(e);
|
||||
},
|
||||
|
@ -9,15 +11,15 @@ switchEditors = {
|
|||
var h = tinymce.util.Cookie.getHash("TinyMCE_content_size"), H = this.I('edButtonHTML'), P = this.I('edButtonPreview');
|
||||
|
||||
// Activate TinyMCE if it's the user's default editor
|
||||
if ( getUserSetting( 'editor', 'tinymce' ) == 'tinymce' ) {
|
||||
try { P.onclick = ''; P.className = 'active'; } catch(e){};
|
||||
try { this.I('editorcontainer').style.padding = '0px'; } catch(e){};
|
||||
try { this.I("quicktags").style.display = "none"; } catch(e){};
|
||||
tinyMCE.execCommand("mceAddControl", false, "content");
|
||||
} else {
|
||||
try { H.onclick = ''; H.className = 'active'; } catch(e){};
|
||||
if ( getUserSetting( 'editor' ) == 'html' ) {
|
||||
if ( h )
|
||||
try { this.I('content').style.height = h.ch - 30 + 'px'; } catch(e){};
|
||||
} else {
|
||||
try {
|
||||
this.I('editorcontainer').style.padding = '0px';
|
||||
this.I("quicktags").style.display = "none";
|
||||
} catch(e){};
|
||||
tinyMCE.execCommand("mceAddControl", false, "content");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -89,18 +91,27 @@ switchEditors = {
|
|||
return content;
|
||||
},
|
||||
|
||||
go : function(id) {
|
||||
var ed = tinyMCE.get(id);
|
||||
go : function(id, mode) {
|
||||
id = id || 'content';
|
||||
mode = mode || this.mode || '';
|
||||
|
||||
var ed = tinyMCE.get(id) || false;
|
||||
var qt = this.I('quicktags');
|
||||
var H = this.I('edButtonHTML');
|
||||
var P = this.I('edButtonPreview');
|
||||
var ta = this.I(id);
|
||||
var ec = (ta.parentNode && ta.parentNode.nodeName == 'DIV') ? ta.parentNode : '';
|
||||
|
||||
if ( ! ed || ed.isHidden() ) {
|
||||
if ( 'tinymce' == mode ) {
|
||||
|
||||
if ( ed && ! ed.isHidden() )
|
||||
return false;
|
||||
|
||||
this.mode = 'html';
|
||||
ta.style.color = '#fff';
|
||||
|
||||
this.edToggle(P, H);
|
||||
P.className = 'active';
|
||||
H.className = '';
|
||||
edCloseAllTags(); // :-(
|
||||
|
||||
qt.style.display = 'none';
|
||||
|
@ -115,7 +126,13 @@ switchEditors = {
|
|||
|
||||
setUserSetting( 'editor', 'tinymce' );
|
||||
} else {
|
||||
this.edToggle(H, P);
|
||||
if ( ! ed || ed.isHidden() )
|
||||
return false;
|
||||
|
||||
this.mode = 'tinymce';
|
||||
H.className = 'active';
|
||||
P.className = '';
|
||||
|
||||
ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
|
||||
|
||||
ed.hide();
|
||||
|
@ -135,14 +152,7 @@ switchEditors = {
|
|||
ta.style.color = '';
|
||||
setUserSetting( 'editor', 'html' );
|
||||
}
|
||||
},
|
||||
|
||||
edToggle : function(A, B) {
|
||||
A.className = 'active';
|
||||
B.className = '';
|
||||
|
||||
B.onclick = A.onclick;
|
||||
A.onclick = null;
|
||||
return false;
|
||||
},
|
||||
|
||||
wpautop : function(pee) {
|
||||
|
|
|
@ -1430,14 +1430,14 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
|
|||
<?php if ( user_can_richedit() ) {
|
||||
$wp_default_editor = wp_default_editor(); ?>
|
||||
<div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
|
||||
<?php if ( 'tinymce' == $wp_default_editor ) {
|
||||
add_filter('the_editor_content', 'wp_richedit_pre'); ?>
|
||||
<a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a>
|
||||
<a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a>
|
||||
<?php } elseif ( 'html' == $wp_default_editor ) {
|
||||
<?php if ( 'html' == $wp_default_editor ) {
|
||||
add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
|
||||
<a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
|
||||
<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
|
||||
<a id="edButtonHTML" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
|
||||
<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
|
||||
<?php } else {
|
||||
add_filter('the_editor_content', 'wp_richedit_pre'); ?>
|
||||
<a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
|
||||
<a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
|
||||
<?php }
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$visual_editor = apply_filters('visual_editor', array('tiny_mce'));
|
||||
$scripts->add( 'editor', false, $visual_editor, '20080321' );
|
||||
|
||||
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080823' );
|
||||
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080928' );
|
||||
|
||||
// Modify this version when tinyMCE plugins are changed.
|
||||
$mce_version = apply_filters('tiny_mce_version', '20080830');
|
||||
|
|
Loading…
Reference in New Issue