Changeset 16159
- Timestamp:
- 11/02/2010 11:25:24 PM (15 years ago)
- Location:
- trunk/wp-includes/js/tinymce
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
r15940 r16159 67 67 // Advanced Options 68 68 inputs.openInNewTab = $('#link-target-checkbox'); 69 // Types70 inputs.typeDropdown = $('#link-type');71 inputs.typeOptions = inputs.typeDropdown.find('option');72 69 73 70 panels = $('.link-panel'); 74 71 active = $('.link-panel-active'); 75 76 // Extract type names77 inputs.typeOptions.each( function(){78 var linkType = this.id.replace(/^link-option-id-/,''),79 parts = linkType.split('-');80 $(this).data( 'link-type', {81 full : linkType,82 type : parts[0],83 name : parts[1] || ''84 });85 });72 $('#link-panel-tab-bar').wpTabs({ 73 show: function(e, widget) { 74 active = widget.panel; 75 active.addClass('link-panel-active'); 76 wpLink.maybeLoadPanel(); 77 }, 78 hide: function(e, widget) { 79 active.removeClass('link-panel-active'); 80 } 81 }) 82 86 83 panels.each( function(){ 87 84 var linkType = this.id.replace(/^link-panel-id-/,''), … … 95 92 96 93 // Bind event handlers 97 inputs.typeDropdown.change( wpLink.selectPanel );98 94 $('#wp-update').click( wpLink.update ); 99 95 $('#wp-cancel').click( function() { tinyMCEPopup.close(); } ); … … 108 104 return; 109 105 110 // @TODO: select proper panel/fill values when a link is edited111 106 active.find('input.url-field').val( e.href ); 112 107 inputs.title.val( ed.dom.getAttrib(e, 'title') ); … … 194 189 }, 195 190 196 selectPanel : function( option ) {197 var sel = inputs.typeOptions.filter(':selected');198 199 if ( option.jquery ) {200 sel.removeAttr('selected');201 sel = option.attr('selected', 'selected');202 }203 204 active.removeClass('link-panel-active');205 active = $('#link-panel-id-' + sel.data('link-type').full ).addClass('link-panel-active');206 wpLink.maybeLoadPanel();207 },208 209 191 maybeLoadPanel : function() { 210 192 var panel = active.find('.wp-tab-panel:visible'); -
trunk/wp-includes/js/tinymce/wp-mce-link-includes.php
r15943 r16159 3 3 class WP_Tab_Bar { 4 4 var $tabs = array(); 5 6 var $id = ''; 7 var $classes = array(); 5 8 6 9 var $selected = ''; … … 22 25 $this->selected = $this->tabs[0]['for']; 23 26 24 $out = "<ul class='wp-tab-bar'>"; 27 array_unshift( $this->classes, 'wp-tab-bar' ); 28 29 $out = "<ul id='$this->id' class='" . esc_attr( implode( ' ', $this->classes ) ) . "'>"; 25 30 foreach( $this->tabs as $tab ) { 26 31 if ( !isset($tab['url']) ) -
trunk/wp-includes/js/tinymce/wp-mce-link.php
r15943 r16159 50 50 border-bottom: 1px solid #dfdfdf; 51 51 } 52 #link-header { 53 padding-bottom: 0; 54 background: #fff; 55 } 56 #link-panel-tab-bar li { 57 font-weight: bold; 58 border: #dfdfdf solid; 59 margin-right: 5px; 60 border-width: 1px 1px 0; 61 } 62 #link-panel-tab-bar .wp-tab-active { 63 border-color:#ccc; 64 background-color: #f1f1f1; 65 } 66 52 67 #link-type { 53 68 width: 140px; … … 156 171 </head> 157 172 <?php 158 159 $pts = get_post_types( array( 'public' => true ), 'objects' ); 173 // @TODO: Support custom post types. 174 // $pts = get_post_types( array( 'public' => true ), 'objects' ); 175 $pts = array( get_post_type_object( 'post' ), get_post_type_object( 'page' ) ); 160 176 $queries = array( 161 177 array( 'preset' => 'all', 'label' => __('View All') ), … … 164 180 ); 165 181 182 $tb = new WP_Tab_Bar(); 183 $tb->id = 'link-panel-tab-bar'; 184 $tb->add( 'link-panel-id-custom', __('External Link') ); 185 foreach( $pts as $pt ) { 186 $tb->add( "link-panel-id-pt-$pt->name", $pt->labels->singular_name ); 187 } 188 189 166 190 ?> 167 191 <body id="post-body"> 168 192 <div id="link-header"> 169 <label for="link-type"> 170 <span><strong><?php _e('Link Type:'); ?></strong> 171 </span><select id="link-type"> 172 <option id="link-option-id-custom" class="link-custom"><?php _e('External Link'); ?></option> 173 <?php 174 foreach ( $pts as $pt ) { 175 echo "<option id='link-option-id-pt-$pt->name' class='link-option-pt'>"; 176 echo $pt->labels->singular_name . '</option>'; 177 } ?> 178 </select> 179 </label> 193 <?php $tb->render(); ?> 180 194 </div> 181 195 <div id="link-selector">
Note: See TracChangeset
for help on using the changeset viewer.