Changeset 2177669
- Timestamp:
- 10/22/2019 04:40:04 PM (6 years ago)
- Location:
- slide/trunk
- Files:
-
- 2 added
- 5 edited
-
common.css (modified) (1 diff)
-
index.js (modified) (1 diff)
-
index.php (modified) (4 diffs)
-
readme.md (modified) (1 diff)
-
reveal/notes.html (added)
-
reveal/notes.min.js (added)
-
template.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
slide/trunk/common.css
r2177066 r2177669 160 160 font-size: 2em !important; 161 161 } 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 690 690 { 691 691 title: __('Background Iframe', 'slide'), 692 icon: 'format- image',692 icon: 'format-video', 693 693 initialOpen: false 694 694 }, -
slide/trunk/index.php
r2177110 r2177669 5 5 * Plugin URI: https://wordpress.org/plugins/slide/ 6 6 * Description: Allows you to create presentations with the block editor. 7 * Version: 0.0.1 47 * Version: 0.0.15 8 8 * Author: Ella van Durpe 9 9 * Author URI: https://ellavandurpe.com … … 125 125 ); 126 126 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 127 135 wp_enqueue_style( 128 136 'slide-reveal', … … 205 213 }, 99999 ); 206 214 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 219 215 add_filter( 'default_content', function( $post_content, $post ) { 220 216 if ( $post->post_type !== 'presentation' ) { … … 224 220 return file_get_contents( __DIR__ . '/default-content.html' ); 225 221 }, 10, 2 ); 222 223 add_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 6 6 Requires PHP: 5.6 7 7 Tested up to: 5.3 8 Stable tag: 0.0.1 48 Stable tag: 0.0.15 9 9 License: GPL-2.0-or-later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
slide/trunk/template.php
r2177110 r2177669 5 5 <?php wp_head(); ?> 6 6 <style> 7 #wpadminbar #wp-admin-bar-slides-fullscreen > .ab-item:before {8 content: '\f211';9 top: 3px;10 }11 12 7 @media print { 13 8 .print-pdf #wpadminbar { 14 9 display: none; 15 10 } 11 } 12 13 .receiver #wpadminbar { 14 display: none; 16 15 } 17 16 … … 71 70 section.wp-block-slide-slide { 72 71 top: auto !important; 73 display: flex !important;74 justify-content: center;75 flex-direction: column;76 72 padding-top: <?php echo get_post_meta( get_the_ID(), 'presentation-vertical-padding', true ) ?: '0.2em'; ?> !important; 77 73 padding-bottom: <?php echo get_post_meta( get_the_ID(), 'presentation-vertical-padding', true ) ?: '0.2em'; ?> !important; … … 133 129 </div> 134 130 </div> 131 <script>var notesFilePath = '<?php echo plugins_url( 'reveal/notes.html', __FILE__ ); ?>';</script> 135 132 <?php wp_footer(); ?> 136 133 <script> 134 if ( /[?&]receiver/i.test( window.location.search ) ) { 135 document.body.classList.add( 'receiver' ); 136 } 137 137 138 Reveal.initialize( { 138 139 transition: '<?php echo get_post_meta( get_the_ID(), 'presentation-transition', true ) ?: 'none'; ?>', … … 172 173 } ); 173 174 } ); 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 ) { 176 198 document.querySelector('.reveal').requestFullscreen(); 177 199 event.preventDefault(); 178 200 } ); 179 } ); 201 speakerButton.addEventListener( 'click', function( event ) { 202 Reveal.getPlugin( 'notes' ).open( notesFilePath ); 203 event.preventDefault(); 204 } ); 205 } )(); 180 206 </script> 181 207 </body>
Note: See TracChangeset
for help on using the changeset viewer.