Changeset 9019
- Timestamp:
- 09/28/08 14:21:00 (3 months ago)
- Files:
-
- trunk/wp-admin/js/editor.js (modified) (6 diffs)
- trunk/wp-includes/general-template.php (modified) (1 diff)
- trunk/wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/js/editor.js
r8784 r9019 1 1 2 2 switchEditors = { 3 4 mode : '', 3 5 4 6 I : function(e) { … … 10 12 11 13 // Activate TinyMCE if it's the user's default editor 12 if ( getUserSetting( 'editor', 'tinymce' ) == 'tinymce' ) { 13 try { P.onclick = ''; P.className = 'active'; } catch(e){}; 14 try { this.I('editorcontainer').style.padding = '0px'; } catch(e){}; 15 try { this.I("quicktags").style.display = "none"; } catch(e){}; 16 tinyMCE.execCommand("mceAddControl", false, "content"); 17 } else { 18 try { H.onclick = ''; H.className = 'active'; } catch(e){}; 14 if ( getUserSetting( 'editor' ) == 'html' ) { 19 15 if ( h ) 20 16 try { this.I('content').style.height = h.ch - 30 + 'px'; } catch(e){}; 17 } else { 18 try { 19 this.I('editorcontainer').style.padding = '0px'; 20 this.I("quicktags").style.display = "none"; 21 } catch(e){}; 22 tinyMCE.execCommand("mceAddControl", false, "content"); 21 23 } 22 24 }, … … 90 92 }, 91 93 92 go : function(id) { 93 var ed = tinyMCE.get(id); 94 go : function(id, mode) { 95 id = id || 'content'; 96 mode = mode || this.mode || ''; 97 98 var ed = tinyMCE.get(id) || false; 94 99 var qt = this.I('quicktags'); 95 100 var H = this.I('edButtonHTML'); … … 98 103 var ec = (ta.parentNode && ta.parentNode.nodeName == 'DIV') ? ta.parentNode : ''; 99 104 100 if ( ! ed || ed.isHidden() ) { 105 if ( 'tinymce' == mode ) { 106 107 if ( ed && ! ed.isHidden() ) 108 return false; 109 110 this.mode = 'html'; 101 111 ta.style.color = '#fff'; 102 112 103 this.edToggle(P, H); 113 P.className = 'active'; 114 H.className = ''; 104 115 edCloseAllTags(); // :-( 105 116 … … 116 127 setUserSetting( 'editor', 'tinymce' ); 117 128 } else { 118 this.edToggle(H, P); 129 if ( ! ed || ed.isHidden() ) 130 return false; 131 132 this.mode = 'tinymce'; 133 H.className = 'active'; 134 P.className = ''; 135 119 136 ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px'; 120 137 … … 136 153 setUserSetting( 'editor', 'html' ); 137 154 } 138 }, 139 140 edToggle : function(A, B) { 141 A.className = 'active'; 142 B.className = ''; 143 144 B.onclick = A.onclick; 145 A.onclick = null; 155 return false; 146 156 }, 147 157 trunk/wp-includes/general-template.php
r8929 r9019 1431 1431 $wp_default_editor = wp_default_editor(); ?> 1432 1432 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div> 1433 <?php if ( 'tinymce' == $wp_default_editor ) { 1433 <?php if ( 'html' == $wp_default_editor ) { 1434 add_filter('the_editor_content', 'wp_htmledit_pre'); ?> 1435 <a id="edButtonHTML" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a> 1436 <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a> 1437 <?php } else { 1434 1438 add_filter('the_editor_content', 'wp_richedit_pre'); ?> 1435 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a> 1436 <a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a> 1437 <?php } elseif ( 'html' == $wp_default_editor ) { 1438 add_filter('the_editor_content', 'wp_htmledit_pre'); ?> 1439 <a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a> 1440 <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a> 1441 <?php } 1439 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a> 1440 <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a> 1441 <?php } 1442 1442 } 1443 1443 trunk/wp-includes/script-loader.php
r8988 r9019 67 67 $scripts->add( 'editor', false, $visual_editor, '20080321' ); 68 68 69 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080 823' );69 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080928' ); 70 70 71 71 // Modify this version when tinyMCE plugins are changed.
