💎 PREMIUM: Changeset/ - Full Archive

Changeset 2177669


Ignore:
Timestamp:
10/22/2019 04:40:04 PM (6 years ago)
Author:
iseulde
Message:

v0.0.15

Location:
slide/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • slide/trunk/common.css

    r2177066 r2177669  
    160160    font-size: 2em !important;
    161161}
     162
     163#wpadminbar li > button {
     164    border-radius: 2px;
     165    line-height: 24px;
     166    border: none;
     167    padding: 0 5px;
     168    margin: 0 2px;
     169}
  • slide/trunk/index.js

    r2177110 r2177669  
    690690            {
    691691              title: __('Background Iframe', 'slide'),
    692               icon: 'format-image',
     692              icon: 'format-video',
    693693              initialOpen: false
    694694            },
  • slide/trunk/index.php

    r2177110 r2177669  
    55 * Plugin URI:  https://wordpress.org/plugins/slide/
    66 * Description: Allows you to create presentations with the block editor.
    7  * Version:     0.0.14
     7 * Version:     0.0.15
    88 * Author:      Ella van Durpe
    99 * Author URI:  https://ellavandurpe.com
     
    125125    );
    126126
     127    wp_enqueue_script(
     128        'slide-reveal-notes',
     129        plugins_url( 'reveal/notes.min.js', __FILE__ ),
     130        array( 'slide-reveal' ),
     131        '3.8.0',
     132        true
     133    );
     134
    127135    wp_enqueue_style(
    128136        'slide-reveal',
     
    205213}, 99999 );
    206214
    207 add_action( 'admin_bar_menu', function ( $wp_admin_bar ) {
    208     if ( ! is_singular( 'presentation' ) ) {
    209         return;
    210     }
    211 
    212     $wp_admin_bar->add_node( array(
    213         'id'    => 'slides-fullscreen',
    214         'title' => 'Fullscreen',
    215         'href'  => '#',
    216     ) );
    217 }, 99999 );
    218 
    219215add_filter( 'default_content', function( $post_content, $post ) {
    220216    if ( $post->post_type !== 'presentation' ) {
     
    224220    return file_get_contents( __DIR__ . '/default-content.html' );
    225221}, 10, 2 );
     222
     223add_filter( 'render_block', function( $block_content, $block ) {
     224    if ( ! current_user_can( 'edit_posts' ) ) {
     225        return;
     226    }
     227
     228    if ( $block[ 'blockName' ] !== 'slide/slide' ) {
     229        return $block_content;
     230    }
     231
     232    if ( empty( $block[ 'attrs' ][ 'notes' ] ) ) {
     233        return $block_content;
     234    }
     235
     236    $pos = strrpos( $block_content, '</section>', -1 );
     237    $notes = '<aside class="notes">' . $block[ 'attrs' ][ 'notes' ] . '</aside>';
     238
     239    return substr_replace( $block_content, $notes, $pos, 0 );
     240}, 10, 2 );
  • slide/trunk/readme.md

    r2177110 r2177669  
    66    Requires PHP:      5.6
    77    Tested up to:      5.3
    8     Stable tag:        0.0.14
     8    Stable tag:        0.0.15
    99    License:           GPL-2.0-or-later
    1010    License URI:       http://www.gnu.org/licenses/gpl-2.0.html
  • slide/trunk/template.php

    r2177110 r2177669  
    55    <?php wp_head(); ?>
    66    <style>
    7         #wpadminbar #wp-admin-bar-slides-fullscreen > .ab-item:before {
    8             content: '\f211';
    9             top: 3px;
    10         }
    11 
    127        @media print {
    138            .print-pdf #wpadminbar {
    149                display: none;
    1510            }
     11        }
     12
     13        .receiver #wpadminbar {
     14            display: none;
    1615        }
    1716
     
    7170        section.wp-block-slide-slide {
    7271            top: auto !important;
    73             display: flex !important;
    74             justify-content: center;
    75             flex-direction: column;
    7672            padding-top: <?php echo get_post_meta( get_the_ID(), 'presentation-vertical-padding', true ) ?: '0.2em'; ?> !important;
    7773            padding-bottom: <?php echo get_post_meta( get_the_ID(), 'presentation-vertical-padding', true ) ?: '0.2em'; ?> !important;
     
    133129        </div>
    134130    </div>
     131    <script>var notesFilePath = '<?php echo plugins_url( 'reveal/notes.html', __FILE__ ); ?>';</script>
    135132    <?php wp_footer(); ?>
    136133    <script>
     134        if ( /[?&]receiver/i.test( window.location.search ) ) {
     135            document.body.classList.add( 'receiver' );
     136        }
     137
    137138        Reveal.initialize( {
    138139            transition: '<?php echo get_post_meta( get_the_ID(), 'presentation-transition', true ) ?: 'none'; ?>',
     
    172173            } );
    173174        } );
    174         window.addEventListener( 'DOMContentLoaded', function() {
    175             document.querySelector('#wp-admin-bar-slides-fullscreen a').addEventListener( 'click', function( event ) {
     175        ( () => {
     176            const bar = document.querySelector('ul#wp-admin-bar-root-default');
     177
     178            if ( ! bar ) {
     179                return;
     180            }
     181
     182            const fullscreenLi = document.createElement( 'li' );
     183            const speakerLi = document.createElement( 'li' );
     184            const fullscreenButton = document.createElement( 'button' );
     185            const speakerButton = document.createElement( 'button' );
     186            const fullscreenText = document.createTextNode( '⤡ Fullscreen' );
     187            const speakerText = document.createTextNode( '📣 Speaker View' );
     188
     189            fullscreenButton.appendChild( fullscreenText );
     190            fullscreenLi.appendChild( fullscreenButton );
     191            bar.appendChild( fullscreenLi );
     192
     193            speakerButton.appendChild( speakerText );
     194            speakerLi.appendChild( speakerButton );
     195            bar.appendChild( speakerLi );
     196
     197            fullscreenButton.addEventListener( 'click', function( event ) {
    176198                document.querySelector('.reveal').requestFullscreen();
    177199                event.preventDefault();
    178200            } );
    179         } );
     201            speakerButton.addEventListener( 'click', function( event ) {
     202                Reveal.getPlugin( 'notes' ).open( notesFilePath );
     203                event.preventDefault();
     204            } );
     205        } )();
    180206    </script>
    181207</body>
Note: See TracChangeset for help on using the changeset viewer.