--- a/wp/wp-admin/js/widgets/media-widgets.js Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/js/widgets/media-widgets.js Wed Sep 21 18:19:35 2022 +0200
@@ -551,13 +551,13 @@
// Update the title.
control.$el.on( 'input change', '.title', function updateTitle() {
control.model.set({
- title: $.trim( $( this ).val() )
+ title: $( this ).val().trim()
});
});
// Update link_url attribute.
control.$el.on( 'input change', '.link', function updateLinkUrl() {
- var linkUrl = $.trim( $( this ).val() ), linkType = 'custom';
+ var linkUrl = $( this ).val().trim(), linkType = 'custom';
if ( control.selectedAttachment.get( 'linkUrl' ) === linkUrl || control.selectedAttachment.get( 'link' ) === linkUrl ) {
linkType = 'post';
} else if ( control.selectedAttachment.get( 'url' ) === linkUrl ) {
@@ -1212,7 +1212,7 @@
return;
}
- idBase = widgetForm.find( '> .widget-control-actions > .id_base' ).val();
+ idBase = widgetForm.find( '.id_base' ).val();
ControlConstructor = component.controlConstructors[ idBase ];
if ( ! ControlConstructor ) {
@@ -1320,9 +1320,15 @@
});
// Accessibility mode.
- $( window ).on( 'load', function() {
+ if ( document.readyState === 'complete' ) {
+ // Page is fully loaded.
component.setupAccessibleMode();
- });
+ } else {
+ // Page is still loading.
+ $( window ).on( 'load', function() {
+ component.setupAccessibleMode();
+ });
+ }
});
};