Skip to content

Commit

Permalink
minor TS type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Sep 18, 2023
1 parent 89037c8 commit 06589c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,13 +1185,13 @@ patch: ${JSON.stringify(
// if (e.defaultPrevented) {
// return
// }
if (e.key.toLowerCase() === "q" && has_ctrl_or_cmd_pressed(e)) {
if (e.key?.toLowerCase() === "q" && has_ctrl_or_cmd_pressed(e)) {
// This one can't be done as cmd+q on mac, because that closes chrome - Dral
if (Object.values(this.state.notebook.cell_results).some((c) => c.running || c.queued)) {
this.actions.interrupt_remote()
}
e.preventDefault()
} else if (e.key.toLowerCase() === "s" && has_ctrl_or_cmd_pressed(e)) {
} else if (e.key?.toLowerCase() === "s" && has_ctrl_or_cmd_pressed(e)) {
const some_cells_ran = this.actions.set_and_run_all_changed_remote_cells()
if (!some_cells_ran) {
// all cells were in sync allready
Expand Down Expand Up @@ -1239,8 +1239,8 @@ patch: ${JSON.stringify(
}

if (this.state.disable_ui && this.state.backend_launch_phase === BackendLaunchPhase.wait_for_user) {
// const code = e.key.charCodeAt(0)
if (e.key === "Enter" || e.key.length === 1) {
// const code = e.key?.charCodeAt(0)
if (e.key === "Enter" || e.key?.length === 1) {
if (!document.body.classList.contains("wiggle_binder")) {
document.body.classList.add("wiggle_binder")
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/SelectionArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const SelectionArea = ({ on_selection, set_scroller, cell_order }) => {

// Ctrl+A to select all cells
const onkeydown = (e) => {
if (e.key.toLowerCase() === "a" && has_ctrl_or_cmd_pressed(e)) {
if (e.key?.toLowerCase() === "a" && has_ctrl_or_cmd_pressed(e)) {
// if you are not writing text somewhere else
if (document.activeElement === document.body && (window.getSelection()?.isCollapsed ?? true)) {
on_selection(cell_order)
Expand Down

0 comments on commit 06589c7

Please sign in to comment.