Changeset 27642
- Timestamp:
- 03/20/2014 10:22:25 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/js/media-audiovideo.js (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-audiovideo.js
r27640 r27642 821 821 }, 822 822 823 /** 824 * Remove a setting's UI when the model unsets it 825 * 826 * @fires wp.media.view.MediaDetails#media:setting:remove 827 * 828 * @param {Event} e 829 */ 823 830 removeSetting : function (e) { 824 831 var wrap = $( e.currentTarget ).parent(), setting; … … 834 841 }, 835 842 843 /** 844 * 845 * @fires wp.media.view.MediaDetails#media:setting:remove 846 */ 836 847 setTracks : function () { 837 848 var tracks = ''; … … 845 856 }, 846 857 858 /** 859 * @global MediaElementPlayer 860 */ 847 861 setPlayer : function () { 848 862 if ( ! this.player && this.media ) { … … 870 884 }, 871 885 886 /** 887 * @global _wpmejsSettings 888 * 889 * @returns {media.view.MediaDetails} Returns itself to allow chaining 890 */ 872 891 render: function() { 873 892 var self = this, settings = { … … 986 1005 /** 987 1006 * Determine how many audio and video files the user has uploaded 1007 * 1008 * @global wp.media.view.settings 1009 * 1010 * @param {Object} settings 1011 * @returns {Object} 988 1012 */ 989 1013 counts : (function (settings) { … … 1108 1132 } ); 1109 1133 1134 /** 1135 * Tiny MCE Views 1136 * 1137 */ 1138 1139 /** 1140 * These are base methods that are shared by each shortcode's MCE controller 1141 * 1142 * @mixin 1143 */ 1110 1144 wp.mce.media = { 1145 /** 1146 * @global wp.shortcode 1147 * 1148 * @param {string} content 1149 * @returns {Object} 1150 */ 1111 1151 toView: function( content ) { 1112 1152 var match = wp.shortcode.next( this.shortcode, content ); … … 1125 1165 }, 1126 1166 1167 /** 1168 * Called when a TinyMCE view is clicked for editing. 1169 * - Parses the shortcode out of the element's data attribute 1170 * - Calls the `edit` method on the shortcode model 1171 * - Launches the model window 1172 * - Bind's an `update` callback which updates the element's data attribute 1173 * re-renders the view 1174 * 1175 * @param {HTMLElement} node 1176 */ 1127 1177 edit: function( node ) { 1128 1178 var media = wp.media[ this.shortcode ], … … 1147 1197 }; 1148 1198 1199 /** 1200 * Base View class for audio and video shortcodes 1201 * 1202 * @constructor 1203 * @augments wp.mce.View 1204 * @mixes wp.media.mixin 1205 */ 1149 1206 wp.mce.media.View = wp.mce.View.extend({ 1150 1207 initialize: function( options ) { … … 1154 1211 }, 1155 1212 1213 /** 1214 * Creates the player instance for the current node 1215 * 1216 * @global MediaElementPlayer 1217 * @global _wpmejsSettings 1218 * 1219 * @param {Event} e 1220 * @param {HTMLElement} node 1221 */ 1156 1222 setPlayer: function (e, node) { 1157 1223 // if the ready event fires on an empty node … … 1199 1265 }, 1200 1266 1267 /** 1268 * Pass data to the View's Underscore template and return the compiled output 1269 * 1270 * @returns {string} 1271 */ 1201 1272 getHtml: function() { 1202 1273 var attrs = this.shortcode.attrs.named; … … 1206 1277 _.extend( wp.mce.media.View.prototype, wp.media.mixin ); 1207 1278 1279 /** 1280 * TinyMCE handler for the video shortcode 1281 * 1282 * @mixes wp.mce.media 1283 */ 1208 1284 wp.mce.video = _.extend( {}, wp.mce.media, { 1209 1285 shortcode: 'video', … … 1214 1290 }) 1215 1291 } ); 1216 1217 1292 wp.mce.views.register( 'video', wp.mce.video ); 1218 1293 1294 /** 1295 * TinyMCE handler for the audio shortcode 1296 * 1297 * @mixes wp.mce.media 1298 */ 1219 1299 wp.mce.audio = _.extend( {}, wp.mce.media, { 1220 1300 shortcode: 'audio', … … 1225 1305 }) 1226 1306 } ); 1227 1228 1307 wp.mce.views.register( 'audio', wp.mce.audio ); 1229 1308 1309 /** 1310 * Base View class for playlist shortcodes 1311 * 1312 * @constructor 1313 * @augments wp.mce.View 1314 * @mixes wp.media.mixin 1315 */ 1230 1316 wp.mce.media.PlaylistView = wp.mce.View.extend({ 1231 1317 className: 'editor-playlist', … … 1240 1326 }, 1241 1327 1328 /** 1329 * Set the element context for the view, and then fetch the playlist's 1330 * associated attachments. 1331 * 1332 * @param {Event} e 1333 * @param {HTMLElement} node 1334 */ 1242 1335 setNode: function (e, node) { 1243 1336 this.node = node; … … 1245 1338 }, 1246 1339 1340 /** 1341 * Asynchronously fetch the shortcode's attachments 1342 */ 1247 1343 fetch: function() { 1248 1344 this.attachments = wp.media[ this.shortcode.tag ].attachments( this.shortcode ); … … 1250 1346 }, 1251 1347 1348 /** 1349 * Get the HTML for the view (which also set's the data), replace the 1350 * current HTML, and then invoke the WPPlaylistView instance to render 1351 * the playlist in the editor 1352 * 1353 * @global WPPlaylistView 1354 * @global tinymce.editors 1355 */ 1252 1356 setPlayer: function () { 1253 1357 var p, … … 1278 1382 }, 1279 1383 1384 /** 1385 * Set the data that will be used to compile the Underscore template, 1386 * compile the template, and then return it. 1387 * 1388 * @returns {string} 1389 */ 1280 1390 getHtml: function() { 1281 1391 var data = this.shortcode.attrs.named, … … 1344 1454 _.extend( wp.mce.media.PlaylistView.prototype, wp.media.mixin ); 1345 1455 1456 /** 1457 * TinyMCE handler for the playlist shortcode 1458 * 1459 * @mixes wp.mce.media 1460 */ 1346 1461 wp.mce.playlist = _.extend( {}, wp.mce.media, { 1347 1462 shortcode: 'playlist', … … 1349 1464 View: wp.mce.media.PlaylistView 1350 1465 } ); 1351 1352 1466 wp.mce.views.register( 'playlist', wp.mce.playlist ); 1353 1467 1468 /** 1469 * TinyMCE handler for the video-playlist shortcode 1470 * 1471 * @mixes wp.mce.media 1472 */ 1354 1473 wp.mce['video-playlist'] = _.extend( {}, wp.mce.media, { 1355 1474 shortcode: 'video-playlist', … … 1357 1476 View: wp.mce.media.PlaylistView 1358 1477 } ); 1359 1360 1478 wp.mce.views.register( 'video-playlist', wp.mce['video-playlist'] ); 1361 1479 1480 /** 1481 * Event binding 1482 */ 1362 1483 function init() { 1363 1484 $(document.body)
Note: See TracChangeset
for help on using the changeset viewer.