WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/05/2014 07:00:18 AM (6 years ago)
Author:
azaozz
Message:

Update mce-view.js and the wpview TinyMCE plugin, and use them to show gallery previews in the Visual editor, props gcorne, see #26959

File:
1 edited

Legend:

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

    r27400 r27408  
    651651    <?php
    652652
     653        //TODO: do we want to deal with the fact that the elements used for gallery items are filterable and can be overriden via shortcode attributes
     654        // do we want to deal with the difference between display and edit context at all? (e.g. wptexturize() being applied to the caption.
     655    ?>
     656
     657    <script type="text/html" id="tmpl-editor-gallery">
     658        <div class="toolbar">
     659            <div class="dashicons dashicons-format-gallery edit"></div>
     660            <div class="dashicons dashicons-no-alt remove"></div>
     661        </div>
     662        <div class="gallery gallery-columns-{{{ data.columns }}}">
     663            <# _.each( data.attachments, function( attachment, index ) { #>
     664                <dl class="gallery-item">
     665                    <dt class="gallery-icon">
     666                        <?php // TODO: need to figure out the best way to make sure that we have thumbnails ?>
     667                        <img src="{{{ attachment.sizes.thumbnail.url }}}" />
     668                    </dt>
     669                    <dd class="wp-caption-text gallery-caption">
     670                        {{ attachment.caption }}
     671                    </dd>
     672                </dl>
     673                <?php // this is kind silly, but copied from the gallery shortcode. Maybe it should be removed ?>
     674                <# if ( index % data.columns === data.columns - 1 ) { #>
     675                    <br style="clear: both;">
     676                <# } #>
     677
     678            <# } ); #>
     679        </div>
     680    </script>
     681    <?php
     682
    653683    /**
    654684     * Prints the media manager custom media templates.
Note: See TracChangeset for help on using the changeset viewer.