| | 3169 | // Ensure settings remain in sync between attachment views. |
| | 3170 | _.each({ |
| | 3171 | caption: '_syncCaption', |
| | 3172 | title: '_syncTitle' |
| | 3173 | }, function( method, setting ) { |
| | 3174 | media.view.Attachment.prototype[ method ] = function( model, value ) { |
| | 3175 | var $setting = this.$('[data-setting="' + setting + '"]'); |
| | 3176 | |
| | 3177 | if ( ! $setting.length ) |
| | 3178 | return this; |
| | 3179 | |
| | 3180 | // If the updated value is in sync with the value in the DOM, there |
| | 3181 | // is no need to re-render. If we're currently editing the value, |
| | 3182 | // it will automatically be in sync, suppressing the re-render for |
| | 3183 | // the view we're editing, while updating any others. |
| | 3184 | if ( value === $setting.find('input, textarea, select, [value]').val() ) |
| | 3185 | return this; |
| | 3186 | |
| | 3187 | return this.render(); |
| | 3188 | }; |
| | 3189 | }); |
| | 3190 | |