Skip to content

Releases: codesandbox/sandpack

v0.1.13

06 Oct 15:32
Compare
Choose a tag to compare

Refactor:

  • Build script: shift to use Esbuild, potentially solves #66 and #80;
  • CodeViewer: improve the code readability and wrap it into a pre tag;

Bundler

v0.1.12

06 Oct 13:32
Compare
Choose a tag to compare

Fixes

  • SandpackCodeViewer: remove the ability to focusit and aria attributes #103

Bundler

v0.1.11

25 Aug 15:00
Compare
Choose a tag to compare

Feature

  • Add line-height to the theme #90

Fixes

  • Small tweaks on the github-light theme #90

Bundler

v0.1.10

23 Aug 15:31
Compare
Choose a tag to compare

Feature

  • Add new theme github-light #89;

Fixes

  • Update all clients after reverting all changes to the files #87;

Bundler

v0.1.9

18 Aug 15:29
Compare
Choose a tag to compare

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,
    },
  ]}
/>

Preview
Screenshot 2021-08-18 at 16 20 41

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

codesandbox/codesandbox-client@e37e8f3

v0.1.8

09 Aug 08:56
Compare
Choose a tag to compare

v0.1.7

02 Aug 09:46
Compare
Choose a tag to compare

v0.1.6

26 Jul 16:12
Compare
Choose a tag to compare

v0.1.5

26 Jul 10:32
Compare
Choose a tag to compare

v0.1.4

23 Jul 14:17
Compare
Choose a tag to compare

Fixes: