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(codemirror): avoid Escape keybinding conflict #581

Merged
merged 5 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages": ["sandpack-client", "sandpack-react"],
"sandboxes": ["sowx8r"],
"sandboxes": ["sowx8r", "c3uup0"],
"node": "14"
}
2 changes: 1 addition & 1 deletion .codesandbox/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"runAtStart": false
},
"yarn install": {
"name": "yarn install",
"name": "Install",
"command": "yarn install"
}
}
Expand Down
3 changes: 2 additions & 1 deletion sandpack-react/src/components/CodeEditor/CodeMirror.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ export const CodeMirror = React.forwardRef<CodeMirrorRef, CodeMirrorProps>(
history(),
closeBrackets(),

...extensions,

keymap.of([
...closeBracketsKeymap,
...defaultKeymap,
Expand All @@ -262,7 +264,6 @@ export const CodeMirror = React.forwardRef<CodeMirrorRef, CodeMirrorProps>(

getEditorTheme(),
highlightTheme,
...extensions,
];

if (readOnly) {
Expand Down
11 changes: 0 additions & 11 deletions sandpack-react/src/components/CodeEditor/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ export const cmClassName = css({
margin: "0",
outline: "none",
height: "100%",

"&:focus-visible": {
boxShadow: "inset 0 0 0 4px $colors$accent",
paddingLeft: "$space$1",
paddingRight: "$space$1",
},
"&:focus-visible .cm-line": { padding: "0 $space$2" },
"&:focus-visible .cm-gutter.cm-lineNumbers": {
paddingLeft: "0",
paddingRight: "$space$2",
},
});

export const readOnlyClassName = css({
Expand Down
1 change: 0 additions & 1 deletion sandpack-react/src/components/FileTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const tabButton = css({
whiteSpace: "nowrap",

"&:focus": { outline: "none" },
"&:focus-visible": { boxShadow: "inset 0 0 0 2px $colors$accent" },
[`&:hover > .${closeButtonClassName}`]: { visibility: "unset" },
});

Expand Down