Skip to content

Commit

Permalink
fix(react): do not translate code blocks and error messages (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz authored Nov 3, 2021
1 parent f293b0d commit c09acfc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
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

1 comment on commit c09acfc

@vercel
Copy link

@vercel vercel bot commented on c09acfc Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.