Changeset 56961 for trunk/src/wp-includes/blocks/image.php
- Timestamp:
- 10/17/2023 04:06:01 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/image.php
r56945 r56961 219 219 ); 220 220 $w->next_tag( 'img' ); 221 $w->set_attribute( 'data-wp-init', 'effects.core.image. setCurrentSrc' );221 $w->set_attribute( 'data-wp-init', 'effects.core.image.initOriginImage' ); 222 222 $w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' ); 223 223 $w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' ); 224 // We need to set an event callback on the `img` specifically 225 // because the `figure` element can also contain a caption, and 226 // we don't want to trigger the lightbox when the caption is clicked. 227 $w->set_attribute( 'data-wp-on--click', 'actions.core.image.showLightbox' ); 224 228 $w->set_attribute( 'data-wp-effect--setStylesOnResize', 'effects.core.image.setStylesOnResize' ); 225 229 $body_content = $w->get_updated_html(); 226 230 227 // Wrap the image in the body content with a button.231 // Add a button alongside image in the body content. 228 232 $img = null; 229 233 preg_match( '/<img[^>]+>/', $body_content, $img ); … … 236 240 aria-label="' . esc_attr( $aria_label ) . '" 237 241 data-wp-on--click="actions.core.image.showLightbox" 238 data-wp-style--width="context.core.image.imageButtonWidth" 239 data-wp-style--height="context.core.image.imageButtonHeight" 240 data-wp-style--left="context.core.image.imageButtonLeft" 242 data-wp-style--right="context.core.image.imageButtonRight" 241 243 data-wp-style--top="context.core.image.imageButtonTop" 242 ></button>'; 244 style="background: #000" 245 > 246 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> 247 <path d="M9 5H5V9" stroke="#FFFFFF" stroke-width="1.5"/> 248 <path d="M15 19L19 19L19 15" stroke="#FFFFFF" stroke-width="1.5"/> 249 <path d="M15 5H19V9" stroke="#FFFFFF" stroke-width="1.5"/> 250 <path d="M9 19L5 19L5 15" stroke="#FFFFFF" stroke-width="1.5"/> 251 </svg> 252 </button>'; 243 253 244 254 $body_content = preg_replace( '/<img[^>]+>/', $button, $body_content );
Note: See TracChangeset
for help on using the changeset viewer.