Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 87 additions & 7 deletions packages/application/src/plugins/rise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,9 @@ namespace Rise {

async function Revealer(
panel: NotebookPanel,
selected_slide: [number, number]
selected_slide: [number, number],
commands: CommandRegistry,
trans: TranslationBundle
): Promise<void> {
document.body.classList.add('rise-enabled');

Expand Down Expand Up @@ -988,7 +990,8 @@ namespace Rise {
36: null, // Home - first slide disabled (will be set in custom keys)
38: null, // up arrow disabled
40: null, // down arrow disabled
66: null, // b, black pause disabled, use period or forward slash
66: null, // b, black pause disabled, use period or forward slash -> using b event now
68: null, // d, scancode disabled, now used manually for downloading chalkboard
70: null, // disable fullscreen inside the slideshow, makes codemirror unreliable
72: null, // h, left disabled
74: null, // j, down disabled
Expand Down Expand Up @@ -1093,7 +1096,7 @@ namespace Rise {

if (!complete_config.show_buttons_on_startup) {
/* safer, and nicer too, to wait for reveal extensions to start */
setTimeout(toggleAllRiseButtons, 2000);
setTimeout(toggleAllRiseButtons, 5000); // Question mark disappears 5 seconds after opening slideshow
}

panel.content.activeCellChanged.connect((sender, cell) => {
Expand All @@ -1108,6 +1111,79 @@ namespace Rise {
Reveal.slide(i.h, i.v, i.f);
}
});

/* ! ! ! THE FOLLOWING KEYBOARD-EVENT CODE BLOCK BELONGS BENEATH THE IMPROVED CHALKBOARD ! ! !
Keyboard shortcuts specific to RISE (add more shortcuts here manually):
*/
document.addEventListener('keydown', (event: KeyboardEvent) => {
if (!document.body.classList.contains('rise-enabled')) return; //if slides are not opened, do nothing

const k = event.key;
const isKey =
k === 'f' || k === 'F' ||
k === 'l' || k === 'L' ||
k === 'p' || k === 'P' ||
k === 'd' || k === 'D' ||
k === 's' || k === 'S' ||
k === 'q' || k === 'Q' ||
k === '.' ||
k === '?' ||
k === '=' ||
k === '-';

if (!isKey) return;

event.stopImmediatePropagation(); //prevents other event-listeners to be executed for the same elements
event.preventDefault(); //prevents defult action from browser
switch (k) {

case '?':
displayRiseHelp(commands, trans);
break;

case '.':
Reveal.togglePause();
break;

case 'f': //open fullscreen
case 'F':
fullscreenHelp();
break;

case 'l': //open (not working) chalkboard
case 'L':
(window as any).RevealChalkboard?.toggleChalkboard();
break;

case 'p': //open working chalkboard
case 'P':
(window as any).RevealChalkboard?.toggleNotesCanvas();
break;

case '=': //reset chalkboard data on current slide
(window as any).RevealChalkboard?.reset();
break;

case '-': //clear full size chalkboard
(window as any).RevealChalkboard?.clear();
break;

case 'd': //download chalkboard data
case 'D':
(window as any).RevealChalkboard?.download();
break;

case 's': //next chalkboard color
case 'S':
(window as any).RevealChalkboard?.colorNext();
break;

case 'q': //previous chalkboard color
case 'Q':
(window as any).RevealChalkboard?.colorPrev();
break;
}
}, true);
}

function Unselecter(notebook: Notebook) {
Expand All @@ -1124,7 +1200,7 @@ namespace Rise {
// Preparing the new reveal-compatible structure
const selected_slide = markupSlides(notebook);
// Adding the reveal stuff
Revealer(panel, selected_slide);
Revealer(panel, selected_slide, commands, trans);
// Minor modifications for usability
addHelpButton(panel, commands, trans);
}
Expand Down Expand Up @@ -1171,10 +1247,13 @@ namespace Rise {
${helpListItem(CommandIDs.riseLastSlide)}
${helpListItem(CommandIDs.riseToggleOverview)}
${helpListItem(CommandIDs.riseNotesOpen)}
<li><kbd>${CommandRegistry.formatKeystroke('F')}</kbd>: ${trans.__(
'open fullscreen'
)}</li>
<li><kbd>${CommandRegistry.formatKeystroke(',')}</kbd>: ${
helpStrings[CommandIDs.riseToggleAllButtons]
}</li>
<li><kbd>${CommandRegistry.formatKeystroke('/')}</kbd>: ${trans.__(
<li><kbd>${CommandRegistry.formatKeystroke('.')}</kbd>: ${trans.__(
'black screen'
)}</li>
<li><strong>${trans.__('less useful')}:</strong></li>
Expand Down Expand Up @@ -1216,7 +1295,8 @@ namespace Rise {
await showDialog({
title: trans.__('Reveal Shortcuts Help'),
body: new Widget({ node }),
buttons: [Dialog.warnButton({ label: trans.__('OK') })]
buttons: [Dialog.warnButton({ label: trans.__('OK') })],
host: document.querySelector('.reveal') as HTMLElement //!!!
});
}

Expand Down Expand Up @@ -1332,4 +1412,4 @@ namespace Private {
_error(...args);
};
}
}
}
6 changes: 3 additions & 3 deletions packages/lab/schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@
},
{
"command": "RISE:chalkboard-toggleChalkboard",
"keys": ["["],
"keys": ["l"],
"selector": ".lm-Widget.reveal .jp-mod-commandMode"
},
{
"command": "RISE:chalkboard-toggleNotesCanvas",
"keys": ["]"],
"keys": ["p"],
"selector": ".lm-Widget.reveal .jp-mod-commandMode"
},
{
Expand All @@ -105,7 +105,7 @@
},
{
"command": "RISE:chalkboard-download",
"keys": ["\\"],
"keys": ["D"],
"selector": ".lm-Widget.reveal .jp-mod-commandMode"
},
{
Expand Down