Make WordPress Core


Ignore:
Timestamp:
11/08/2012 02:15:09 PM (12 years ago)
Author:
koopersmith
Message:

Media: Improve sidebar handling and make attachment display properties attachment-specific.

wp.mce.media

  • Watch all workflows for the insert event and attempt to insert the current state's selection if it exists.
  • Fetch and pass attachment display properties through to wp.media.string.image().

wp.media.controller.Region

  • Separate the concept of events and modes.
  • All events triggered on a Region trigger both event and event:mode callbacks.
  • When a mode is deactivated, deactivate and deactivate:mode events are fired.
  • When a mode is activated, activate and activate:mode events are fired.

wp.media.controller.Library

  • Remove the details(), buildDetails(), and clearDetails() methods that juggled sidebar views. Instead, handle the sidebar views using modes.

wp.media.controller.Gallery

  • Shift the overloaded sidebar() method to use modes.

wp.media.view.MediaFrame.Post

  • Declare activate:mode event bindings using an nested object to reduce repetition.
  • Update sidebar activation callbacks.

wp.media.view.Settings

  • Refactor to leverage HTML data attributes and implicit values (instead of setting the fallback whenever an object was created). This has the additional benefit that gallery shortcode parameters are not output when the user has left them set to the default.

see #21390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r22437 r22466  
    14181418
    14191419        <h4><?php _e('Alignment'); ?></h4>
    1420         <div class="alignment button-group button-large" data-setting="align">
     1420        <div class="alignment button-group button-large"
     1421            data-setting="align"
     1422            <# if ( userSettings ) { #>
     1423                data-user-setting="align"
     1424            <# } #>>
     1425
    14211426            <button class="button" value="left">
    14221427                <?php esc_attr_e('Left'); ?>
     
    14281433                <?php esc_attr_e('Right'); ?>
    14291434            </button>
    1430             <button class="button" value="none">
     1435            <button class="button active" value="none">
    14311436                <?php esc_attr_e('None'); ?>
    14321437            </button>
     
    14341439
    14351440        <h4><?php _e('Link To'); ?></h4>
    1436         <div class="link-to button-group button-large" data-setting="link">
    1437             <button class="button" value="post">
     1441        <div class="link-to button-group button-large"
     1442            data-setting="link"
     1443            <# if ( userSettings ) { #>
     1444                data-user-setting="urlbutton"
     1445            <# } #>>
     1446
     1447            <button class="button active" value="post">
    14381448                <?php esc_attr_e('Attachment Page'); ?>
    14391449            </button>
     
    14511461
    14521462        <h4><?php _e('Link To'); ?></h4>
    1453         <div class="link-to button-group" data-setting="link">
    1454             <button class="button" value="post">
     1463        <div class="link-to button-group"
     1464            data-setting="link">
     1465
     1466            <button class="button active" value="post">
    14551467                <?php esc_attr_e('Attachment Page'); ?>
    14561468            </button>
     
    14621474        <h4><?php _e('Gallery Columns'); ?></h4>
    14631475
    1464         <select class="columns" name="columns" data-setting="columns">
     1476        <select class="columns" name="columns"
     1477            data-setting="columns">
    14651478            <?php for ( $i = 1; $i <= 9; $i++ ) : ?>
    1466                 <option value="<?php echo esc_attr( $i ); ?>">
     1479                <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, 3 ); ?>>
    14671480                    <?php echo esc_html( $i ); ?>
    14681481                </option>
Note: See TracChangeset for help on using the changeset viewer.