added toggleHelp function
this way a key can be given ability to toggleHelp on and off. Previously Reveal.showHelp could open the help screen, but no way to close it.
This commit is contained in:
		
							
								
								
									
										20
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -1628,6 +1628,18 @@ | |||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Open or close help overlay window. | ||||||
|  | 	 */ | ||||||
|  | 	function toggleHelp(){ | ||||||
|  | 		if( dom.overlay ) { | ||||||
|  | 			closeOverlay(); | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
|  | 			showHelp( true ); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Opens an overlay window with help material. | 	 * Opens an overlay window with help material. | ||||||
| 	 */ | 	 */ | ||||||
| @@ -4113,12 +4125,7 @@ | |||||||
|  |  | ||||||
| 		// Check if the pressed key is question mark | 		// Check if the pressed key is question mark | ||||||
| 		if( event.shiftKey && event.charCode === 63 ) { | 		if( event.shiftKey && event.charCode === 63 ) { | ||||||
| 			if( dom.overlay ) { | 			toggleHelp(); | ||||||
| 				closeOverlay(); |  | ||||||
| 			} |  | ||||||
| 			else { |  | ||||||
| 				showHelp( true ); |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| @@ -4818,6 +4825,7 @@ | |||||||
|  |  | ||||||
| 		// Shows a help overlay with keyboard shortcuts | 		// Shows a help overlay with keyboard shortcuts | ||||||
| 		showHelp: showHelp, | 		showHelp: showHelp, | ||||||
|  | 		toggleHelp: toggleHelp, | ||||||
|  |  | ||||||
| 		// Forces an update in slide layout | 		// Forces an update in slide layout | ||||||
| 		layout: layout, | 		layout: layout, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user