Changeset 16439
- Timestamp:
- 11/17/2010 06:48:27 PM (14 years ago)
- Location:
- trunk/wp-includes/js/tinymce
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
r16399 r16439 27 27 cmd : 'WP_Link' 28 28 }); 29 29 30 30 ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link'); 31 31 -
trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
r16407 r16439 1 (function($){ 1 (function($){ 2 2 var inputs = {}, results = {}, ed, 3 3 wpLink = { … … 16 16 // Init shared vars 17 17 ed = tinyMCEPopup.editor; 18 19 18 19 20 20 // URL 21 21 inputs.url = $('#url-field'); … … 30 30 results.search.data('river', wpLink.riverDefaults() ); 31 31 results.recent.data('river', wpLink.riverDefaults() ); 32 32 33 33 // Bind event handlers 34 34 $('#wp-update').click( wpLink.update ); … … 47 47 inputs.openInNewTab.attr('checked','checked'); 48 48 } 49 49 50 50 // Focus the URL field 51 51 inputs.url.focus(); 52 52 }, 53 53 54 54 update : function() { 55 55 var el, … … 61 61 }, e, b, 62 62 defaultContent = attrs.title ? attrs.title : attrs.href; 63 63 64 64 tinyMCEPopup.restoreSelection(); 65 65 e = ed.dom.getParent(ed.selection.getNode(), 'A'); 66 66 67 67 // If the values are empty... 68 68 if ( ! attrs.href ) { … … 82 82 } 83 83 } 84 84 85 85 tinyMCEPopup.execCommand("mceBeginUndoLevel"); 86 86 87 87 if (e == null) { 88 88 ed.getDoc().execCommand("unlink", false, null); 89 89 90 90 // If no selection exists, create a new link from scratch. 91 91 if ( ed.selection.isCollapsed() ) { … … 118 118 tinyMCEPopup.close(); 119 119 }, 120 120 121 121 selectInternalLink : function() { 122 122 var t = $(this); … … 128 128 inputs.title.val( t.children('.item-title').text() ); 129 129 }, 130 130 131 131 maybeLoadRiver : function() { 132 132 var t = $(this), … … 134 134 river = t.data('river'), 135 135 bottom = t.scrollTop() + t.height(); 136 136 137 137 if ( bottom != ul.height() || river.active || river.allLoaded ) 138 138 return; 139 139 140 140 setTimeout(function() { 141 141 var newTop = t.scrollTop(), 142 142 newBottom = newTop + t.height(), 143 143 waiting = t.find('.river-waiting'); 144 144 145 145 if ( bottom != newBottom || newBottom != ul.height() || river.active || river.allLoaded ) 146 146 return; 147 147 148 148 river.active = true; 149 149 waiting.show(); … … 164 164 var t = $(this), waiting, 165 165 title = t.val(); 166 166 167 167 if ( title.length > 2 ) { 168 168 results.recent.hide(); 169 169 results.search.show(); 170 170 171 171 // Don't search if the keypress didn't change the title. 172 172 if ( wpLink.lastSearch == title ) 173 173 return; 174 174 175 175 wpLink.lastSearch = title; 176 176 waiting = t.siblings('img.waiting').show(); 177 177 178 178 results.search.data('river', wpLink.riverDefaults() ); 179 179 results.search.scrollTop(0); … … 184 184 } 185 185 }, 186 186 187 187 linkAJAX : function( $panel, params, callback, opts ) { 188 188 var response; 189 189 opts = opts || {}; 190 190 191 191 if ( ! $panel.hasClass('query-results') ) 192 192 $panel = $panel.parents('.query-results'); 193 193 194 194 if ( ! $panel.length ) 195 195 return; 196 196 197 197 response = wpLink.delayedCallback( function( results ) { 198 198 wpLink.processAJAXResponse( $panel, results, callback, opts ); 199 199 }, opts.delay ); 200 200 201 201 $.post( ajaxurl, $.extend({ 202 202 action : 'wp-link-ajax' 203 203 }, params ), response, "json" ); 204 204 }, 205 205 206 206 processAJAXResponse: function( $panel, results, callback, opts ) { 207 207 var list = ''; 208 208 209 209 if ( !results ) { 210 210 if ( !opts.append ) { … … 221 221 }); 222 222 } 223 223 224 224 // Set results 225 225 $panel.children('ul')[ opts.append ? 'append' : 'html' ]( list ); 226 226 227 227 // Run callback 228 228 if ( callback ) 229 229 callback( results ); 230 230 }, 231 231 232 232 delayedCallback : function( func, delay ) { 233 233 var timeoutTriggered, funcTriggered, funcArgs, funcContext; 234 234 235 235 if ( ! delay ) 236 236 return func; 237 237 238 238 setTimeout( function() { 239 239 if ( funcTriggered ) … … 242 242 timeoutTriggered = true; 243 243 }, delay); 244 244 245 245 return function() { 246 246 if ( timeoutTriggered ) … … 253 253 } 254 254 } 255 255 256 256 $(document).ready( wpLink.init ); 257 257 })(jQuery); -
trunk/wp-includes/js/tinymce/wp-mce-link-includes.php
r16399 r16439 4 4 $pts = get_post_types( array( 'publicly_queryable' => true ), 'objects' ); 5 5 $pt_names = array_keys( $pts ); 6 6 7 7 $query = array( 8 8 'post_type' => $pt_names, … … 29 29 if ( ! $get_posts->post_count ) 30 30 return false; 31 31 32 32 // Build results. 33 33 $results = array(); … … 37 37 else 38 38 $info = $pts[ $post->post_type ]->labels->singular_name; 39 39 40 40 $results[] = array( 41 41 'ID' => $post->ID, … … 59 59 if ( ! isset( $results ) ) 60 60 die( '0' ); 61 61 62 62 echo json_encode( $results ); 63 63 echo "\n";
Note: See TracChangeset
for help on using the changeset viewer.