-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(codeeditor): read-only mode * Update custom-content.md * fixes * fixes * docs * Update sandpack-react/src/components/FileTabs/index.tsx Co-authored-by: Roman Kuba <[email protected]> * Update sandpack-react/src/components/FileTabs/index.tsx Co-authored-by: Roman Kuba <[email protected]> * Update sandpack-react/src/components/FileTabs/index.tsx Co-authored-by: Roman Kuba <[email protected]> * Update sandpack-react/src/presets/Sandpack.tsx Co-authored-by: Roman Kuba <[email protected]> * Update website/docs/docs/getting-started/custom-content.md Co-authored-by: Roman Kuba <[email protected]> * revert changes * update layout * Update CodeEditor.stories.tsx and Sandpack.tsx * Update custom-content.md Co-authored-by: Danilo Woznica <[email protected]> Co-authored-by: Roman Kuba <[email protected]>
- Loading branch information
1 parent
4cf9ca7
commit 9d5d1bf
Showing
13 changed files
with
174 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { useSandpack } from "./useSandpack"; | ||
|
||
/** | ||
* This returns the current state of the active file | ||
* and a method to update its content. | ||
* | ||
* @category Hooks | ||
*/ | ||
export const useActiveCode = (): { | ||
code: string; | ||
readOnly: boolean; | ||
updateCode: (newCode: string) => void; | ||
} => { | ||
const { sandpack } = useSandpack(); | ||
|
||
return { | ||
code: sandpack.files[sandpack.activePath].code, | ||
readOnly: sandpack.files[sandpack.activePath].readOnly ?? false, | ||
updateCode: sandpack.updateCurrentFile, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters