react-runner icon indicating copy to clipboard operation
react-runner copied to clipboard

Disabled support

Open antun opened this issue 2 years ago • 2 comments

This is a feature request for a disabled flag on <LiveProvider> like react-live has (doc).

The goal is to allow someone to make the editor read-only:

const isEnabled = someLogicThatChecksIfEditorShouldBeEditable;

return (
 <LiveProvider code={code} scope={scope} disabled={isEnabled}>
    <LivePreview style={{ padding: '10px' }} />
    <LiveEditor style={{ minHeight: '100%', fontFamily: 'monospace' }}
    <LiveError />
  </LiveProvider>
);

antun avatar Jun 28 '23 13:06 antun

Add disabled to LiveError

nihgwu avatar Jul 01 '23 08:07 nihgwu

@nihgwu do you mean:

<LiveError disabled={true} />

If so, I just tried that, but I can still edit the LiveEditor.

antun avatar Jul 17 '23 22:07 antun