diff --git src/wp-admin/js/common.js src/wp-admin/js/common.js
index 9d8af9b..9c49be8 100644
|
|
|
$(document).ready( function() {
|
| 247 | 247 | $( document ).trigger( 'wp-collapse-menu', { state: state } ); |
| 248 | 248 | }); |
| 249 | 249 | |
| | 250 | /** |
| | 251 | * Ensure an admin submenu is within the visual viewport. |
| | 252 | * |
| | 253 | * @since 4.1.0 |
| | 254 | * |
| | 255 | * @param {jQuery} $menuItem The parent menu item containing the submenu. |
| | 256 | */ |
| 250 | 257 | function adjustSubmenu( $menuItem ) { |
| 251 | 258 | var bottomOffset, pageHeight, adjustment, theFold, menutop, wintop, maxtop, |
| 252 | 259 | $submenu = $menuItem.find( '.wp-submenu' ); |
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 7b9f7b1..23fa4f5 100644
|
|
|
|
| 35 | 35 | /** |
| 36 | 36 | * Watch all changes to Value properties, and bubble changes to parent Values instance |
| 37 | 37 | * |
| | 38 | * @since 4.1.0 |
| | 39 | * |
| 38 | 40 | * @param {wp.customize.Class} instance |
| 39 | | * @param {Array} properties The names of the Value instances to watch. |
| | 41 | * @param {Array} properties The names of the Value instances to watch. |
| 40 | 42 | */ |
| 41 | 43 | bubbleChildValueChanges = function ( instance, properties ) { |
| 42 | 44 | $.each( properties, function ( i, key ) { |
| … |
… |
|
| 51 | 53 | /** |
| 52 | 54 | * Expand a panel, section, or control and focus on the first focusable element. |
| 53 | 55 | * |
| 54 | | * @param {Object} [params] |
| | 56 | * @since 4.1.0 |
| | 57 | * |
| | 58 | * @param {Object} [params] |
| | 59 | * @param {Callback} [params.completeCallback] |
| 55 | 60 | */ |
| 56 | 61 | focus = function ( params ) { |
| 57 | 62 | var construct, completeCallback, focus; |
| … |
… |
|
| 82 | 87 | * |
| 83 | 88 | * If a.priority() === b.priority(), then sort by their respective params.instanceNumber. |
| 84 | 89 | * |
| | 90 | * @since 4.1.0 |
| | 91 | * |
| 85 | 92 | * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} a |
| 86 | 93 | * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} b |
| 87 | 94 | * @returns {Number} |
| … |
… |
|
| 97 | 104 | /** |
| 98 | 105 | * Return whether the supplied Event object is for a keydown event but not the Enter key. |
| 99 | 106 | * |
| | 107 | * @since 4.1.0 |
| | 108 | * |
| 100 | 109 | * @param {jQuery.Event} event |
| 101 | 110 | * @returns {boolean} |
| 102 | 111 | */ |
| … |
… |
|
| 107 | 116 | /** |
| 108 | 117 | * Return whether the two lists of elements are the same and are in the same order. |
| 109 | 118 | * |
| | 119 | * @since 4.1.0 |
| | 120 | * |
| 110 | 121 | * @param {Array|jQuery} listA |
| 111 | 122 | * @param {Array|jQuery} listB |
| 112 | 123 | * @returns {boolean} |
| … |
… |
|
| 125 | 136 | }; |
| 126 | 137 | |
| 127 | 138 | /** |
| 128 | | * Base class for Panel and Section |
| | 139 | * Base class for Panel and Section. |
| | 140 | * |
| | 141 | * @since 4.1.0 |
| 129 | 142 | * |
| 130 | 143 | * @class |
| 131 | 144 | * @augments wp.customize.Class |
| … |
… |
|
| 134 | 147 | defaultActiveArguments: { duration: 'fast', completeCallback: $.noop }, |
| 135 | 148 | defaultExpandedArguments: { duration: 'fast', completeCallback: $.noop }, |
| 136 | 149 | |
| | 150 | /** |
| | 151 | * @since 4.1.0 |
| | 152 | * |
| | 153 | * @param {String} id |
| | 154 | * @param {Object} options |
| | 155 | */ |
| 137 | 156 | initialize: function ( id, options ) { |
| 138 | 157 | var container = this; |
| 139 | 158 | container.id = id; |
| … |
… |
|
| 174 | 193 | }, |
| 175 | 194 | |
| 176 | 195 | /** |
| | 196 | * @since 4.1.0 |
| | 197 | * |
| 177 | 198 | * @abstract |
| 178 | 199 | */ |
| 179 | 200 | ready: function() {}, |
| … |
… |
|
| 181 | 202 | /** |
| 182 | 203 | * Get the child models associated with this parent, sorting them by their priority Value. |
| 183 | 204 | * |
| | 205 | * @since 4.1.0 |
| | 206 | * |
| 184 | 207 | * @param {String} parentType |
| 185 | 208 | * @param {String} childType |
| 186 | 209 | * @returns {Array} |
| … |
… |
|
| 199 | 222 | |
| 200 | 223 | /** |
| 201 | 224 | * To override by subclass, to return whether the container has active children. |
| | 225 | * |
| | 226 | * @since 4.1.0 |
| | 227 | * |
| 202 | 228 | * @abstract |
| 203 | 229 | */ |
| 204 | 230 | isContextuallyActive: function () { |
| … |
… |
|
| 207 | 233 | |
| 208 | 234 | /** |
| 209 | 235 | * Handle changes to the active state. |
| | 236 | * |
| 210 | 237 | * This does not change the active state, it merely handles the behavior |
| 211 | 238 | * for when it does change. |
| 212 | 239 | * |
| 213 | 240 | * To override by subclass, update the container's UI to reflect the provided active state. |
| 214 | 241 | * |
| | 242 | * @since 4.1.0 |
| | 243 | * |
| 215 | 244 | * @param {Boolean} active |
| 216 | | * @param {Object} args merged on top of this.defaultActiveArguments |
| | 245 | * @param {Object} args |
| | 246 | * @param {Object} args.duration |
| | 247 | * @param {Object} args.completeCallback |
| 217 | 248 | */ |
| 218 | 249 | onChangeActive: function ( active, args ) { |
| 219 | 250 | var duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 ); |
| … |
… |
|
| 229 | 260 | }, |
| 230 | 261 | |
| 231 | 262 | /** |
| | 263 | * @since 4.1.0 |
| | 264 | * |
| 232 | 265 | * @params {Boolean} active |
| 233 | | * @param {Object} [params] |
| | 266 | * @param {Object} [params] |
| 234 | 267 | * @returns {Boolean} false if state already applied |
| 235 | 268 | */ |
| 236 | 269 | _toggleActive: function ( active, params ) { |
| … |
… |
|
| 316 | 349 | }); |
| 317 | 350 | |
| 318 | 351 | /** |
| | 352 | * @since 4.1.0 |
| | 353 | * |
| 319 | 354 | * @class |
| 320 | 355 | * @augments wp.customize.Class |
| 321 | 356 | */ |
| 322 | 357 | api.Section = Container.extend({ |
| 323 | 358 | |
| 324 | 359 | /** |
| | 360 | * @since 4.1.0 |
| | 361 | * |
| 325 | 362 | * @param {String} id |
| 326 | | * @param {Array} options |
| | 363 | * @param {Array} options |
| 327 | 364 | */ |
| 328 | 365 | initialize: function ( id, options ) { |
| 329 | 366 | var section = this; |
| … |
… |
|
| 345 | 382 | |
| 346 | 383 | /** |
| 347 | 384 | * Embed the container in the DOM when any parent panel is ready. |
| | 385 | * |
| | 386 | * @since 4.1.0 |
| 348 | 387 | */ |
| 349 | 388 | embed: function () { |
| 350 | 389 | var section = this, inject; |
| … |
… |
|
| 378 | 417 | }, |
| 379 | 418 | |
| 380 | 419 | /** |
| 381 | | * Add behaviors for the accordion section |
| | 420 | * Add behaviors for the accordion section. |
| | 421 | * |
| | 422 | * @since 4.1.0 |
| 382 | 423 | */ |
| 383 | 424 | attachEvents: function () { |
| 384 | 425 | var section = this; |
| … |
… |
|
| 401 | 442 | /** |
| 402 | 443 | * Return whether this section has any active controls. |
| 403 | 444 | * |
| 404 | | * @returns {boolean} |
| | 445 | * @since 4.1.0 |
| | 446 | * |
| | 447 | * @returns {Boolean} |
| 405 | 448 | */ |
| 406 | 449 | isContextuallyActive: function () { |
| 407 | 450 | var section = this, |
| … |
… |
|
| 418 | 461 | /** |
| 419 | 462 | * Get the controls that are associated with this section, sorted by their priority Value. |
| 420 | 463 | * |
| | 464 | * @since 4.1.0 |
| | 465 | * |
| 421 | 466 | * @returns {Array} |
| 422 | 467 | */ |
| 423 | 468 | controls: function () { |
| … |
… |
|
| 425 | 470 | }, |
| 426 | 471 | |
| 427 | 472 | /** |
| 428 | | * Update UI to reflect expanded state |
| | 473 | * Update UI to reflect expanded state. |
| | 474 | * |
| | 475 | * @since 4.1.0 |
| 429 | 476 | * |
| 430 | 477 | * @param {Boolean} expanded |
| 431 | | * @param {Object} args |
| | 478 | * @param {Object} args |
| 432 | 479 | */ |
| 433 | 480 | onChangeExpanded: function ( expanded, args ) { |
| 434 | 481 | var section = this, |
| … |
… |
|
| 471 | 518 | }); |
| 472 | 519 | |
| 473 | 520 | /** |
| | 521 | * @since 4.1.0 |
| | 522 | * |
| 474 | 523 | * @class |
| 475 | 524 | * @augments wp.customize.Class |
| 476 | 525 | */ |
| 477 | 526 | api.Panel = Container.extend({ |
| | 527 | /** |
| | 528 | * @since 4.1.0 |
| | 529 | * |
| | 530 | * @param {String} id |
| | 531 | * @param {Object} options |
| | 532 | */ |
| 478 | 533 | initialize: function ( id, options ) { |
| 479 | 534 | var panel = this; |
| 480 | 535 | Container.prototype.initialize.call( panel, id, options ); |
| … |
… |
|
| 486 | 541 | |
| 487 | 542 | /** |
| 488 | 543 | * Embed the container in the DOM when any parent panel is ready. |
| | 544 | * |
| | 545 | * @since 4.1.0 |
| 489 | 546 | */ |
| 490 | 547 | embed: function () { |
| 491 | 548 | var panel = this, |
| … |
… |
|
| 498 | 555 | }, |
| 499 | 556 | |
| 500 | 557 | /** |
| 501 | | * |
| | 558 | * @since 4.1.0 |
| 502 | 559 | */ |
| 503 | 560 | attachEvents: function () { |
| 504 | 561 | var meta, panel = this; |
| … |
… |
|
| 542 | 599 | /** |
| 543 | 600 | * Get the sections that are associated with this panel, sorted by their priority Value. |
| 544 | 601 | * |
| | 602 | * @since 4.1.0 |
| | 603 | * |
| 545 | 604 | * @returns {Array} |
| 546 | 605 | */ |
| 547 | 606 | sections: function () { |
| … |
… |
|
| 551 | 610 | /** |
| 552 | 611 | * Return whether this panel has any active sections. |
| 553 | 612 | * |
| | 613 | * @since 4.1.0 |
| | 614 | * |
| 554 | 615 | * @returns {boolean} |
| 555 | 616 | */ |
| 556 | 617 | isContextuallyActive: function () { |
| … |
… |
|
| 568 | 629 | /** |
| 569 | 630 | * Update UI to reflect expanded state |
| 570 | 631 | * |
| 571 | | * @param {Boolean} expanded |
| 572 | | * @param {Object} args merged with this.defaultExpandedArguments |
| | 632 | * @since 4.1.0 |
| | 633 | * |
| | 634 | * @param {Boolean} expanded |
| | 635 | * @param {Object} args |
| | 636 | * @param {Boolean} args.unchanged |
| | 637 | * @param {Callback} args.completeCallback |
| 573 | 638 | */ |
| 574 | 639 | onChangeExpanded: function ( expanded, args ) { |
| 575 | 640 | |
| … |
… |
|
| 791 | 856 | }, |
| 792 | 857 | |
| 793 | 858 | /** |
| 794 | | * Bring the containing section and panel into view and then this control into view, focusing on the first input |
| | 859 | * Bring the containing section and panel into view and then |
| | 860 | * this control into view, focusing on the first input. |
| 795 | 861 | */ |
| 796 | 862 | focus: focus, |
| 797 | 863 | |
| … |
… |
|
| 800 | 866 | * This does not change the active state, it merely handles the behavior |
| 801 | 867 | * for when it does change. |
| 802 | 868 | * |
| 803 | | * @param {Boolean} active |
| 804 | | * @param {Object} args merged on top of this.defaultActiveArguments |
| | 869 | * @since 4.1.0 |
| | 870 | * |
| | 871 | * @param {Boolean} active |
| | 872 | * @param {Object} args |
| | 873 | * @param {Number} args.duration |
| | 874 | * @param {Callback} args.completeCallback |
| 805 | 875 | */ |
| 806 | 876 | onChangeActive: function ( active, args ) { |
| 807 | 877 | if ( ! $.contains( document, this.container ) ) { |
| … |
… |
|
| 816 | 886 | }, |
| 817 | 887 | |
| 818 | 888 | /** |
| 819 | | * @deprecated alias of onChangeActive |
| | 889 | * @deprecated 4.1.0 Use this.onChangeActive() instead. |
| 820 | 890 | */ |
| 821 | 891 | toggle: function ( active ) { |
| 822 | 892 | return this.onChangeActive( active, this.defaultActiveArguments ); |
| … |
… |
|
| 825 | 895 | /** |
| 826 | 896 | * Shorthand way to enable the active state. |
| 827 | 897 | * |
| | 898 | * @since 4.1.0 |
| | 899 | * |
| 828 | 900 | * @param {Object} [params] |
| 829 | 901 | * @returns {Boolean} false if already active |
| 830 | 902 | */ |
| … |
… |
|
| 833 | 905 | /** |
| 834 | 906 | * Shorthand way to disable the active state. |
| 835 | 907 | * |
| | 908 | * @since 4.1.0 |
| | 909 | * |
| 836 | 910 | * @param {Object} [params] |
| 837 | 911 | * @returns {Boolean} false if already inactive |
| 838 | 912 | */ |
| … |
… |
|
| 879 | 953 | * Render the control from its JS template, if it exists. |
| 880 | 954 | * |
| 881 | 955 | * The control's container must already exist in the DOM. |
| | 956 | * |
| | 957 | * @since 4.1.0 |
| 882 | 958 | */ |
| 883 | 959 | renderContent: function () { |
| 884 | 960 | var template, |
| … |
… |
|
| 1290 | 1366 | // Change objects contained within the main customize object to Settings. |
| 1291 | 1367 | api.defaultConstructor = api.Setting; |
| 1292 | 1368 | |
| 1293 | | // Create the collection of Control objects. |
| | 1369 | // Create the collections for Controls, Sections and Panels. |
| 1294 | 1370 | api.control = new api.Values({ defaultConstructor: api.Control }); |
| 1295 | 1371 | api.section = new api.Values({ defaultConstructor: api.Section }); |
| 1296 | 1372 | api.panel = new api.Values({ defaultConstructor: api.Panel }); |
| … |
… |
|
| 1494 | 1570 | }()); |
| 1495 | 1571 | |
| 1496 | 1572 | /** |
| 1497 | | * Set the document title of the customizer |
| | 1573 | * Set the document title of the customizer. |
| | 1574 | * |
| | 1575 | * @since 4.1.0 |
| 1498 | 1576 | * |
| 1499 | 1577 | * @param {string} documentTitle |
| 1500 | 1578 | */ |
| … |
… |
|
| 1627 | 1705 | // Update the URL when the iframe sends a URL message. |
| 1628 | 1706 | this.bind( 'url', this.previewUrl ); |
| 1629 | 1707 | |
| 1630 | | // Update the document title when the preview changes |
| | 1708 | // Update the document title when the preview changes. |
| 1631 | 1709 | this.bind( 'documentTitle', function ( title ) { |
| 1632 | 1710 | api.setDocumentTitle( title ); |
| 1633 | 1711 | } ); |
| … |
… |
|
| 1766 | 1844 | } |
| 1767 | 1845 | }); |
| 1768 | 1846 | |
| 1769 | | // Expand/Collapse the main customizer customize info |
| | 1847 | // Expand/Collapse the main customizer customize info. |
| 1770 | 1848 | $( '#customize-info' ).find( '> .accordion-section-title' ).on( 'click keydown', function( event ) { |
| 1771 | 1849 | if ( isKeydownButNotEnterEvent( event ) ) { |
| 1772 | 1850 | return; |
| … |
… |
|
| 1941 | 2019 | |
| 1942 | 2020 | /** |
| 1943 | 2021 | * Sort panels, sections, controls by priorities. Hide empty sections and panels. |
| | 2022 | * |
| | 2023 | * @since 4.1.0 |
| 1944 | 2024 | */ |
| 1945 | 2025 | api.reflowPaneContents = _.bind( function () { |
| 1946 | 2026 | |
diff --git src/wp-admin/js/customize-widgets.js src/wp-admin/js/customize-widgets.js
index d649b6b..93585ab 100644
|
|
|
|
| 409 | 409 | completeCallback: $.noop |
| 410 | 410 | }, |
| 411 | 411 | |
| | 412 | /** |
| | 413 | * @since 4.1.0 |
| | 414 | */ |
| 412 | 415 | initialize: function ( id, options ) { |
| 413 | 416 | var control = this; |
| 414 | 417 | api.Control.prototype.initialize.call( control, id, options ); |
| … |
… |
|
| 800 | 803 | * |
| 801 | 804 | * Overrides api.Control.toggle() |
| 802 | 805 | * |
| 803 | | * @param {Boolean} active |
| 804 | | * @param {Object} args |
| | 806 | * @since 4.1.0 |
| | 807 | * |
| | 808 | * @param {Boolean} active |
| | 809 | * @param {Object} args |
| | 810 | * @param {Callback} args.completeCallback |
| 805 | 811 | */ |
| 806 | 812 | onChangeActive: function ( active, args ) { |
| 807 | 813 | // Note: there is a second 'args' parameter being passed, merged on top of this.defaultActiveArguments |
| … |
… |
|
| 1134 | 1140 | }, |
| 1135 | 1141 | |
| 1136 | 1142 | /** |
| | 1143 | * @since 4.1.0 |
| | 1144 | * |
| 1137 | 1145 | * @param {Boolean} expanded |
| 1138 | 1146 | * @param {Object} [params] |
| 1139 | 1147 | * @returns {Boolean} false if state already applied |
| … |
… |
|
| 1141 | 1149 | _toggleExpanded: api.Section.prototype._toggleExpanded, |
| 1142 | 1150 | |
| 1143 | 1151 | /** |
| | 1152 | * @since 4.1.0 |
| | 1153 | * |
| 1144 | 1154 | * @param {Object} [params] |
| 1145 | 1155 | * @returns {Boolean} false if already expanded |
| 1146 | 1156 | */ |
| … |
… |
|
| 1149 | 1159 | /** |
| 1150 | 1160 | * Expand the widget form control |
| 1151 | 1161 | * |
| 1152 | | * @deprecated alias of expand() |
| | 1162 | * @deprecated 4.1.0 Use this.expand() instead. |
| 1153 | 1163 | */ |
| 1154 | 1164 | expandForm: function() { |
| 1155 | 1165 | this.expand(); |
| 1156 | 1166 | }, |
| 1157 | 1167 | |
| 1158 | 1168 | /** |
| | 1169 | * @since 4.1.0 |
| | 1170 | * |
| 1159 | 1171 | * @param {Object} [params] |
| 1160 | 1172 | * @returns {Boolean} false if already collapsed |
| 1161 | 1173 | */ |
| … |
… |
|
| 1164 | 1176 | /** |
| 1165 | 1177 | * Collapse the widget form control |
| 1166 | 1178 | * |
| 1167 | | * @deprecated alias of expand() |
| | 1179 | * @deprecated 4.1.0 Use this.collapse() instead. |
| 1168 | 1180 | */ |
| 1169 | 1181 | collapseForm: function() { |
| 1170 | 1182 | this.collapse(); |
| … |
… |
|
| 1378 | 1390 | |
| 1379 | 1391 | /** |
| 1380 | 1392 | * Sync the section's active state back to the Backbone model's is_rendered attribute |
| | 1393 | * |
| | 1394 | * @since 4.1.0 |
| 1381 | 1395 | */ |
| 1382 | 1396 | ready: function () { |
| 1383 | 1397 | var section = this, registeredSidebar; |