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(react): do not translate code blocks and error messages #117

Merged
merged 1 commit into from
Nov 3, 2021
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"build": "yarn workspaces run build",
"prepare": "husky install",
"clean": "yarn workspaces run clean",
"dev:docs": "yarn workspace sandpack-docs start"
"dev:docs": "yarn workspace sandpack-docs start",
"dev:react": "yarn workspace @codesandbox/sandpack-react storybook"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion sandpack-react/src/common/ErrorOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ErrorOverlay: React.FC = () => {
return null;
}
return (
<div className={c("overlay", "error")}>
<div className={c("overlay", "error")} translate="no">
<div className={c("error-message")}>{errorMessage}</div>
</div>
);
Expand Down
11 changes: 6 additions & 5 deletions sandpack-react/src/components/CodeEditor/CodeMirror.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ export const CodeMirror = React.forwardRef<HTMLElement, CodeMirrorProps>(
view?.dispatch({
// Pass message to clean up inline error
annotations: [
({
{
type: "clean-error",
value: null,
} as unknown) as Annotation<unknown>,
} as unknown as Annotation<unknown>,
],

// Trigger a doc change to remove inline error
Expand All @@ -263,10 +263,10 @@ export const CodeMirror = React.forwardRef<HTMLElement, CodeMirrorProps>(
) {
view?.dispatch({
annotations: [
({
{
type: "error",
value: message.line,
} as unknown) as Annotation<unknown>,
} as unknown as Annotation<unknown>,
],
});
}
Expand All @@ -288,7 +288,7 @@ export const CodeMirror = React.forwardRef<HTMLElement, CodeMirrorProps>(

if (readOnly) {
return (
<pre ref={combinedRef} className={c("cm", editorState)}>
<pre ref={combinedRef} className={c("cm", editorState)} translate="no">
<code className={c("pre-placeholder")}>{code}</code>
</pre>
);
Expand All @@ -307,6 +307,7 @@ export const CodeMirror = React.forwardRef<HTMLElement, CodeMirrorProps>(
onKeyDown={handleContainerKeyDown}
role="group"
tabIndex={0}
translate="no"
>
<pre
className={c("pre-placeholder")}
Expand Down
2 changes: 1 addition & 1 deletion sandpack-react/src/components/FileTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const FileTabs: React.FC<FileTabsProps> = ({ closableTabs }) => {
};

return (
<div className={c("tabs")}>
<div className={c("tabs")} translate="no">
<div
aria-label="Select active file"
className={c("tabs-scrollable-container")}
Expand Down