From 8538bc1d0b298dd2ea2f630eb3ce4fdc86fb02db Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Tue, 5 Dec 2023 16:22:45 +0100 Subject: [PATCH 1/2] Fix the shortcut triggered in edit mode --- packages/application/src/plugins/rise.ts | 23 +++++++++++++++++++++ packages/lab/schema/plugin.json | 26 ++++++++++++------------ yarn.lock | 8 ++++---- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/packages/application/src/plugins/rise.ts b/packages/application/src/plugins/rise.ts index d284bdc..746eaa8 100644 --- a/packages/application/src/plugins/rise.ts +++ b/packages/application/src/plugins/rise.ts @@ -883,11 +883,34 @@ namespace Rise { ): Promise { document.body.classList.add('rise-enabled'); + // Allow the panel to receive focus, to send it to the notebook. + // NOTES: + // Clicking in the notebook panel seems to fallback on reveal background, + // which gives the focus to the body element (at least it is the one targeted + // when using `document.activeElement`), without triggering the onfocus event. + panel.node.tabIndex = -1; + // Add the main reveal.js classes const notebook = panel.content; panel.addClass('reveal'); notebook.addClass('slides'); + // Move the focus to the notebook when the iframe get the focus. + document.body.onfocus = event => { + const target = event.target; + if (target instanceof Window) { + notebook.node.focus(); + } + }; + + // Move the focus to the notebook when the panel get the focus. + panel.node.onfocus = event => { + const target = event.target as HTMLElement; + if (!notebook.node.contains(target)) { + notebook.node.focus(); + } + }; + // Header // Available themes are in static/css/theme const theme = complete_config.theme; diff --git a/packages/lab/schema/plugin.json b/packages/lab/schema/plugin.json index 8de02c6..9af249b 100644 --- a/packages/lab/schema/plugin.json +++ b/packages/lab/schema/plugin.json @@ -46,22 +46,22 @@ { "command": "RISE:firstSlide", "keys": ["Home"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:lastSlide", "keys": ["End"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:toggleOverview", "keys": ["W"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:toggleAllRiseButtons", "keys": [","], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:fullscreenHelp", @@ -71,47 +71,47 @@ { "command": "RISE:riseHelp", "keys": ["?"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-clear", "keys": ["minus"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-reset", "keys": ["="], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-toggleChalkboard", "keys": ["["], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-toggleNotesCanvas", "keys": ["]"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-colorPrev", "keys": ["Q"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-colorNext", "keys": ["S"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:chalkboard-download", "keys": ["\\"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:notes-open", "keys": ["T"], - "selector": ".lm-Widget.reveal" + "selector": ".lm-Widget.reveal .jp-mod-commandMode" }, { "command": "RISE:smart-exec", diff --git a/yarn.lock b/yarn.lock index f28b11c..923e552 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15396,21 +15396,21 @@ __metadata: "typescript@patch:typescript@>=3 < 6#~builtin": version: 5.1.6 - resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin::version=5.1.6&hash=5da071" + resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin::version=5.1.6&hash=85af82" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: f53bfe97f7c8b2b6d23cf572750d4e7d1e0c5fff1c36d859d0ec84556a827b8785077bc27676bf7e71fae538e517c3ecc0f37e7f593be913d884805d931bc8be + checksum: 21e88b0a0c0226f9cb9fd25b9626fb05b4c0f3fddac521844a13e1f30beb8f14e90bd409a9ac43c812c5946d714d6e0dee12d5d02dfc1c562c5aacfa1f49b606 languageName: node linkType: hard "typescript@patch:typescript@~5.0.4#~builtin": version: 5.0.4 - resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=b5f058" + resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=85af82" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: d26b6ba97b6d163c55dbdffd9bbb4c211667ebebc743accfeb2c8c0154aace7afd097b51165a72a5bad2cf65a4612259344ff60f8e642362aa1695c760d303ac + checksum: bb309d320c59a26565fb3793dba550576ab861018ff3fd1b7fccabbe46ae4a35546bc45f342c0a0b6f265c801ccdf64ffd68f548f117ceb7f0eac4b805cd52a9 languageName: node linkType: hard From 954736dddff7a3473ba198a3080a24539363b90d Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Fri, 8 Dec 2023 15:09:38 +0100 Subject: [PATCH 2/2] Fix Lint --- package.json | 310 +++++++++++++++++++++++++-------------------------- 1 file changed, 155 insertions(+), 155 deletions(-) diff --git a/package.json b/package.json index e1fa6c6..ef0df49 100644 --- a/package.json +++ b/package.json @@ -1,165 +1,165 @@ { - "name": "jupyterlab-rise-meta", - "version": "0.41.0", - "description": "RISE: \"Live\" Reveal.js JupyterLab Slideshow extension.", - "keywords": [ - "jupyter", - "jupyterlab", - "jupyterlab-extension" - ], - "private": true, - "files": [], - "workspaces": { - "packages": [ - "app", - "ui-tests", - "packages/*" - ] - }, - "homepage": "https://github.com/jupyterlab-contrib/rise", - "bugs": { - "url": "https://github.com/jupyterlab-contrib/rise/issues" - }, - "license": "BSD-3-Clause", - "author": { - "name": "Frederic Collonval", - "email": "fcollonval@gmail.com" - }, - "contributors": [ - { - "name": "Thierry Parmentelat", - "url": "https://github.com/parmentelat" - }, - { - "name": "Yiqin Zhang" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/jupyterlab-contrib/rise.git" - }, - "scripts": { - "build": "lerna run build", - "build:prod": "lerna run build:prod", - "clean": "lerna run clean", - "eslint": "jlpm eslint:check --fix", - "eslint:check": "eslint . --cache --ext .ts,.tsx", - "lint": "jlpm stylelint && jlpm prettier && jlpm eslint", - "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check", - "prettier": "jlpm prettier:base --write --list-different", - "prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"", - "prettier:check": "jlpm prettier:base --check", - "stylelint": "jlpm stylelint:check --fix", - "stylelint:check": "stylelint --cache \"packages/*/style/**/*.css\"", - "watch": "run-p watch:lib watch:app", - "watch:app": "lerna exec --stream --scope \"rise-app\" yarn watch", - "watch:lib": "lerna exec --stream --scope \"jupyterlab-rise-application\" --scope \"jupyterlab-rise\" yarn watch" - }, - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^6.1.0", - "@typescript-eslint/parser": "^6.1.0", - "eslint": "^8.45.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-prettier": "^5.0.0", - "lerna": "^7.1.0", - "npm-run-all": "^4.1.5", - "prettier": "^3.0.0", - "rimraf": "^5.0.0", - "stylelint": "^15.10.1", - "stylelint-config-recommended": "^13.0.0", - "stylelint-config-standard": "^34.0.0", - "stylelint-prettier": "^4.0.0", - "typescript": "~5.0.4" - }, - "eslintIgnore": [ - "app/build", - "node_modules", - "dist", - "coverage", - "**/*.d.ts", - "tests", - "**/__tests__", - "ui-tests" - ], - "eslintConfig": { - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended" + "name": "jupyterlab-rise-meta", + "version": "0.41.0", + "description": "RISE: \"Live\" Reveal.js JupyterLab Slideshow extension.", + "keywords": [ + "jupyter", + "jupyterlab", + "jupyterlab-extension" ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.eslint.json", - "sourceType": "module" + "private": true, + "files": [], + "workspaces": { + "packages": [ + "app", + "ui-tests", + "packages/*" + ] }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/naming-convention": [ - "error", + "homepage": "https://github.com/jupyterlab-contrib/rise", + "bugs": { + "url": "https://github.com/jupyterlab-contrib/rise/issues" + }, + "license": "BSD-3-Clause", + "author": { + "name": "Frederic Collonval", + "email": "fcollonval@gmail.com" + }, + "contributors": [ { - "selector": "interface", - "format": [ - "PascalCase" - ], - "custom": { - "regex": "^I[A-Z]", - "match": true - } - } - ], - "@typescript-eslint/no-unused-vars": [ - "warn", + "name": "Thierry Parmentelat", + "url": "https://github.com/parmentelat" + }, { - "args": "none" + "name": "Yiqin Zhang" } - ], - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/quotes": [ - "error", - "single", - { - "avoidEscape": true, - "allowTemplateLiterals": false + ], + "repository": { + "type": "git", + "url": "https://github.com/jupyterlab-contrib/rise.git" + }, + "scripts": { + "build": "lerna run build", + "build:prod": "lerna run build:prod", + "clean": "lerna run clean", + "eslint": "jlpm eslint:check --fix", + "eslint:check": "eslint . --cache --ext .ts,.tsx", + "lint": "jlpm stylelint && jlpm prettier && jlpm eslint", + "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check", + "prettier": "jlpm prettier:base --write --list-different", + "prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"", + "prettier:check": "jlpm prettier:base --check", + "stylelint": "jlpm stylelint:check --fix", + "stylelint:check": "stylelint --cache \"packages/*/style/**/*.css\"", + "watch": "run-p watch:lib watch:app", + "watch:app": "lerna exec --stream --scope \"rise-app\" yarn watch", + "watch:lib": "lerna exec --stream --scope \"jupyterlab-rise-application\" --scope \"jupyterlab-rise\" yarn watch" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.1.0", + "@typescript-eslint/parser": "^6.1.0", + "eslint": "^8.45.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^5.0.0", + "lerna": "^7.1.0", + "npm-run-all": "^4.1.5", + "prettier": "^3.0.0", + "rimraf": "^5.0.0", + "stylelint": "^15.10.1", + "stylelint-config-recommended": "^13.0.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-prettier": "^4.0.0", + "typescript": "~5.0.4" + }, + "eslintIgnore": [ + "app/build", + "node_modules", + "dist", + "coverage", + "**/*.d.ts", + "tests", + "**/__tests__", + "ui-tests" + ], + "eslintConfig": { + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.eslint.json", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/naming-convention": [ + "error", + { + "selector": "interface", + "format": [ + "PascalCase" + ], + "custom": { + "regex": "^I[A-Z]", + "match": true + } + } + ], + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "args": "none" + } + ], + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/quotes": [ + "error", + "single", + { + "avoidEscape": true, + "allowTemplateLiterals": false + } + ], + "curly": [ + "error", + "all" + ], + "eqeqeq": "error", + "prefer-arrow-callback": "error" } - ], - "curly": [ - "error", - "all" - ], - "eqeqeq": "error", - "prefer-arrow-callback": "error" - } - }, - "prettier": { - "singleQuote": true, - "trailingComma": "none", - "arrowParens": "avoid", - "endOfLine": "auto", - "overrides": [ - { - "files": "package.json", - "options": { - "tabWidth": 4 + }, + "prettier": { + "singleQuote": true, + "trailingComma": "none", + "arrowParens": "avoid", + "endOfLine": "auto", + "overrides": [ + { + "files": "package.json", + "options": { + "tabWidth": 4 + } + } + ] + }, + "stylelint": { + "extends": [ + "stylelint-config-recommended", + "stylelint-config-standard", + "stylelint-prettier/recommended" + ], + "rules": { + "property-no-vendor-prefix": null, + "selector-class-pattern": null, + "selector-no-vendor-prefix": null, + "value-no-vendor-prefix": null } - } - ] - }, - "stylelint": { - "extends": [ - "stylelint-config-recommended", - "stylelint-config-standard", - "stylelint-prettier/recommended" - ], - "rules": { - "property-no-vendor-prefix": null, - "selector-class-pattern": null, - "selector-no-vendor-prefix": null, - "value-no-vendor-prefix": null } - } }