-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Optimization: Bulk Image Optimization #35
base: enhance/PRESS7-76-lazy-load-images
Are you sure you want to change the base?
Image Optimization: Bulk Image Optimization #35
Conversation
…om/newfold-labs/wp-module-performance into enhance/PRESS7-75-bulk-image-optimization
|
||
const modalTitle = document.createElement( 'h2' ); | ||
modalTitle.id = 'nfd-modal-title'; | ||
modalTitle.textContent = 'Optimizing Images...'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Localize text please.
|
||
const currentFileName = document.createElement( 'p' ); | ||
currentFileName.id = 'nfd-current-file'; | ||
currentFileName.textContent = 'Preparing files...'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Localize text please.
@@ -83,6 +84,11 @@ private function register_settings() { | |||
), | |||
), | |||
), | |||
'bulk_optimization' => array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this option above lazy loading to have it be next to the other optimization ones?
…om/newfold-labs/wp-module-performance into enhance/PRESS7-75-bulk-image-optimization
try { | ||
for ( let i = 0; i < selectedItems.length; i++ ) { | ||
if ( cancelRequested ) { | ||
modalTitle.textContent = 'Optimization Canceled'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize text
} | ||
|
||
const { id: mediaId, name: fileName } = selectedItems[ i ]; | ||
currentFileName.textContent = `Optimizing: ${ fileName }`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize string
} | ||
|
||
if ( ! cancelRequested ) { | ||
modalTitle.textContent = 'Optimization Complete!'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize string
bulkOptimizeButton.id = bulkOptimizeButtonId; | ||
bulkOptimizeButton.className = | ||
'button media-button button-large button-primary'; | ||
bulkOptimizeButton.textContent = 'Optimize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize string
setTimeout( closeModal, 2000 ); | ||
} | ||
} catch ( error ) { | ||
modalTitle.textContent = 'An error occurred.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize string
document.querySelectorAll( '.attachment.selected' ) | ||
).map( ( attachment ) => ( { | ||
id: attachment.getAttribute( 'data-id' ), | ||
name: getFileName( attachment ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems filename is always the same if we have more than one image selected because in getFileName function on 134 line where the file name is get by the .media-frame-content .filename that only provide the current selected file, so in case of more selected we only get the last seletec element file name.
Maybe we could change the line like this
name: getFileName( attachment ), | |
name: attachment.getAttribute( 'aria-label' ), |
and then remove the getFileName function on line 133
About the bulk operation in media gallery I was also thinking this: |
Proposed changes
Type of Change
Production
Development
Video
Checklist
Further comments