Skip to content

Commit a94a7d8

Browse files
authored
Allow stopping presentation whith escape key (#31)
* Allow stopping presentation whith escape key * Bump upload artifact action
1 parent 3a3b76c commit a94a7d8

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
if: always()
103103

104104
- name: Upload (dist)
105-
uses: actions/upload-artifact@v3
105+
uses: actions/upload-artifact@v4
106106
with:
107107
name: jupyterlab-slideshow-dist-${{ github.run_number }}
108108
path: ./dist
@@ -179,7 +179,7 @@ jobs:
179179

180180
# - name: upload (reports)
181181
# if: always()
182-
# uses: actions/upload-artifact@v3
182+
# uses: actions/upload-artifact@v4
183183
# with:
184184
# name: jupyterlab-slideshow-lint-reports-${{ github.run_number }}
185185
# path: ./build/reports
@@ -258,7 +258,7 @@ jobs:
258258

259259
# - name: upload (reports)
260260
# if: always()
261-
# uses: actions/upload-artifact@v3
261+
# uses: actions/upload-artifact@v4
262262
# with:
263263
# name: |-
264264
# jupyterlab-slideshow-reports-${{ matrix.os }}-${{matrix.python-version }}-${{ github.run_number }}

js/jupyterlab-slideshow/src/manager.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
IDeckSettings,
2929
TSlideType,
3030
TLayerScope,
31+
STOP_KEY,
3132
} from './tokens';
3233
import { DesignTools } from './tools/design';
3334
import type { Layover } from './tools/layover';
@@ -341,6 +342,12 @@ export class DeckManager implements IDeckManager {
341342
selector: `.${CSS.remote}`,
342343
});
343344
}
345+
this._commands.addKeyBinding({
346+
command: CommandIds.stop,
347+
args: {},
348+
keys: STOP_KEY,
349+
selector: `.${CSS.remote}`,
350+
});
344351
}
345352

346353
public async showLayover() {

js/jupyterlab-slideshow/src/markdown/presenter.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
COMPOUND_KEYS,
1919
MARKDOWN_MIMETYPES,
2020
MARKDOWN_PREVIEW_FACTORY,
21+
STOP_KEY,
2122
} from '../tokens';
2223

2324
export class SimpleMarkdownPresenter
@@ -149,6 +150,12 @@ export class SimpleMarkdownPresenter
149150
selector: `.${CSS.deck} .${CSS.markdownViewer}`,
150151
});
151152
}
153+
this._commands.addKeyBinding({
154+
command: CommandIds.stop,
155+
args: {},
156+
keys: STOP_KEY,
157+
selector: `.${CSS.deck} .${CSS.markdownViewer}`,
158+
});
152159
}
153160

154161
protected _addWindowListeners() {

js/jupyterlab-slideshow/src/notebook/presenter.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
META,
3636
ICellDeckMetadata,
3737
TLayerScope,
38+
STOP_KEY,
3839
} from '../tokens';
3940
import type { Layover } from '../tools/layover';
4041

@@ -341,6 +342,12 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
341342
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) :focus`,
342343
});
343344
}
345+
this._commands.addKeyBinding({
346+
command: CommandIds.stop,
347+
args: {},
348+
keys: STOP_KEY,
349+
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) :focus`,
350+
});
344351
}
345352

346353
public async canGo(panel: NotebookPanel): Promise<Partial<TCanGoDirection>> {

js/jupyterlab-slideshow/src/tokens.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ export const DIRECTION_KEYS: Record<TDirection, string[]> = {
192192
down: ['ArrowDown'],
193193
};
194194

195+
export const STOP_KEY: string[] = ['Escape'];
196+
195197
export const COMPOUND_LABEL = new Map<[TDirection, TDirection], string>([
196198
[[DIRECTION.down, DIRECTION.forward], 'Go to next fragment, subslide, or slide'],
197199
[[DIRECTION.up, DIRECTION.back], 'Go to previous fragment, subslide, or slide'],

0 commit comments

Comments
 (0)