Releases: codesandbox/sandpack
Releases · codesandbox/sandpack
v0.1.13
v0.1.12
v0.1.11
v0.1.10
v0.1.9
Features
SandpackCodeViewer
It replaces the Prism syntax-highlight in favor to use the Codemirror itself in read-only mode, which will ensure that syntax-highlight will always match on both component, SandpackCodeEditor
and SandpackCodeViewer
.
Decorators
Now the SandpackCodeViewer
supports decorations, which is useful to highlight entire lines or just parts of the code. This is an abstraction on top of Codemirror decorations and for while only works on read-only instances of the Codemirror:
API
<SandpackCodeViewer
showLineNumbers
decorators={[
{ className: "highlight", line: 1 },
{ className: "highlight", line: 9 },
{
className: "widget",
elementAttributes: { "data-id": "1" },
line: 12,
startColumn: 26,
endColumn: 38,
},
{
className: "widget",
elementAttributes: { "data-id": "2" },
line: 13,
startColumn: 8,
endColumn: 17,
},
]}
/>
New methods: reset changes
From now the useSandpack
provider more two methods to control the state of the code editor:
resetAllFiles
: reset all files for all paths;resetFile
: reset the code for a given path;
Example:
const { sandpack } = useSandpack();
const revertCurrentFile = () => {
sandpack.resetFile(sandpack.activePath) // receives a path as argument
}
const revertAllFiles = () => {
sandpack.resetAllFiles()
}
Bundler version
v0.1.8
- Remove more console warning from bundlers
- Bundler commit codesandbox/codesandbox-client@5c8215e
v0.1.7
v0.1.6
- Remove console warning from bundler
- Bundler commit codesandbox/codesandbox-client@9778389
v0.1.5
- Improve how we silent some console warning
- Bundler commit codesandbox/codesandbox-client@d4ee10d
v0.1.4
Fixes:
- Silent some console warning
- Bundler commit codesandbox/codesandbox-client@c38e250