Changeset 40821
- Timestamp:
- 05/22/2017 10:04:03 PM (7 years ago)
- Location:
- trunk/src/wp-admin/js/widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/widgets/media-audio-widget.js
r40640 r40821 20 20 createStates: function createStates() { 21 21 this.states.add([ 22 new wp.media.controller.AudioDetails( 22 new wp.media.controller.AudioDetails({ 23 23 media: this.media 24 } 24 }), 25 25 26 new wp.media.controller.MediaLibrary( 26 new wp.media.controller.MediaLibrary({ 27 27 type: 'audio', 28 28 id: 'add-audio-source', … … 31 31 media: this.media, 32 32 menu: false 33 } 33 }) 34 34 ]); 35 35 } … … 44 44 * @constructor 45 45 */ 46 AudioWidgetModel = component.MediaWidgetModel.extend( {});46 AudioWidgetModel = component.MediaWidgetModel.extend({}); 47 47 48 48 /** … … 54 54 * @constructor 55 55 */ 56 AudioWidgetControl = component.MediaWidgetControl.extend( 56 AudioWidgetControl = component.MediaWidgetControl.extend({ 57 57 58 58 /** … … 93 93 previewTemplate = wp.template( 'wp-media-widget-audio-preview' ); 94 94 95 previewContainer.html( previewTemplate( 95 previewContainer.html( previewTemplate({ 96 96 model: { 97 97 attachment_id: control.model.get( 'attachment_id' ), … … 99 99 }, 100 100 error: control.model.get( 'error' ) 101 } ));101 })); 102 102 wp.mediaelement.initialize(); 103 103 }, … … 118 118 state: 'audio-details', 119 119 metadata: metadata 120 } 120 }); 121 121 wp.media.frame = mediaFrame; 122 122 mediaFrame.$el.addClass( 'media-widget' ); … … 142 142 mediaFrame.open(); 143 143 } 144 } 144 }); 145 145 146 146 // Exports. -
trunk/src/wp-admin/js/widgets/media-video-widget.js
r40811 r40821 24 24 }), 25 25 26 new wp.media.controller.MediaLibrary( 26 new wp.media.controller.MediaLibrary({ 27 27 type: 'video', 28 28 id: 'add-video-source', … … 31 31 media: this.media, 32 32 menu: false 33 } 34 35 new wp.media.controller.MediaLibrary( 33 }), 34 35 new wp.media.controller.MediaLibrary({ 36 36 type: 'text', 37 37 id: 'add-track', … … 40 40 media: this.media, 41 41 menu: 'video-details' 42 } 42 }) 43 43 ]); 44 44 } … … 53 53 * @constructor 54 54 */ 55 VideoWidgetModel = component.MediaWidgetModel.extend( {});55 VideoWidgetModel = component.MediaWidgetModel.extend({}); 56 56 57 57 /** … … 63 63 * @constructor 64 64 */ 65 VideoWidgetControl = component.MediaWidgetControl.extend( 65 VideoWidgetControl = component.MediaWidgetControl.extend({ 66 66 67 67 /** … … 182 182 previewTemplate = wp.template( 'wp-media-widget-video-preview' ); 183 183 184 previewContainer.html( previewTemplate( 184 previewContainer.html( previewTemplate({ 185 185 model: { 186 186 attachment_id: control.model.get( 'attachment_id' ), … … 190 190 is_hosted_embed: isHostedEmbed, 191 191 error: error 192 } ));192 })); 193 193 wp.mediaelement.initialize(); 194 194 }, … … 233 233 mediaFrame.open(); 234 234 } 235 } 235 }); 236 236 237 237 // Exports. -
trunk/src/wp-admin/js/widgets/media-widgets.js
r40785 r40821 135 135 noticeContainer.append( $( '<p>', { 136 136 html: notice 137 } ));137 })); 138 138 noticeContainer.slideDown( 'fast' ); 139 139 } … … 218 218 * @returns {void} 219 219 */ 220 renderFail: function renderFail( 220 renderFail: function renderFail() { 221 221 var embedLinkView = this; // eslint-disable-line consistent-this 222 222 $( '#embed-url-field' ).addClass( 'invalid' ); … … 231 231 model: this.model.props, 232 232 priority: 40 233 }) 233 })); 234 234 } 235 235 }); … … 259 259 } 260 260 261 this.states.add( 261 this.states.add([ 262 262 263 263 // Main states. … … 288 288 invalidEmbedTypeError: this.options.invalidEmbedTypeError 289 289 }) 290 ] 290 ]); 291 291 }, 292 292 … … 644 644 645 645 if ( control.isSelected() && 0 !== control.model.get( 'attachment_id' ) ) { 646 selection = new wp.media.model.Selection( [ control.selectedAttachment ]);646 selection = new wp.media.model.Selection([ control.selectedAttachment ]); 647 647 } else { 648 648 selection = null; … … 746 746 control.model.getEmbedResetProps() 747 747 ); 748 } 748 } else { 749 749 throw new Error( 'Unexpected state: ' + state.get( 'id' ) ); 750 750 } … … 761 761 modelProps[ ext ] = ''; 762 762 } 763 } 763 }); 764 764 765 765 return modelProps; -
trunk/src/wp-admin/js/widgets/text-widgets.js
r40631 r40821 126 126 127 127 // Destroy any existing editor so that it can be re-initialized after a widget-updated event. 128 if ( tinymce.get( id ) ) 128 if ( tinymce.get( id ) ) { 129 129 restoreTextMode = tinymce.get( id ).isHidden(); 130 130 wp.editor.remove( id ); … … 136 136 }, 137 137 quicktags: true 138 } 138 }); 139 139 140 140 editor = window.tinymce.get( id ); … … 191 191 editor.on( 'focus', function() { 192 192 control.editorFocused = true; 193 } 193 }); 194 194 editor.on( 'NodeChange', _.debounce( triggerChangeIfDirty, changeDebounceDelay ) ); 195 195 editor.on( 'blur', function() { 196 196 control.editorFocused = false; 197 197 triggerChangeIfDirty(); 198 } 198 }); 199 199 200 200 control.editor = editor;
Note: See TracChangeset
for help on using the changeset viewer.