File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
src/resources/formats/revealjs/plugins/pdfexport Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1+ diff --git a/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js b/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
2+ index 93c92eae6..0cf0bd787 100644
3+ --- a/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
4+ +++ b/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
5+ @@ -53,16 +53,20 @@ var PdfExport = ( function( _Reveal ){
6+ }
7+
8+ function isPrintingPDF(){
9+ - return ( /print-pdf/gi ).test( window.location.search );
10+ + return /print-pdf/gi.test(window.location.search) || /view=print/gi.test(window.location.search);
11+ }
12+
13+ function togglePdfExport(){
14+ var url_doc = new URL( document.URL );
15+ var query_doc = new URLSearchParams( url_doc.searchParams );
16+ if( isPrintingPDF() ){
17+ - query_doc.delete( 'print-pdf' );
18+ + if (query_doc.has('print-pdf')) {
19+ + query_doc.delete('print-pdf');
20+ + } else if (query_doc.has('view')) {
21+ + query_doc.delete('view');
22+ + }
23+ }else{
24+ - query_doc.set( 'print-pdf', '' );
25+ + query_doc.set( 'view', 'print' );
26+ }
27+ url_doc.search = ( query_doc.toString() ? '?' + query_doc.toString() : '' );
28+ window.location.href = url_doc.toString();
Original file line number Diff line number Diff line change @@ -461,6 +461,7 @@ export async function updateHtmlDependencies(config: Configuration) {
461461 false , // no v prefix,
462462 resolvePatches ( [
463463 "revealjs-plugin-0001-pdfexport-to-export-toggle-fun.patch" ,
464+ "revealjs-plugin-0001-pdfexport-view-mode.patch"
464465 ] )
465466 ) ;
466467
Original file line number Diff line number Diff line change @@ -53,16 +53,20 @@ var PdfExport = ( function( _Reveal ){
5353 }
5454
5555 function isPrintingPDF ( ) {
56- return ( / p r i n t - p d f / gi ) . test ( window . location . search ) ;
56+ return / p r i n t - p d f / gi. test ( window . location . search ) || / v i e w = p r i n t / gi . test ( window . location . search ) ;
5757 }
5858
5959 function togglePdfExport ( ) {
6060 var url_doc = new URL ( document . URL ) ;
6161 var query_doc = new URLSearchParams ( url_doc . searchParams ) ;
6262 if ( isPrintingPDF ( ) ) {
63- query_doc . delete ( 'print-pdf' ) ;
63+ if ( query_doc . has ( 'print-pdf' ) ) {
64+ query_doc . delete ( 'print-pdf' ) ;
65+ } else if ( query_doc . has ( 'view' ) ) {
66+ query_doc . delete ( 'view' ) ;
67+ }
6468 } else {
65- query_doc . set ( 'print-pdf ' , '' ) ;
69+ query_doc . set ( 'view ' , 'print ' ) ;
6670 }
6771 url_doc . search = ( query_doc . toString ( ) ? '?' + query_doc . toString ( ) : '' ) ;
6872 window . location . href = url_doc . toString ( ) ;
You can’t perform that action at this time.
0 commit comments