Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for comment keymap on spanish keyboards #326

Merged
merged 4 commits into from
Jan 12, 2025
Merged
Changes from 1 commit
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
Next Next commit
fix for comment keymap on spanish keyboards
tmhglnd committed Jan 9, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c5f0e03df85636c350c8932d1f594b5827f35dd1
12 changes: 12 additions & 0 deletions packages/web/src/components/editor.tsx
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ import React, { useEffect, useState } from "react";
import { yCollab } from "y-codemirror.next";
import { UndoManager } from "yjs";
import themes from "@/lib/themes";
import { toggleLineComment } from "@codemirror/commands";

const defaultLanguage = "javascript";
const langByTarget = langByTargetUntyped as { [lang: string]: string };
@@ -68,6 +69,16 @@ const panicKeymap = (
: [];
};

const extraKeymap = ( doc: Document ) => {
return keymap.of([
// fixes the Cmd/Alt-/ issue for Spanish keyboards
{ key: 'Shift-Cmd-7', run: toggleLineComment },
{ key: 'Shift-Alt-7', run: toggleLineComment },
{ key: 'Alt-/', run: toggleLineComment },
{ key: 'Ctrl-/', run: toggleLineComment },
])
};

interface FlokSetupOptions {
readOnly?: boolean;
}
@@ -88,6 +99,7 @@ const flokSetup = (
remoteEvalFlash(doc),
Prec.high(evalKeymap(doc, { defaultMode, web })),
panicKeymap(doc),
extraKeymap(doc),
yCollab(text, doc.session.awareness, {
undoManager,
hideCaret: readOnly,