equal
deleted
inserted
replaced
549 control.listenTo( control.model, 'change', control.render ); |
549 control.listenTo( control.model, 'change', control.render ); |
550 |
550 |
551 // Update the title. |
551 // Update the title. |
552 control.$el.on( 'input change', '.title', function updateTitle() { |
552 control.$el.on( 'input change', '.title', function updateTitle() { |
553 control.model.set({ |
553 control.model.set({ |
554 title: $.trim( $( this ).val() ) |
554 title: $( this ).val().trim() |
555 }); |
555 }); |
556 }); |
556 }); |
557 |
557 |
558 // Update link_url attribute. |
558 // Update link_url attribute. |
559 control.$el.on( 'input change', '.link', function updateLinkUrl() { |
559 control.$el.on( 'input change', '.link', function updateLinkUrl() { |
560 var linkUrl = $.trim( $( this ).val() ), linkType = 'custom'; |
560 var linkUrl = $( this ).val().trim(), linkType = 'custom'; |
561 if ( control.selectedAttachment.get( 'linkUrl' ) === linkUrl || control.selectedAttachment.get( 'link' ) === linkUrl ) { |
561 if ( control.selectedAttachment.get( 'linkUrl' ) === linkUrl || control.selectedAttachment.get( 'link' ) === linkUrl ) { |
562 linkType = 'post'; |
562 linkType = 'post'; |
563 } else if ( control.selectedAttachment.get( 'url' ) === linkUrl ) { |
563 } else if ( control.selectedAttachment.get( 'url' ) === linkUrl ) { |
564 linkType = 'file'; |
564 linkType = 'file'; |
565 } |
565 } |
1210 widgetForm = $( '.editwidget > form' ); |
1210 widgetForm = $( '.editwidget > form' ); |
1211 if ( 0 === widgetForm.length ) { |
1211 if ( 0 === widgetForm.length ) { |
1212 return; |
1212 return; |
1213 } |
1213 } |
1214 |
1214 |
1215 idBase = widgetForm.find( '> .widget-control-actions > .id_base' ).val(); |
1215 idBase = widgetForm.find( '.id_base' ).val(); |
1216 |
1216 |
1217 ControlConstructor = component.controlConstructors[ idBase ]; |
1217 ControlConstructor = component.controlConstructors[ idBase ]; |
1218 if ( ! ControlConstructor ) { |
1218 if ( ! ControlConstructor ) { |
1219 return; |
1219 return; |
1220 } |
1220 } |
1318 var widgetContainer = $( this ); |
1318 var widgetContainer = $( this ); |
1319 component.handleWidgetAdded( new jQuery.Event( 'widget-added' ), widgetContainer ); |
1319 component.handleWidgetAdded( new jQuery.Event( 'widget-added' ), widgetContainer ); |
1320 }); |
1320 }); |
1321 |
1321 |
1322 // Accessibility mode. |
1322 // Accessibility mode. |
1323 $( window ).on( 'load', function() { |
1323 if ( document.readyState === 'complete' ) { |
|
1324 // Page is fully loaded. |
1324 component.setupAccessibleMode(); |
1325 component.setupAccessibleMode(); |
1325 }); |
1326 } else { |
|
1327 // Page is still loading. |
|
1328 $( window ).on( 'load', function() { |
|
1329 component.setupAccessibleMode(); |
|
1330 }); |
|
1331 } |
1326 }); |
1332 }); |
1327 }; |
1333 }; |
1328 |
1334 |
1329 return component; |
1335 return component; |
1330 })( jQuery ); |
1336 })( jQuery ); |