From c9857e4b95577931e438949a4a9f2ac66d67cc86 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 4 Jul 2022 16:28:22 +0200 Subject: [PATCH] Launch the command palette using a three finger tap --- packages/web/editor.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/web/editor.tsx b/packages/web/editor.tsx index b974546..ad2f6c4 100644 --- a/packages/web/editor.tsx +++ b/packages/web/editor.tsx @@ -6,7 +6,7 @@ import { import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete"; import { indentWithTab, standardKeymap } from "@codemirror/commands"; import { history, historyKeymap } from "@codemirror/commands"; -import { bracketMatching, syntaxHighlighting } from "@codemirror/language"; +import { syntaxHighlighting } from "@codemirror/language"; import { searchKeymap } from "@codemirror/search"; import { EditorSelection, EditorState } from "@codemirror/state"; import { @@ -60,7 +60,6 @@ import { FilterOption, PageMeta } from "@silverbulletmd/common/types"; import { syntaxTree } from "@codemirror/language"; import sandboxSyscalls from "@plugos/plugos/syscalls/sandbox"; import { eventSyscalls } from "@plugos/plugos/syscalls/event"; -// import globalModules from "../common/dist/global.plug.json"; class PageState { constructor( @@ -168,6 +167,15 @@ export class Editor { } } }); + + window.addEventListener("touchstart", (ev) => { + // Launch the command palette using a three-finger tap + if (ev.touches.length > 2) { + ev.stopPropagation(); + ev.preventDefault(); + this.viewDispatch({ type: "show-palette" }); + } + }); } get currentPage(): string | undefined {