Changeset 29739
- Timestamp:
- 09/12/2014 03:35:15 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r29722 r29739 97 97 * Activate a mode. 98 98 * 99 * @since 3.5.0 100 * 99 101 * @param {string} mode 100 102 * … … 137 139 /** 138 140 * Render a mode. 141 * 142 * @since 3.5.0 139 143 * 140 144 * @param {string} mode … … 185 189 * Get the region's view. 186 190 * 191 * @since 3.5.0 192 * 187 193 * @returns {wp.media.View} 188 194 */ … … 193 199 /** 194 200 * Set the region's view as a subview of the frame. 201 * 202 * @since 3.5.0 195 203 * 196 204 * @param {Array|Object} views … … 207 215 /** 208 216 * Trigger regional view events on the frame. 217 * 218 * @since 3.5.0 209 219 * 210 220 * @param {string} event … … 234 244 /** 235 245 * wp.media.controller.StateMachine 246 * 247 * @since 3.5.0 236 248 * 237 249 * @constructor … … 260 272 * can be used as a mixin. 261 273 * 274 * @since 3.5.0 275 * 262 276 * @param {string} id 263 277 * @returns {wp.media.controller.State} Returns a State model … … 282 296 * created the `states` collection, or are trying to select a state 283 297 * that does not exist. 298 * 299 * @since 3.5.0 284 300 * 285 301 * @param {string} id … … 313 329 * Call the `state()` method with no parameters to retrieve the current 314 330 * active state. 331 * 332 * @since 3.5.0 315 333 * 316 334 * @returns {wp.media.controller.State} Returns a State model … … 350 368 */ 351 369 media.controller.State = Backbone.Model.extend({ 370 /** 371 * Constructor. 372 * 373 * @since 3.5.0 374 */ 352 375 constructor: function() { 353 376 this.on( 'activate', this._preActivate, this ); … … 367 390 /** 368 391 * @abstract 392 * @since 3.5.0 369 393 */ 370 394 ready: function() {}, 395 371 396 /** 372 397 * @abstract 398 * @since 3.5.0 373 399 */ 374 400 activate: function() {}, 401 375 402 /** 376 403 * @abstract 404 * @since 3.5.0 377 405 */ 378 406 deactivate: function() {}, 407 379 408 /** 380 409 * @abstract 410 * @since 3.5.0 381 411 */ 382 412 reset: function() {}, 413 383 414 /** 384 415 * @access private 416 * @since 4.0.0 385 417 */ 386 418 _ready: function() { 387 419 this._updateMenu(); 388 420 }, 421 389 422 /** 390 423 * @access private 424 * @since 3.5.0 391 425 */ 392 426 _preActivate: function() { 393 427 this.active = true; 394 428 }, 429 395 430 /** 396 431 * @access private 432 * @since 3.5.0 397 433 */ 398 434 _postActivate: function() { … … 410 446 this._router(); 411 447 }, 448 412 449 /** 413 450 * @access private 451 * @since 3.5.0 414 452 */ 415 453 _deactivate: function() { … … 423 461 this.off( 'change:toolbar', this._toolbar, this ); 424 462 }, 463 425 464 /** 426 465 * @access private 466 * @since 3.5.0 427 467 */ 428 468 _title: function() { 429 469 this.frame.title.render( this.get('titleMode') || 'default' ); 430 470 }, 471 431 472 /** 432 473 * @access private 474 * @since 3.5.0 433 475 */ 434 476 _renderTitle: function( view ) { 435 477 view.$el.text( this.get('title') || '' ); 436 478 }, 479 437 480 /** 438 481 * @access private 482 * @since 3.5.0 439 483 */ 440 484 _router: function() { … … 455 499 } 456 500 }, 501 457 502 /** 458 503 * @access private 504 * @since 3.5.0 459 505 */ 460 506 _menu: function() { … … 475 521 } 476 522 }, 523 477 524 /** 478 525 * @access private 526 * @since 3.5.0 479 527 */ 480 528 _updateMenu: function() { … … 490 538 } 491 539 }, 540 492 541 /** 493 542 * @access private 543 * @since 3.5.0 494 544 */ 495 545 _renderMenu: function( view ) { … … 527 577 528 578 media.selectionSync = { 579 /** 580 * @since 3.5.0 581 */ 529 582 syncSelection: function() { 530 583 var selection = this.get('selection'), … … 554 607 * attachments that this specific selection considered invalid. 555 608 * Reset the difference and record the single attachment. 609 * 610 * @since 3.5.0 556 611 */ 557 612 recordSelection: function() { … … 608 663 * If a library isn't provided, query all media items. 609 664 * If a selection instance isn't provided, create one. 665 * 666 * @since 3.5.0 610 667 */ 611 668 initialize: function() { … … 638 695 }, 639 696 697 /** 698 * @since 3.5.0 699 */ 640 700 activate: function() { 641 701 this.syncSelection(); … … 651 711 }, 652 712 713 /** 714 * @since 3.5.0 715 */ 653 716 deactivate: function() { 654 717 this.recordSelection(); … … 663 726 }, 664 727 728 /** 729 * @since 3.5.0 730 */ 665 731 reset: function() { 666 732 this.get('selection').reset(); … … 669 735 }, 670 736 737 /** 738 * @since 3.5.0 739 */ 671 740 resetDisplays: function() { 672 741 var defaultProps = media.view.settings.defaultProps; … … 680 749 681 750 /** 751 * @since 3.5.0 752 * 682 753 * @param {wp.media.model.Attachment} attachment 683 754 * @returns {Backbone.Model} … … 693 764 694 765 /** 766 * @since 3.6.0 767 * 695 768 * @param {wp.media.model.Attachment} attachment 696 769 * @returns {Object} … … 705 778 706 779 /** 780 * @since 3.6.0 781 * 707 782 * @param {wp.media.model.Attachment} attachment 708 783 * @returns {Boolean} … … 725 800 * content mode is not an option in the state's router (provided 726 801 * the state has a router), reset the content mode to the default. 802 * 803 * @since 3.5.0 727 804 */ 728 805 refreshContent: function() { … … 746 823 * attachment in the upload queue). 747 824 * 825 * @since 3.5.0 826 * 748 827 * @param {wp.media.model.Attachment} attachment 749 828 */ … … 763 842 /** 764 843 * Only track the browse router on library states. 844 * 845 * @since 3.5.0 765 846 */ 766 847 saveContentMode: function() { … … 801 882 }, media.controller.Library.prototype.defaults ), 802 883 884 /** 885 * @since 3.9.0 886 * 887 * @param options Attributes 888 */ 803 889 initialize: function( options ) { 804 890 this.image = options.image; … … 806 892 }, 807 893 894 /** 895 * @since 3.9.0 896 */ 808 897 activate: function() { 809 898 this.frame.modal.$el.addClass('image-details'); … … 845 934 }, 846 935 936 /** 937 * @since 3.9.0 938 */ 847 939 initialize: function() { 848 940 // If we haven't been provided a `library`, create a `Selection`. … … 856 948 }, 857 949 950 /** 951 * since 3.9.0 952 */ 858 953 activate: function() { 859 954 var library = this.get('library'); … … 870 965 }, 871 966 967 /** 968 * @since 3.9.0 969 */ 872 970 deactivate: function() { 873 971 // Stop watching for uploaded attachments. … … 879 977 }, 880 978 979 /** 980 * @since 3.9.0 981 * 982 * @param browser 983 */ 881 984 gallerySettings: function( browser ) { 882 985 if ( ! this.get('displaySettings') ) { … … 937 1040 }, media.controller.Library.prototype.defaults ), 938 1041 1042 /** 1043 * @since 3.9.0 1044 */ 939 1045 initialize: function() { 940 1046 // If we haven't been provided a `library`, create a `Selection`. … … 945 1051 }, 946 1052 1053 /** 1054 * @since 3.9.0 1055 */ 947 1056 activate: function() { 948 1057 var library = this.get('library'), … … 999 1108 }, 1000 1109 1110 /** 1111 * @since 3.9.0 1112 */ 1001 1113 initialize: function() { 1002 1114 var collectionType = this.get('collectionType'); … … 1020 1132 }, 1021 1133 1134 /** 1135 * @since 3.9.0 1136 */ 1022 1137 activate: function() { 1023 1138 var library = this.get('library'); … … 1034 1149 }, 1035 1150 1151 /** 1152 * @since 3.9.0 1153 */ 1036 1154 deactivate: function() { 1037 1155 // Stop watching for uploaded attachments. … … 1043 1161 }, 1044 1162 1163 /** 1164 * @since 3.9.0 1165 * 1166 * @param browser 1167 */ 1045 1168 renderSettings: function( browser ) { 1046 1169 var library = this.get('library'), … … 1101 1224 }, media.controller.Library.prototype.defaults ), 1102 1225 1226 /** 1227 * @since 3.9.0 1228 */ 1103 1229 initialize: function() { 1104 1230 var collectionType = this.get('collectionType'); … … 1119 1245 }, 1120 1246 1247 /** 1248 * @since 3.9.0 1249 */ 1121 1250 activate: function() { 1122 1251 var library = this.get('library'), … … 1168 1297 }, media.controller.Library.prototype.defaults ), 1169 1298 1299 /** 1300 * @since 3.5.0 1301 */ 1170 1302 initialize: function() { 1171 1303 var library, comparator; … … 1201 1333 }, 1202 1334 1335 /** 1336 * @since 3.5.0 1337 */ 1203 1338 activate: function() { 1204 1339 this.updateSelection(); … … 1208 1343 }, 1209 1344 1345 /** 1346 * @since 3.5.0 1347 */ 1210 1348 deactivate: function() { 1211 1349 this.frame.off( 'open', this.updateSelection, this ); … … 1214 1352 }, 1215 1353 1354 /** 1355 * @since 3.5.0 1356 */ 1216 1357 updateSelection: function() { 1217 1358 var selection = this.get('selection'), … … 1252 1393 }, media.controller.Library.prototype.defaults ), 1253 1394 1395 /** 1396 * @since 3.9.0 1397 * 1398 * @param options 1399 */ 1254 1400 initialize: function( options ) { 1255 1401 var library, comparator; … … 1286 1432 }, 1287 1433 1434 /** 1435 * @since 3.9.0 1436 */ 1288 1437 activate: function() { 1289 1438 this.updateSelection(); … … 1291 1440 }, 1292 1441 1442 /** 1443 * @since 3.9.0 1444 */ 1293 1445 updateSelection: function() { 1294 1446 var selection = this.get('selection'), … … 1318 1470 }, 1319 1471 1472 /** 1473 * @since 3.9.0 1474 */ 1320 1475 activate: function() { 1321 1476 this.listenTo( this.frame, 'toolbar:render:edit-image', this.toolbar ); 1322 1477 }, 1323 1478 1479 /** 1480 * @since 3.9.0 1481 */ 1324 1482 deactivate: function() { 1325 1483 this.stopListening( this.frame ); 1326 1484 }, 1327 1485 1486 /** 1487 * @since 3.9.0 1488 */ 1328 1489 toolbar: function() { 1329 1490 var frame = this.frame, … … 1369 1530 }, media.controller.Library.prototype.defaults ), 1370 1531 1532 /** 1533 * @since 3.9.0 1534 * 1535 * @param options 1536 */ 1371 1537 initialize: function( options ) { 1372 1538 this.media = options.media; … … 1377 1543 }, 1378 1544 1545 /** 1546 * @since 3.9.0 1547 */ 1379 1548 activate: function() { 1380 1549 if ( media.frame.lastMime ) {
Note: See TracChangeset
for help on using the changeset viewer.